/ concept-collection / turing-surface
Sign in
concept-collection / turing-surface
42 lines · 1.2 KBCodeBlameHistory
62e6cc4Simplify UI text and built-in .m script commentsJeremy Magland 1% Allen-Cahn on a closed surface: interfaces form, then coarsen.
3% du/dt = eps2*lap_g(u) + u - u^3
4%
62e6cc4Simplify UI text and built-in .m script commentsJeremy Magland 5% Same scheme as models/schnakenberg.m.
7function [U, u] = init(noise)
8 U = analys(noise);
9 u = synth(U);
10end
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 12function [Un, u] = step(U, lam, filt, gx, gy, gz, p1, p2, q2, r, jhat, eps2, dt, niter)
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 13 u = synth(U);
15 Bu = U + dt * analys(u - u.^3);
17 % Mean-J preconditioning -- see models/schnakenberg.m.
18 lamJ = lam ./ jhat;
19 Un = Bu ./ (1 + (dt * eps2) * lamJ);
21 for k = 1:niter
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 22 % dlap = lap_g - lap_s, evaluated at the current iterate in flux form
23 % (see models/schnakenberg.m, docs/richardson-iteration.md and
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 24 % docs/reduced-transforms.md for the derivation; the grouped calls run
25 % the gradient syntheses and the flux analyses as batched dispatches).
28 vpu = dphic(Fu);
29 [Ftu, Fpu] = synth(vtu, vpu);
31 Qu = p2 .* Ftu + q2 .* Fpu;
0d99c91Differentiate the phi flux in grid spaceDan Fortunato 32 PAu = analys(Pu);
0d99c91Differentiate the phi flux in grid spaceDan Fortunato 34 scu = dthetac(Pcu);
35 Lu = synth(scu);
36 dQu = dphig(Qu);
37 lapu = r .* (Lu + dQu);
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 38 dLu = (analys(lapu) + lamJ .* Un) .* filt;
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 40 Un = (Bu + (dt * eps2) * dLu) ./ (1 + (dt * eps2) * lamJ);
42end
moveopenescclose