exponax-spde 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. exponax_spde-0.2.0/LICENSE.txt +22 -0
  2. exponax_spde-0.2.0/PKG-INFO +391 -0
  3. exponax_spde-0.2.0/README.md +342 -0
  4. exponax_spde-0.2.0/exponax_spde/__init__.py +104 -0
  5. exponax_spde-0.2.0/exponax_spde/_base_stepper.py +271 -0
  6. exponax_spde-0.2.0/exponax_spde/_forced_stepper.py +108 -0
  7. exponax_spde-0.2.0/exponax_spde/_interpolation.py +285 -0
  8. exponax_spde-0.2.0/exponax_spde/_repeated_stepper.py +139 -0
  9. exponax_spde-0.2.0/exponax_spde/_spectral.py +1172 -0
  10. exponax_spde-0.2.0/exponax_spde/_stochastic_utils.py +672 -0
  11. exponax_spde-0.2.0/exponax_spde/_utils.py +348 -0
  12. exponax_spde-0.2.0/exponax_spde/etdrk/__init__.py +22 -0
  13. exponax_spde-0.2.0/exponax_spde/etdrk/_base_etdrk.py +80 -0
  14. exponax_spde-0.2.0/exponax_spde/etdrk/_etdrk_0.py +34 -0
  15. exponax_spde-0.2.0/exponax_spde/etdrk/_etdrk_1.py +82 -0
  16. exponax_spde-0.2.0/exponax_spde/etdrk/_etdrk_2.py +102 -0
  17. exponax_spde-0.2.0/exponax_spde/etdrk/_etdrk_3.py +212 -0
  18. exponax_spde-0.2.0/exponax_spde/etdrk/_etdrk_4.py +224 -0
  19. exponax_spde-0.2.0/exponax_spde/etdrk/_utils.py +23 -0
  20. exponax_spde-0.2.0/exponax_spde/ic/__init__.py +42 -0
  21. exponax_spde-0.2.0/exponax_spde/ic/_base_ic.py +99 -0
  22. exponax_spde-0.2.0/exponax_spde/ic/_clamping.py +37 -0
  23. exponax_spde-0.2.0/exponax_spde/ic/_diffused_noise.py +81 -0
  24. exponax_spde-0.2.0/exponax_spde/ic/_discontinuities.py +168 -0
  25. exponax_spde-0.2.0/exponax_spde/ic/_gaussian_blob.py +165 -0
  26. exponax_spde-0.2.0/exponax_spde/ic/_gaussian_random_field.py +93 -0
  27. exponax_spde-0.2.0/exponax_spde/ic/_multi_channel.py +95 -0
  28. exponax_spde-0.2.0/exponax_spde/ic/_scaled.py +41 -0
  29. exponax_spde-0.2.0/exponax_spde/ic/_sine_waves_1d.py +179 -0
  30. exponax_spde-0.2.0/exponax_spde/ic/_truncated_fourier_series.py +100 -0
  31. exponax_spde-0.2.0/exponax_spde/ic/_white_noise.py +32 -0
  32. exponax_spde-0.2.0/exponax_spde/metrics/__init__.py +56 -0
  33. exponax_spde-0.2.0/exponax_spde/metrics/_correlation.py +60 -0
  34. exponax_spde-0.2.0/exponax_spde/metrics/_derivative.py +366 -0
  35. exponax_spde-0.2.0/exponax_spde/metrics/_fourier.py +588 -0
  36. exponax_spde-0.2.0/exponax_spde/metrics/_spatial.py +637 -0
  37. exponax_spde-0.2.0/exponax_spde/metrics/_utils.py +18 -0
  38. exponax_spde-0.2.0/exponax_spde/nonlin_fun/__init__.py +104 -0
  39. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_base.py +159 -0
  40. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_convection.py +245 -0
  41. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_general_nonlinear.py +119 -0
  42. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_gradient_norm.py +101 -0
  43. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_leray.py +136 -0
  44. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_polynomial.py +76 -0
  45. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_projected_convection.py +226 -0
  46. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_tamed_polynomial.py +85 -0
  47. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_vorticity_convection.py +182 -0
  48. exponax_spde-0.2.0/exponax_spde/nonlin_fun/_zero.py +38 -0
  49. exponax_spde-0.2.0/exponax_spde/stepper/__init__.py +94 -0
  50. exponax_spde-0.2.0/exponax_spde/stepper/_burgers.py +155 -0
  51. exponax_spde-0.2.0/exponax_spde/stepper/_heat_equation.py +122 -0
  52. exponax_spde-0.2.0/exponax_spde/stepper/generic/__init__.py +67 -0
  53. exponax_spde-0.2.0/exponax_spde/stepper/generic/_convection.py +372 -0
  54. exponax_spde-0.2.0/exponax_spde/stepper/generic/_linear.py +339 -0
  55. exponax_spde-0.2.0/exponax_spde/stepper/generic/_nonlinear.py +403 -0
  56. exponax_spde-0.2.0/exponax_spde/stepper/generic/_polynomial.py +338 -0
  57. exponax_spde-0.2.0/exponax_spde/stepper/generic/_utils.py +546 -0
  58. exponax_spde-0.2.0/exponax_spde/stepper/reaction/__init__.py +17 -0
  59. exponax_spde-0.2.0/exponax_spde/stepper/reaction/_allen_cahn.py +128 -0
  60. exponax_spde-0.2.0/exponax_spde/stepper/stochastic/__init__.py +36 -0
  61. exponax_spde-0.2.0/exponax_spde/stepper/stochastic/_stochastic_allen_cahn.py +605 -0
  62. exponax_spde-0.2.0/exponax_spde/viz/__init__.py +74 -0
  63. exponax_spde-0.2.0/exponax_spde/viz/_animate.py +357 -0
  64. exponax_spde-0.2.0/exponax_spde/viz/_animate_facet.py +448 -0
  65. exponax_spde-0.2.0/exponax_spde/viz/_plot.py +434 -0
  66. exponax_spde-0.2.0/exponax_spde/viz/_plot_facet.py +489 -0
  67. exponax_spde-0.2.0/exponax_spde/viz/_volume.py +144 -0
  68. exponax_spde-0.2.0/pyproject.toml +133 -0
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Felix Koehler
4
+ Copyright (c) 2026 Georgios Vourvachakis
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,391 @@
1
+ Metadata-Version: 2.4
2
+ Name: exponax-spde
3
+ Version: 0.2.0
4
+ Summary: Stochastic PDE solvers built on top of Exponax.
5
+ License-Expression: MIT
6
+ License-File: LICENSE.txt
7
+ Keywords: jax,equinox,fft,spectral-methods,sciml,pde,spde,etdrk,differentiable-physics,statistical-physics,chemical-engineering,stochastic-processes,richardson-extrapolation,mollifiers,milstein,exponential-Euler-Maruyama
8
+ Author: Georgios Vourvachakis
9
+ Requires-Python: >=3.10
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Provides-Extra: dev
17
+ Provides-Extra: docs
18
+ Provides-Extra: test
19
+ Provides-Extra: vape4d
20
+ Requires-Dist: black (==26.1.0) ; extra == "docs"
21
+ Requires-Dist: commitizen (>=3.29.0) ; extra == "dev"
22
+ Requires-Dist: equinox (>=0.12.2)
23
+ Requires-Dist: exponax (>=0.2.0,<0.3)
24
+ Requires-Dist: griffe (==1.15.0) ; extra == "docs"
25
+ Requires-Dist: ipykernel ; extra == "dev"
26
+ Requires-Dist: jax (>=0.6.2)
27
+ Requires-Dist: jaxlib ; extra == "test"
28
+ Requires-Dist: jaxtyping (>=0.2.33)
29
+ Requires-Dist: matplotlib (>=3.8.1)
30
+ Requires-Dist: mkdocs (==1.6.1) ; extra == "docs"
31
+ Requires-Dist: mkdocs-material (==9.7.1) ; extra == "docs"
32
+ Requires-Dist: mkdocstrings (==1.0.3) ; extra == "docs"
33
+ Requires-Dist: mkdocstrings-python (==2.0.1) ; extra == "docs"
34
+ Requires-Dist: mknotebooks (==0.8.0) ; extra == "docs"
35
+ Requires-Dist: nbstripout ; extra == "dev"
36
+ Requires-Dist: physverify (>=0.9.1,<0.10) ; extra == "test"
37
+ Requires-Dist: pre-commit (>=3.7.0) ; extra == "dev"
38
+ Requires-Dist: pytest (>=7.0.0) ; extra == "test"
39
+ Requires-Dist: pytest-cov (>=2.3.1) ; extra == "test"
40
+ Requires-Dist: typing_extensions (>=4.5.0)
41
+ Requires-Dist: vape4d ; extra == "vape4d"
42
+ Project-URL: Changelog, https://github.com/GVourvachakis/exponax-spde/blob/main/CHANGELOG.md
43
+ Project-URL: Documentation, https://github.com/GVourvachakis/exponax-spde/tree/main/docs
44
+ Project-URL: Homepage, https://github.com/GVourvachakis/exponax-spde
45
+ Project-URL: Issues, https://github.com/GVourvachakis/exponax-spde/issues
46
+ Project-URL: Repository, https://github.com/GVourvachakis/exponax-spde
47
+ Description-Content-Type: text/markdown
48
+
49
+ <p align="center">
50
+ <img src="https://raw.githubusercontent.com/GVourvachakis/exponax-spde/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/imgs/logo_exponax_spde.svg" alt="exponax-spde logo" width="300">
51
+ </p>
52
+ <h4 align="center">Stochastic PDE solvers built on top of <a href="https://github.com/Ceyron/exponax" target="_blank">Exponax</a>.</h4>
53
+
54
+ <p align="center">
55
+ <a href="#installation">Installation</a> •
56
+ <a href="#quickstart">Quickstart</a> •
57
+ <a href="#available-steppers">Available Steppers</a> •
58
+ <a href="#utilities-for-spdes">Utilities for SPDEs</a> •
59
+ <a href="#method">Method</a> •
60
+ <a href="#validation">Validation</a> • <a href="#tests">Tests</a> • <a href="#extending-to-new-spdes">Extensions</a> • <a href="#known-limitations">Limitations</a> • <a href="#references">References</a> • <a href="#citation">Citation</a>
61
+ </p>
62
+
63
+ `exponax-spde` extends the [Exponax](https://github.com/Ceyron/exponax) library
64
+ with first-class support for stochastic partial differential equations (SPDEs).
65
+ It follows `exponax`'s design philosophy. Every stochastic stepper is a
66
+ differentiable [Equinox](https://github.com/patrick-kidger/equinox) Module,
67
+ JIT-compilable, vmappable, and GPU/TPU-ready, while adding the noise
68
+ infrastructure, ensemble utilities, and hybrid coupling tools that deterministic `exponax` does not need.
69
+
70
+ > **Note**: this package requires `exponax >= 0.2.0` as a dependency.
71
+ > It was developed following Felix Köhler's suggestion to build custom SPDE
72
+ > solvers *on top of* exponax rather than inside it.
73
+ > See the related [exponax PR #101](https://github.com/Ceyron/exponax/pull/101)
74
+ > for context.
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ ```bash
81
+ pip install exponax-spde
82
+ ```
83
+
84
+ To install the latest main:
85
+
86
+ ```bash
87
+ pip install "exponax-spde @ git+https://github.com/GVourvachakis/exponax-spde"
88
+ ```
89
+
90
+ For development, use Poetry 2.4.2 with the committed dependency lock:
91
+
92
+ ```bash
93
+ git clone https://github.com/GVourvachakis/exponax-spde.git
94
+ cd exponax-spde
95
+ poetry install -E dev -E test -E docs
96
+ ```
97
+
98
+ Requires Python 3.10+, JAX 0.6.2+, and exponax >=0.2.0,<0.3.
99
+
100
+ 👉 [JAX install guide](https://jax.readthedocs.io/en/latest/installation.html)
101
+
102
+ For 3-D volume rendering in the validation notebook (optional):
103
+
104
+ ```bash
105
+ pip install "exponax-spde[vape4d]"
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Quickstart
111
+
112
+ Simulate the **stochastic Allen-Cahn equation** in 1-D with additive
113
+ Q-Wiener noise — one stepper object, one line to roll out 500 steps
114
+ across 64 independent ensemble members:
115
+
116
+ ```python
117
+ import jax
118
+ import exponax as ex
119
+ import exponax_spde as spde
120
+
121
+ # Build the stepper
122
+ stepper = spde.StochasticAllenCahn(
123
+ num_spatial_dims=1,
124
+ domain_extent=1.0,
125
+ num_points=128,
126
+ dt=5e-4,
127
+ diffusivity=0.01,
128
+ lambda_=1.0,
129
+ sigma=0.1,
130
+ noise_alpha=1.5, # colour index: α=0 white noise, α>d/2 smooth
131
+ noise_type="additive",
132
+ use_taming=True,
133
+ )
134
+
135
+ # Initial condition
136
+ u0 = ex.ic.GaussianRandomField(1, powerlaw_exponent=3.0)(128, key=jax.random.PRNGKey(0))
137
+
138
+ # Single trajectory
139
+ num_steps, num_samples = 500, 64
140
+ trajectory = jax.jit(
141
+ spde.stochastic_rollout(stepper, num_steps=num_steps, include_init=True)
142
+ )(u0, jax.random.PRNGKey(1)) # shape (501, 1, 128)
143
+
144
+ # Ensemble of 64 independent trajectories
145
+ ensemble = jax.jit(
146
+ spde.stochastic_ensemble_rollout(
147
+ stepper, num_steps=num_steps, num_samples=num_samples, include_init=False
148
+ )
149
+ )(u0, jax.random.PRNGKey(2)) # shape (64, 500, 1, 128)
150
+
151
+ # Ensemble-averaged power spectrum S(k)
152
+ S_k = spde.structure_factor(ensemble, burn_in_fraction=0.5)
153
+ ```
154
+
155
+ Because every stepper is a differentiable JAX function you can freely compose
156
+ it with `jax.grad`, `jax.vmap`, and `jax.jit`:
157
+
158
+ ```python
159
+ # Gradient of final state w.r.t. initial condition
160
+ step_once = jax.jit(lambda field: stepper(field, key=jax.random.PRNGKey(0)))
161
+ grad_u0 = jax.grad(lambda field: step_once(field).sum())(u0)
162
+ ```
163
+
164
+ <p align="center">
165
+ <img src="https://raw.githubusercontent.com/GVourvachakis/exponax-spde/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/imgs/stochastic_allen_cahn_1d_spacetime.png"
166
+ alt="1-D space-time" width="500">
167
+ &nbsp;
168
+ <img src="https://raw.githubusercontent.com/GVourvachakis/exponax-spde/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/imgs/stochastic_allen_cahn_1d_evolution.gif"
169
+ alt="1-D evolution" width="500">
170
+ </p>
171
+
172
+ *Illustration, not validation evidence. 1-D stochastic Allen–Cahn driven by space-time white noise (α=0): a slightly biased disordered start orders into red and blue domains whose walls wander and merge (Funaki 1995). N=256, Δt=0.001, ν=0.0005, λ=1, σ=0.05, ETDRK1 without taming. Initial field 0.10 + 0.9·GRF (power 0.5, zero mean, key 10); rollout key 11; frames every 0.025 time units to t=7.5.*
173
+
174
+ <p align="center">
175
+ <img src="https://raw.githubusercontent.com/GVourvachakis/exponax-spde/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/imgs/stochastic_allen_cahn_2d_evolution.png"
176
+ alt="2-D snapshots at t=0, 0.5, 2.5 and 10" width="500">
177
+ &nbsp;
178
+ <img src="https://raw.githubusercontent.com/GVourvachakis/exponax-spde/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/imgs/stochastic_allen_cahn_2d_animation.gif"
179
+ alt="2-D Allen-Cahn coarsening animation"
180
+ width="500">
181
+ </p>
182
+
183
+ *Illustration, not validation evidence. Curvature-driven coarsening (Allen & Cahn 1979; Bray 1994): from a disordered start with a slight positive bias, blue islands shrink and the red phase grows from 75% to 85% of the domain. N=256 per axis, Δt=0.001, ν=0.0008, λ=10, σ=0.12, α=0.5, ETDRK1 with taming. Initial field 0.15 + 0.8·GRF (power 2.5, zero mean, key 20); rollout key 21; frames every 0.1 time units to t=10; snapshots at t=0, 0.5, 2.5 and 10.*
184
+
185
+ ---
186
+
187
+ ## Available Steppers
188
+
189
+ ### Stochastic Allen-Cahn (`StochasticAllenCahn`)
190
+
191
+ Solves the $d$-dimensional ($d \in \{1, 2, 3\}$) stochastic Allen-Cahn SPDE
192
+ on a periodic domain in Itô form:
193
+
194
+ $$\partial_t u = \nu \Delta u + \lambda(u - u^3) + \sigma(u)\,\xi(x, t)$$
195
+
196
+ where $\xi$ is a Q-Wiener process with spectral covariance
197
+ $Q_k \propto (1 + |k|^2_{\rm phys})^{-\alpha}$.
198
+
199
+ | Parameter | Description | Default |
200
+ |-----------|-------------|---------|
201
+ | `diffusivity` | Interface width $\nu > 0$ | `0.01` |
202
+ | `lambda_` | Reaction rate $\lambda \geq 0$ | `1.0` |
203
+ | `sigma` | Physical Q-Wiener amplitude $\sigma \geq 0$ | `0.1` |
204
+ | `noise_alpha` | Spectral colour index $\alpha$ | `1.0` |
205
+ | `noise_type` | `"additive"` or `"multiplicative"` | `"additive"` |
206
+ | `use_taming` | Hutzenthaler-Jentzen taming of $-\lambda u^3$ | `True` |
207
+ | `use_milstein` | First-order Milstein correction (multiplicative, $\alpha>d/2$) | `False` |
208
+
209
+ **Special cases:**
210
+
211
+ - `lambda_=0` → stochastic heat equation (analytically tractable invariant measure)
212
+ - `sigma=0` and `use_taming=False` → matches `exponax.stepper.reaction.AllenCahn` at the same drift settings
213
+
214
+ **Calling convention** (PRNGKey required):
215
+
216
+ ```python
217
+ u_next = stepper(u0, key=jax.random.PRNGKey(0))
218
+
219
+ # Batched over ensemble members:
220
+ keys = jax.random.split(jax.random.PRNGKey(0), num_samples)
221
+ u_batch = jax.vmap(lambda k: stepper(u0, key=k))(keys)
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Experimental increment API
227
+
228
+ Use `sample_increment(key)` to draw an additive convolution or a σ-free
229
+ multiplicative Wiener increment in raw rFFT units. Replay it with
230
+ `step_with_increment(u_hat, increment)`. Call
231
+ `fine.coarsen_increments(increments)` with two or more consecutive
232
+ increments along the leading axis to couple a longer step to a fine
233
+ path. To compile stepper methods, use `equinox.filter_jit` or JIT a closure
234
+ over the stepper.
235
+
236
+ The noise variance for a fixed `sigma` changes in v0.2.0.
237
+ See the [noise model and migration guide](https://github.com/GVourvachakis/exponax-spde/blob/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/noise_model.md).
238
+
239
+ ---
240
+
241
+ ## Utilities for SPDEs
242
+
243
+ See the [performance and accelerator guide](https://github.com/GVourvachakis/exponax-spde/blob/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/performance.md).
244
+
245
+ | Function | Description |
246
+ |----------|-------------|
247
+ | `stochastic_rollout(stepper, num_steps, *, include_init)` | Single trajectory via `jax.lax.scan`; JIT-compatible |
248
+ | `stochastic_ensemble_rollout(stepper, num_steps, num_samples, *, include_init)` | $M$ independent trajectories via `jax.vmap` |
249
+ | `structure_factor(ensemble, *, burn_in_fraction)` | Ensemble power spectrum $S(k) = \langle \vert \hat{u}_k \vert^2 \rangle$ |
250
+ | `stochastic_structure_factor(stepper, num_steps, num_samples, *, burn_in_fraction)` | Accumulates the same spectrum during rollout with no stored trajectories |
251
+ | `richardson_weak_extrapolation(stepper_coarse, stepper_fine, u0, num_steps_coarse, key, *, num_samples)` | Richardson extrapolation: $O(\Delta t) \to O(\Delta t^2)$ weak bias |
252
+ | `strang_split_step(spectral_stepper, ssa_step_fn, u, ssa_state, dt, key, *, ...)` | Second-order Strang splitting for hybrid PDE/SSA coupling |
253
+
254
+ ---
255
+
256
+ ## Method
257
+
258
+ `StochasticAllenCahn` uses the **Exponential Euler-Maruyama (EEM)** scheme
259
+ (Lord, Powell & Shardlow, 2014, Chapters 7–10).
260
+
261
+ The ETD operator splitting follows `exponax`'s `reaction.AllenCahn` convention
262
+ ($L = \nu\Delta + \lambda$, $\mathcal{N} = -\lambda u^3$). Additive noise
263
+ uses the exact linear stochastic convolution. Multiplicative noise uses a
264
+ pointwise product of the step-start field with a plain Wiener increment,
265
+ then propagates the product. The optional Milstein term uses the same
266
+ propagation and requires trace-class noise ($\alpha>d/2$).
267
+
268
+ ---
269
+
270
+ ## Validation
271
+
272
+ The [validation notebook](https://github.com/GVourvachakis/exponax-spde/blob/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/validation/validate_stochastic_allen_cahn.ipynb)
273
+ compares the solvers with analytical predictions. Its text-only
274
+ [validation summary](https://github.com/GVourvachakis/exponax-spde/blob/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/docs/validation_summary.md) reports the measured
275
+ verdicts and uncertainty.
276
+
277
+ | Section | Experiment |
278
+ | --- | --- |
279
+ | 1 | Bit-exact deterministic parity with exponax ETDRK1 |
280
+ | 2–4 | Stationary and finite-time spectra, including a noise colour sweep |
281
+ | 5 | Conditional means and variances of additive and multiplicative kicks |
282
+ | 6–9 | Initial-condition sensitivity, matched-noise figures, radial PSD and 3-D midplanes |
283
+ | 10 | Fixed-grid additive strong order with coupled Brownian paths |
284
+ | 11 | Multiplicative benchmarks, including the supplemental N=32 comparison |
285
+ | Schemes | Deterministic orders 1–4, small-noise crossover, strong orders and taming |
286
+ | 12 | Weak Richardson bias with coupled and independent estimates and a Gaussian null |
287
+ | 13 | Host-side split-step scaffold with an exact OU source |
288
+ | 14 | Verification verdicts and statistical resolution |
289
+
290
+ Run the notebook with double precision enabled:
291
+
292
+ ```bash
293
+ export JAX_ENABLE_X64=1
294
+ jupyter notebook validation/validate_stochastic_allen_cahn.ipynb
295
+ ```
296
+
297
+ ---
298
+
299
+ ## Tests
300
+
301
+ ```bash
302
+ # Fast tests only (~30 s on CPU)
303
+ JAX_ENABLE_X64=1 pytest tests/test_stochastic/ -m "not slow" -v
304
+
305
+ # Full suite including slow ensemble tests (~2 min on CPU)
306
+ JAX_ENABLE_X64=1 pytest tests/test_stochastic/ -v
307
+ ```
308
+
309
+ The test suite covers: deterministic limit, 1-D/2-D invariant measures,
310
+ strong convergence order, structure-factor grid convergence, mean/variance
311
+ time series, Milstein conditional moments, and JAX compatibility.
312
+ The test extra includes physverify for host-side convergence checks.
313
+
314
+ ---
315
+
316
+ ## Extending to New SPDEs
317
+
318
+ The `stochastic/` subpackage is designed to accept future additions.
319
+ To add a new SPDE stepper (e.g. stochastic Kuramoto-Sivashinsky):
320
+
321
+ 1. Create `exponax_spde/stepper/stochastic/_stochastic_ks.py`
322
+ 2. Subclass `BaseStepper` from `exponax_spde`
323
+ 3. Implement `_build_linear_operator` and `_build_nonlinear_fun`
324
+ 4. Use `TamedPolynomialNonlinearFun` if the nonlinearity grows super-linearly
325
+ 5. Disable `step()`, require a PRNGKey in `__call__`
326
+ 6. Add a `TestDeterministicLimit` class as a first sanity check
327
+ 7. Export from `exponax_spde/stepper/stochastic/__init__.py`
328
+
329
+ See `docs/extending.md` for a step-by-step template.
330
+
331
+ ---
332
+
333
+ ## Known Limitations
334
+
335
+ 1. **Continuum regularity**: The stepper emits `NoiseRegularityWarning` at
336
+ construction for additive or multiplicative noise when `num_spatial_dims >= 2`,
337
+ the noise parameters are concrete, `sigma != 0`, `diffusivity > 0` and
338
+ `noise_alpha <= num_spatial_dims / 2 - 1`. In this regime the additive
339
+ continuum model requires renormalisation (Hairer, Ryser & Weber 2012), and
340
+ the multiplicative continuum pointwise product is too rough. The stepper
341
+ simulates a finite-grid model.
342
+ [#8](https://github.com/GVourvachakis/exponax-spde/issues/8),
343
+ [PR #25](https://github.com/GVourvachakis/exponax-spde/pull/25).
344
+ 2. **Hybrid SSA**: the Python SSA callback limits JIT compilation across steps.
345
+
346
+ ---
347
+
348
+ ## References
349
+
350
+ - Funaki, T. (1995). *Probability Theory and Related Fields*, 102(2), 221–288. [DOI](https://doi.org/10.1007/BF01213390)
351
+ - Bray, A. J. (1994). *Advances in Physics*, 43(3), 357–459. [DOI](https://doi.org/10.1080/00018739400101505)
352
+ - Hairer, M., Ryser, M., & Weber, H. (2012). *Electronic Journal of Probability*, 17, 1–14. [DOI](https://doi.org/10.1214/EJP.v17-1731)
353
+ - Allen, S. M., & Cahn, J. W. (1979). *Acta Metallurgica*, 27(6), 1085–1095. [DOI](https://doi.org/10.1016/0001-6160(79)90196-2)
354
+ - Lord, G. J., Powell, C. E., & Shardlow, T. (2014). *An Introduction to Computational Stochastic PDEs*. Cambridge University Press. [DOI](https://doi.org/10.1017/CBO9781139017329)
355
+ - Jentzen, A., & Kloeden, P. E. (2009a). *Proceedings of the Royal Society A*, 465(2102), 649–667. [DOI](https://doi.org/10.1098/rspa.2008.0325)
356
+ - Hutzenthaler, M., & Jentzen, A. (2015). *Memoirs of the American Mathematical Society*, 236(1112). [DOI](https://doi.org/10.1090/memo/1112)
357
+ - Cox, S. M., & Matthews, P. C. (2002). *Journal of Computational Physics*, 176(2), 430–455. [DOI](https://doi.org/10.1006/jcph.2002.6995)
358
+ - Kassam, A.-K., & Trefethen, L. N. (2005). *SIAM Journal on Scientific Computing*, 26(4), 1214–1233. [DOI](https://doi.org/10.1137/S1064827502410633)
359
+ - Strang, G. (1968). *SIAM Journal on Numerical Analysis*, 5(3), 506–517. [DOI](https://doi.org/10.1137/0705041)
360
+ - Gillespie, D. T. (1977). *The Journal of Physical Chemistry*, 81(25), 2340–2361. [DOI](https://doi.org/10.1021/j100540a008)
361
+
362
+ ---
363
+
364
+ ## Citation
365
+
366
+ If you use this package in your research, please cite the upstream `exponax` paper
367
+ and this repository:
368
+
369
+ ```bibtex
370
+ @inproceedings{koehler2024apebench,
371
+ title={{APEBench}: A Benchmark for Autoregressive Neural Emulators of {PDEs}},
372
+ author={Felix Koehler and Simon Niedermayr and R{\"u}diger Westermann and Nils Thuerey},
373
+ booktitle={Advances in Neural Information Processing Systems},
374
+ volume={37},
375
+ year={2024},
376
+ doi={10.52202/079017-3822}
377
+ }
378
+
379
+ @software{vourvachakis2026exponaxspde,
380
+ author = {Vourvachakis, Georgios},
381
+ title = {exponax-spde: Stochastic PDE solvers built on top of exponax},
382
+ year = {2026},
383
+ version = {0.2.0},
384
+ url = {https://github.com/GVourvachakis/exponax-spde},
385
+ }
386
+ ```
387
+
388
+ ## License
389
+
390
+ MIT — see [LICENSE.txt](https://github.com/GVourvachakis/exponax-spde/blob/397a5e0f85692c1b9ac13b2b8735e41e1b8e4f8f/LICENSE.txt).
391
+