/ concept-collection / turing-sphere
Sign in
concept-collection / turing-sphere
19 lines · 591 BBlameHistoryRaw
1% Test model: a purely linear reaction, f(u) = c*u.
2%
3% Every spherical-harmonic mode then evolves independently under one IMEX Euler
4% step, with a closed-form growth factor per degree l:
5%
6% U_lm^{n+1} = U_lm^n * (1 + dt*c) / (1 + dt*D*l(l+1))
7%
8% so a run can be checked against exact arithmetic rather than against another
9% implementation. Used by the analytic tests; not offered in the app.
11function [U, u] = init(noise)
12 U = analys(noise);
13 u = synth(U);
14end
16function [Un, u] = step(U, lam, c, D, dt)
17 u = synth(U);
18 Un = (U + dt * analys(c * u)) ./ (1 + (dt * D) * lam);
19end
moveopenescclose