1% Test model: a nonlinear reaction, f(u) = r*u*(1 - u).
2%
3% Started from a *uniform* field, the state stays uniform, and diffusion does
4% nothing to it (the l = 0 eigenvalue is zero). So every step is exactly the
5% explicit Euler map of the scalar ODE,
6%
7% u^{n+1} = u^n + dt*r*u^n*(1 - u^n)
8%
9% which checks that the generated kernel evaluates a nonlinear reaction
10% correctly, against arithmetic rather than another implementation. Used by the
11% analytic tests; not offered in the app.
12%
13% The caller passes the initial grid field as `noise` (the name the app uses for
14% its seeded perturbation); here the tests put an exact field there.
16function [U, u] = init(noise)
17 U = analys(noise);
18 u = synth(U);
19end
21function [Un, u] = step(U, lam, r, D, dt)
22 u = synth(U);
23 Un = (U + dt * analys(r * u .* (1 - u))) ./ (1 + (dt * D) * lam);
24end