/ concept-collection / turing-surface
Sign in
concept-collection / turing-surface
43 lines · 1.4 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%
3d078cfSplit the flux-form divergence against the round sphereDan Fortunato 5% Same scheme as models/schnakenberg.m, sphere-split flux divergence included.
0ae15cfSeed runs from smooth random fields, and add the blob geometryDan Fortunato 7% Seeded from a smooth random field -- see models/schnakenberg.m.
8function [U, u] = init(lam3, gx, gy, gz)
9 U = analys(0.01 * randnfun3(lam3, gx, gy, gz));
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 10 u = synth(U);
11end
3d078cfSplit the flux-form divergence against the round sphereDan Fortunato 13function [Un, u] = step(U, lam, filt, gx, gy, gz, p2, r, dp1, dq2, jinv, jhat, eps2, dt, niter)
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 14 u = synth(U);
16 Bu = U + dt * analys(u - u.^3);
18 % Mean-J preconditioning -- see models/schnakenberg.m.
19 lamJ = lam ./ jhat;
20 Un = Bu ./ (1 + (dt * eps2) * lamJ);
22 for k = 1:niter
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 23 % dlap = lap_g - lap_s, evaluated at the current iterate in flux form
24 % (see models/schnakenberg.m, docs/richardson-iteration.md and
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 25 % docs/reduced-transforms.md for the derivation; the grouped calls run
26 % the gradient syntheses and the flux analyses as batched dispatches).
29 vpu = dphic(Fu);
3d078cfSplit the flux-form divergence against the round sphereDan Fortunato 30 [Ftu, Fpu, Su] = synth(vtu, vpu, lam .* Fu);
31 Pu = dp1 .* Ftu + p2 .* Fpu;
32 Qu = p2 .* Ftu + dq2 .* Fpu;
0d99c91Differentiate the phi flux in grid spaceDan Fortunato 33 PAu = analys(Pu);
0d99c91Differentiate the phi flux in grid spaceDan Fortunato 35 scu = dthetac(Pcu);
36 Lu = synth(scu);
37 dQu = dphig(Qu);
3d078cfSplit the flux-form divergence against the round sphereDan Fortunato 38 lapu = r .* (Lu + dQu) - jinv .* Su;
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 39 dLu = (analys(lapu) + lamJ .* Un) .* filt;
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 41 Un = (Bu + (dt * eps2) * dLu) ./ (1 + (dt * eps2) * lamJ);
43end
moveopenescclose