62e6cc4Simplify UI text and built-in .m script commentsJeremy Magland 1% Brusselator reaction-diffusion on a closed surface.
3% du/dt = D1*lap_g(u) + A - (B+1)*u + u^2*v
4% dv/dt = D2*lap_g(v) + B*u - u^2*v
5%
62e6cc4Simplify UI text and built-in .m script commentsJeremy Magland 6% Same scheme as models/schnakenberg.m.
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 7
8function [U, V, u, v] = init(noise, A, B)
9 U = analys(A + noise);
10 V = analys((B / A) * ones(numel(noise), 1));
11 u = synth(U);
12 v = synth(V);
13end
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 15function [Un, Vn, u, v] = step(U, V, lam, filt, gx, gy, gz, p1, p2, q2, r, A, B, D1, D2, dt, niter)
17 v = synth(V);
18 uuv = u .* u .* v;
20 Bu = U + dt * analys(A - (B + 1) * u + uuv);
21 Bv = V + dt * analys(B * u - uuv);
23 Un = Bu ./ (1 + (dt * D1) * lam);
24 Vn = Bv ./ (1 + (dt * D2) * lam);
26 for k = 1:niter
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 27 % dlap = lap_g - lap_s, evaluated at the current iterate in flux form
28 % (see models/schnakenberg.m, docs/richardson-iteration.md and
29 % docs/reduced-transforms.md for the derivation).
8144287WIP: added code for Laplace-Beltrami operator evaluation on smooth genus-0 surfaceOwen Melia 30 Fu = Un .* filt;
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 31 Ftu = synth(dthetac(Fu));
32 Fpu = synth(dphic(Fu));
33 Pu = p1 .* Ftu + p2 .* Fpu;
34 Qu = p2 .* Ftu + q2 .* Fpu;
35 Pcu = analys(Pu) .* filt;
36 Qcu = analys(Qu) .* filt;
37 scu = dthetac(Pcu) + dphic(Qcu);
38 lapu = r .* synth(scu);
8144287WIP: added code for Laplace-Beltrami operator evaluation on smooth genus-0 surfaceOwen Melia 39 dLu = analys(lapu) + lam .* Un;
41 Fv = Vn .* filt;
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 42 Ftv = synth(dthetac(Fv));
43 Fpv = synth(dphic(Fv));
44 Pv = p1 .* Ftv + p2 .* Fpv;
45 Qv = p2 .* Ftv + q2 .* Fpv;
46 Pcv = analys(Pv) .* filt;
47 Qcv = analys(Qv) .* filt;
48 scv = dthetac(Pcv) + dphic(Qcv);
49 lapv = r .* synth(scv);
8144287WIP: added code for Laplace-Beltrami operator evaluation on smooth genus-0 surfaceOwen Melia 50 dLv = analys(lapv) + lam .* Vn;
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 52 Un = (Bu + (dt * D1) * dLu) ./ (1 + (dt * D1) * lam);
53 Vn = (Bv + (dt * D2) * dLv) ./ (1 + (dt * D2) * lam);
54 end
55end