Noisy onset of Swift–Hohenberg rolls¶
The linear symbol \(L_k = r - (1-|k|^2)^2\) selects a band around unit wavenumber. A negative cubic limits the growth of unstable modes. See Swift & Hohenberg (1977) and Hohenberg & Swift (1992).
Runtime depends on the machine. The default runs in a few minutes or less. Set EXPONAX_SPDE_PRESET=smoke for a shorter diagnostic. Figures are written only if SAVE_FIGURES is enabled.
Exact law: the stationary linear structure factor¶
With negative \(r\) and all polynomial coefficients zero, each mode is a stable OU process. In raw FFT coordinates the one-step noise power is \(N^d \sigma^2 q_k (\exp(2hL_k)-1)/(2L_k\Delta x^d)\). Dividing by \(1-\exp(2h L_k)\) yields stationary power. Coefficient extraction then multiplies power by \(4^m/N^{2d}\), where \(m\) is the number of coordinates that are neither DC nor Nyquist. The package structure factor is thus \(\sigma^2 \tilde q_k/(2|L_k|)\) with \(\tilde q_k=4^m q_k/L^d\) and domain side length \(L\).
We draw independent stationary initial states, advance each once, and measure a circular complex mode from each terminal state. The squared modulus has CV 1, so 1,600 paths give a planned relative SE of 2.5%.
n, length, h, r, sigma = 24, 2 * np.pi, 0.1, -0.4, 0.3
linear = spde.StochasticSwiftHohenberg(
1,
length,
n,
h,
reactivity=r,
sigma=sigma,
polynomial_coefficients=(0.0, 0.0, 0.0, 0.0),
noise_spectrum=Matern(1.0),
)
k = 2 * np.pi * np.fft.rfftfreq(n, d=length / n)
symbol = r - (1 - k**2) ** 2
stationary_scale = jnp.asarray(np.sqrt(-np.expm1(2 * h * symbol)))
def power(key):
initial_key, step_key = jax.random.split(key)
initial = linear.sample_increment(initial_key) / stationary_scale
final = linear.step_fourier(initial, key=step_key)
field = ex.ifft(final, num_points=n)
return spde.structure_factor(field[None, None], burn_in_fraction=0.0)[0, 1]
q = 1 / (1 + k[1] ** 2)
target = sigma**2 * (4 * q / length) / (2 * abs(symbol[1]))
check_power(
"stationary linear structure factor, mode 1", observations(power, 34101), target
)
PASS | stationary linear structure factor, mode 1 | 0.03668047 ± 0.00095 SE | target 0.03580986 | 0.91 SE | relative SE 2.60%
DIAGNOSTIC: noise-rounded onset¶
Sweep the reactivity \(r\) through the linear threshold. Each plotted amplitude comes from independent terminal fields. The bars give one sampling SE. Finite time, noise and a finite box all affect the curve. The sweep is descriptive and carries no gate.
n, length, h = (24 if SMOKE else 40), 8 * np.pi, 0.1
steps, paths = (40, 3) if SMOKE else (800, 8)
initial = jnp.zeros((1, n, n))
values = (-0.25, -0.05, 0.0, 0.08, 0.2, 0.35)
amplitudes = []
errors = []
for i, r in enumerate(values):
step = spde.StochasticSwiftHohenberg(
2,
length,
n,
h,
reactivity=r,
sigma=0.4,
noise_spectrum=Band(0.75, 1.25),
polynomial_coefficients=(0.0, 0.0, 0.0, -1.0),
)
states = terminal(
step, initial, steps, jax.random.split(jax.random.key(34110 + i), paths)
)
fields = np.fft.irfftn(states[:, 0], s=(n, n), axes=(-2, -1))
amplitude = np.mean(fields**2, axis=(-2, -1))
amplitudes.append(amplitude.mean())
errors.append(amplitude.std(ddof=1) / np.sqrt(paths))
print(
f"DIAGNOSTIC | r={r:+g} | mean square "
f"{amplitudes[-1]:.5g} ± {errors[-1]:.2g} SE"
)
fig, (roll, sweep) = plt.subplots(1, 2, figsize=(9, 3.75), layout="constrained")
image = roll.imshow(
fields[0].T, extent=(0, length, 0, length), origin="lower", cmap="RdBu_r"
)
roll.set(xlabel="x", ylabel="y", title=f"Field at r={values[-1]:+g}")
fig.colorbar(image, ax=roll)
sweep.errorbar(values, amplitudes, yerr=errors, marker="o")
sweep.axvline(0, color="0.6", linestyle="--")
sweep.set(xlabel="Reactivity r", ylabel="Terminal mean square")
show(fig, "swift_hohenberg_onset")
DIAGNOSTIC | r=-0.25 | mean square 0.016002 ± 0.001 SE
DIAGNOSTIC | r=-0.05 | mean square 0.027882 ± 0.0019 SE
DIAGNOSTIC | r=+0 | mean square 0.042951 ± 0.0027 SE
DIAGNOSTIC | r=+0.08 | mean square 0.060406 ± 0.0026 SE
DIAGNOSTIC | r=+0.2 | mean square 0.098544 ± 0.0017 SE
DIAGNOSTIC | r=+0.35 | mean square 0.19339 ± 0.0075 SE