Metadata-Version: 2.4
Name: exponax-spde
Version: 0.4.0
Summary: Stochastic PDE solvers built on top of Exponax.
License-Expression: MIT
License-File: LICENSE.txt
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
Author: Georgios Vourvachakis
Requires-Python: >=3.10
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Provides-Extra: dev
Provides-Extra: docs
Provides-Extra: test
Requires-Dist: black (==26.1.0) ; extra == "docs"
Requires-Dist: commitizen (>=3.29.0) ; extra == "dev"
Requires-Dist: equinox (>=0.12.2)
Requires-Dist: exponax (>=0.2.1,<0.3)
Requires-Dist: griffe (==1.15.0) ; extra == "docs"
Requires-Dist: ipykernel ; extra == "dev"
Requires-Dist: jax (>=0.6.2)
Requires-Dist: jaxlib ; extra == "test"
Requires-Dist: jaxtyping (>=0.2.33)
Requires-Dist: markdown (==3.10.2) ; extra == "docs"
Requires-Dist: mkdocs (==1.6.1) ; extra == "docs"
Requires-Dist: mkdocs-autorefs (==1.4.4) ; extra == "docs"
Requires-Dist: mkdocs-jupyter (==0.26.3) ; extra == "docs"
Requires-Dist: mkdocs-material (==9.7.1) ; extra == "docs"
Requires-Dist: mkdocstrings (==1.0.3) ; extra == "docs"
Requires-Dist: mkdocstrings-python (==2.0.1) ; extra == "docs"
Requires-Dist: nbconvert (==7.17.1) ; extra == "docs"
Requires-Dist: nbstripout ; extra == "dev"
Requires-Dist: physverify (>=0.9.1,<0.10) ; extra == "test"
Requires-Dist: pre-commit (>=3.7.0) ; extra == "dev"
Requires-Dist: pygments (==2.20.0) ; extra == "docs"
Requires-Dist: pymdown-extensions (==10.21.3) ; extra == "docs"
Requires-Dist: pytest (>=7.0.0) ; extra == "test"
Requires-Dist: pytest-cov (>=2.3.1) ; extra == "test"
Project-URL: Changelog, https://github.com/GVourvachakis/exponax-spde/blob/main/CHANGELOG.md
Project-URL: Documentation, https://gvourvachakis.github.io/exponax-spde/
Project-URL: Homepage, https://github.com/GVourvachakis/exponax-spde
Project-URL: Issues, https://github.com/GVourvachakis/exponax-spde/issues
Project-URL: Repository, https://github.com/GVourvachakis/exponax-spde
Description-Content-Type: text/markdown

<p align="center"><img src="https://raw.githubusercontent.com/GVourvachakis/exponax-spde/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/docs/imgs/logo_exponax_spde.svg" alt="exponax-spde logo" width="240"></p>

# exponax-spde

Stochastic PDE steppers, ensembles and diagnostics for [exponax](https://fkoehler.site/exponax/).
Steppers accept JAX keys and compose with `jit`, `vmap` and `grad`.

[Documentation](https://gvourvachakis.github.io/exponax-spde/) · [Capability matrix](https://gvourvachakis.github.io/exponax-spde/capabilities/) · [Validation evidence](https://gvourvachakis.github.io/exponax-spde/validation_summary/)

## Install

```bash
pip install exponax-spde
```

To try unreleased changes, install from GitHub:

```bash
pip install --force-reinstall 'exponax-spde @ git+https://github.com/GVourvachakis/exponax-spde'
```

## Quickstart

```python
import jax
import exponax as ex
import exponax_spde as spde

step = spde.StochasticAllenCahn(1, 1.0, 64, 5e-4, sigma=0.1, noise_alpha=1.5)
initial = ex.ic.GaussianRandomField(1, powerlaw_exponent=3.0)(64, key=jax.random.key(0))
rollout = jax.jit(spde.stochastic_rollout(step, 200, include_init=True))
trajectory = rollout(initial, jax.random.key(1))  # shape (201, 1, 64)

spectrum = jax.jit(spde.stochastic_structure_factor(step, 200, 16))
power = spectrum(initial, jax.random.key(2))
```

| Equation | Domains | Noise |
| --- | --- | --- |
| Diffusion, Cahn–Hilliard, Swift–Hohenberg | Periodic, reflected, bounded | Additive |
| Allen–Cahn | Periodic, reflected, bounded | Additive and periodic multiplicative |
| Advection–diffusion | Periodic | Additive with complex propagation |
| Scalar Burgers, KS height and conservative KS | Periodic, reflected | Additive |
| Vector Burgers | Periodic | Additive potential forcing |
| Navier–Stokes vorticity and Kolmogorov flow | Periodic | Additive with no mean forcing |

Bounded steppers support Neumann and Dirichlet grids. See the
[capability matrix](https://gvourvachakis.github.io/exponax-spde/capabilities/) for dimensional, parity and scheme limits.

## Notebooks

- [Quickstart](https://github.com/GVourvachakis/exponax-spde/blob/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/examples/quickstart.ipynb) covers four stepper families with keyed rollouts.
- [Cahn–Hilliard nucleation](https://github.com/GVourvachakis/exponax-spde/blob/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/examples/cahn_hilliard_cook_nucleation.ipynb) compares white and mode-selective forcing.
- [Two-dimensional turbulence](https://github.com/GVourvachakis/exponax-spde/blob/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/examples/two_dimensional_turbulence.ipynb) checks stationary balances and plots the vorticity spectrum.
- [Swift–Hohenberg onset](https://github.com/GVourvachakis/exponax-spde/blob/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/examples/swift_hohenberg_onset.ipynb) shows noise-rounded onset.
- [KS roughening](https://github.com/GVourvachakis/exponax-spde/blob/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/examples/ks_roughening.ipynb) estimates growth and late-time roughness exponents.
- [Allen–Cahn validation](https://github.com/GVourvachakis/exponax-spde/blob/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/validation/validate_stochastic_allen_cahn.ipynb) compares paths, moments and convergence with analytical predictions.

![Four Cahn–Hilliard concentration snapshots under white noise](https://raw.githubusercontent.com/GVourvachakis/exponax-spde/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/docs/imgs/nucleation_white.webp)

Cahn–Hilliard nucleation with white noise on the paper preset at h = 5 × 10⁻⁷.

![Cahn–Hilliard concentration under three single-mode forces with nodal lines](https://raw.githubusercontent.com/GVourvachakis/exponax-spde/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/docs/imgs/nucleation_single_modes.webp)

Single-mode forcing on the paper grid at h = 2 × 10⁻⁶. The dashed lines show each forcing mode’s nodes.

![A vorticity field beside its radial kinetic energy spectrum](https://raw.githubusercontent.com/GVourvachakis/exponax-spde/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/docs/imgs/turbulence_spectrum.webp)

Band-forced vorticity and its shell-energy spectrum after nonlinear redistribution.

See the [bibliographic references](https://gvourvachakis.github.io/exponax-spde/references/),
[software concept DOI](https://doi.org/10.5281/zenodo.24628654), and [MIT licence](https://github.com/GVourvachakis/exponax-spde/blob/e8eacf9ec5024366ce67217d4d3d7e3ffffba2fe/LICENSE.txt).

