Reaction steppers¶
The deterministic coefficients below follow the exponax conventions. Noise strengths and spectra are set separately.
Allen–Cahn¶
Double-well reaction with additive or pointwise multiplicative forcing. Here \(G(u)=1\) or \(G(u)=u\).
import exponax_spde as spde
step = spde.StochasticAllenCahn(1, 1.0, 64, 0.001, sigma=0.05)
Validated by automated tests and the notebook.
exponax_spde.StochasticAllenCahn ¶
Advance the Itô Allen–Cahn equation with a keyed stochastic increment.
The model is \(du=[\nu\Delta u+\lambda(u-u^3)]\,dt+\sigma G(u)\,dW_Q\). Additive noise uses \(G(u)=1\) and multiplicative noise uses \(G(u)=u\). For \(\lambda>0\), the deterministic model coarsens phase domains with interfaces on the scale \(\sqrt{\nu/\lambda}\). Use periodic states directly, or match the initial parity to additive reflected forcing. For native cell-centred grids, use bounded Allen–Cahn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_spatial_dims
|
int
|
Number of spatial dimensions. |
required |
domain_extent
|
float
|
Side length of the periodic domain on each axis. |
required |
num_points
|
int
|
Points per axis, including the left boundary and excluding the right. |
required |
dt
|
float
|
Time between consecutive states. |
required |
diffusivity
|
float
|
Diffusion coefficient \(\nu\geq 0\). At zero, this is a grid-level SDE. |
0.01
|
lambda_
|
float
|
Any real reaction rate. The Allen–Cahn regime has \(\lambda\geq0\). In a split step with \(\lambda<0\), states with \(|u|>1\) can reach a finite-time reaction pole and return non-finite values. |
1.0
|
noise_type
|
Literal['additive', 'multiplicative']
|
Additive or pointwise multiplicative noise. |
'additive'
|
sigma
|
float
|
Physical non-negative noise intensity. Zero recovers deterministic drift. |
0.1
|
noise_alpha
|
float
|
Non-negative Matérn exponent \(\alpha\) when no spectrum is supplied. |
1.0
|
noise_spectrum
|
Spectrum | None
|
Explicit spectrum. Leave the Matérn exponent at its default when supplying one. |
None
|
noise_symmetry
|
Parity | None
|
Even or odd reflection for additive noise, or None. |
None
|
use_taming
|
bool | None
|
Apply \(\mathcal N(u)/(1+h|\mathcal N(u)|)\) to the cubic drift. None enables taming for ETDRK and disables it for the split schemes. |
None
|
use_milstein
|
bool
|
Add the multiplicative Milstein term. This needs trace-class noise. For a Matérn spectrum the threshold is \(\alpha>d/2\). |
False
|
order
|
int
|
Order 1–4 of the exponential drift integrator. The noise treatment sets the stochastic order. Taming caps the drift accuracy at first order relative to the untamed model. |
1
|
scheme
|
Literal['etdrk', 'lie', 'strang']
|
ETDRK, Lie or Strang. Splitting requires order 1, additive noise and taming off. The reaction flow is pointwise and has no dealiasing. |
'etdrk'
|
mean_noise
|
bool
|
Include the constant mode in the forcing and Milstein centring. Reaction can change the spatial mean even when the noise does not force it. |
True
|
dealiasing_fraction
|
float
|
Fraction of modes retained by the ETDRK nonlinear evaluation. The periodic default is two thirds. |
2.0 / 3.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
For unsupported schemes, orders or noise combinations, and for concrete negative diffusivity, intensity or Matérn exponent. |
Construction warnings¶
For concrete positive intensity and diffusivity, in two or more dimensions, the additive and multiplicative Euler–Maruyama paths warn when the spectrum decay exponent is at most \(d-2\). A traced noise parameter suppresses these checks. Higher-order tamed drift warns when the parameters are concrete.
Keyed stepping¶
Call the stepper with a field and keyword-only key. Use the Fourier stepping method for raw rFFT state. The experimental increment API supports replay and coupled coarsening. Multiplicative replay takes a \(\sigma\)-free Wiener increment.
References¶
Allen & Cahn (1979) describe deterministic coarsening. Jentzen & Kloeden (2009) give exact treatment of additive convolution and review the convergence theory. Superlinear Euler divergence motivates taming (Hutzenthaler, Jentzen & Kloeden). Funaki (1995) studies stochastic phase separation.
Cahn–Hilliard¶
Mass-conserving periodic drift with Cook forcing by default.
import exponax_spde as spde
step = spde.StochasticCahnHilliard(2, 1.0, 32, 0.0001)
Validated by automated tests and the notebook.
exponax_spde.StochasticCahnHilliard ¶
Periodic Cahn–Hilliard with additive forcing and conserved mass.
The deterministic parameters and drift follow exponax. The default spectrum is Conservative(Matern(noise_alpha)). An explicit noise_spectrum is authoritative and noise_alpha must stay at its default. The stochastic increment always has zero DC.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_spatial_dims
|
int
|
Number of spatial dimensions. |
required |
domain_extent
|
float
|
Side length of the domain on every axis. |
required |
num_points
|
int
|
Number of grid points per spatial axis. |
required |
dt
|
float
|
Time between consecutive states. |
required |
diffusivity
|
float
|
Diffusion coefficient. |
0.01
|
gamma
|
float
|
Coefficient of the squared Laplacian relative to the diffusivity. |
0.001
|
first_order_coefficient
|
float
|
Linear coefficient in the chemical potential. |
-1.0
|
third_order_coefficient
|
float
|
Cubic coefficient in the chemical potential. |
1.0
|
order
|
int
|
Order of the exponential integrator for the drift. |
1
|
dealiasing_fraction
|
float
|
Fraction of spatial modes retained for the nonlinear evaluation. |
1 / 2
|
num_circle_points
|
int
|
Number of quadrature points for the ETDRK contour integral. |
16
|
circle_radius
|
float
|
Radius of the ETDRK contour integral. |
1.0
|
sigma
|
float
|
Physical noise intensity. |
0.1
|
noise_alpha
|
float
|
Matérn exponent when no explicit spectrum is supplied. |
1.0
|
noise_spectrum
|
Spectrum | None
|
Explicit spectrum. Leave the Matérn exponent at its default when supplied. |
None
|
noise_symmetry
|
Parity | None
|
Optional even or odd reflection supported by the drift. |
None
|
Swift–Hohenberg¶
Pattern formation with a polynomial reaction and a preferred wavenumber.
import exponax_spde as spde
step = spde.StochasticSwiftHohenberg(2, 12.56, 32, 0.01, reactivity=0.3)
Validated by automated tests and the notebook.
exponax_spde.StochasticSwiftHohenberg ¶
Periodic Swift–Hohenberg with additive Q-Wiener forcing.
The deterministic parameters and drift follow exponax. The default spectrum is Matern(noise_alpha). An explicit noise_spectrum is authoritative and noise_alpha must stay at its default. Set mean_noise=False to omit stochastic forcing of the mean mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_spatial_dims
|
int
|
Number of spatial dimensions. |
required |
domain_extent
|
float
|
Side length of the domain on every axis. |
required |
num_points
|
int
|
Number of grid points per spatial axis. |
required |
dt
|
float
|
Time between consecutive states. |
required |
reactivity
|
float
|
Linear growth rate. |
0.7
|
critical_number
|
float
|
The constant added to the Laplacian before squaring. |
1.0
|
polynomial_coefficients
|
tuple[float, ...]
|
Coefficients in ascending order of power. |
(0.0, 0.0, 1.0, -1.0)
|
order
|
int
|
Order of the exponential integrator for the drift. |
1
|
dealiasing_fraction
|
float
|
Fraction of spatial modes retained for the nonlinear evaluation. |
1 / 2
|
num_circle_points
|
int
|
Number of quadrature points for the ETDRK contour integral. |
16
|
circle_radius
|
float
|
Radius of the ETDRK contour integral. |
1.0
|
sigma
|
float
|
Physical noise intensity. |
0.1
|
noise_alpha
|
float
|
Matérn exponent when no explicit spectrum is supplied. |
1.0
|
noise_spectrum
|
Spectrum | None
|
Explicit spectrum. Leave the Matérn exponent at its default when supplied. |
None
|
noise_symmetry
|
Parity | None
|
Even reflection, or odd reflection with an odd polynomial. |
None
|
mean_noise
|
bool
|
Whether to force the constant mode when it exists. |
True
|