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%
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 6% Same scheme as models/schnakenberg.m, including the grouped transforms:
7% [a, b] = synth(x, y) runs the group as batched Legendre dispatches.
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 8
9function [U, V, u, v] = init(noise, A, B)
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 10 [U, V] = analys(A + noise, (B / A) * ones(numel(noise), 1));
11 [u, v] = synth(U, V);
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 14function [Un, Vn, u, v] = step(U, V, lam, filt, gx, gy, gz, p1, p2, q2, r, jhat, A, B, D1, D2, dt, niter)
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 15 [u, v] = synth(U, V);
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 18 ru = A - (B + 1) * u + uuv;
19 rv = B * u - uuv;
20 [Ru, Rv] = analys(ru, rv);
21 Bu = U + dt * Ru;
22 Bv = V + dt * Rv;
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 23
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 24 % Mean-J preconditioning -- see models/schnakenberg.m.
25 lamJ = lam ./ jhat;
26 Un = Bu ./ (1 + (dt * D1) * lamJ);
27 Vn = Bv ./ (1 + (dt * D2) * lamJ);
0af3386Reaction-diffusion on spherical-harmonic surfacesJeremy Magland 28
29 for k = 1:niter
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 30 % dlap = lap_g - lap_s, evaluated at the current iterate in flux form
31 % (see models/schnakenberg.m, docs/richardson-iteration.md and
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 32 % docs/reduced-transforms.md for the derivation and the ordering).
8144287WIP: added code for Laplace-Beltrami operator evaluation on smooth genus-0 surfaceOwen Melia 33 Fu = Un .* filt;
35 vtu = dthetac(Fu);
36 vpu = dphic(Fu);
37 vtv = dthetac(Fv);
38 vpv = dphic(Fv);
39 [Ftu, Fpu, Ftv, Fpv] = synth(vtu, vpu, vtv, vpv);
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 40 Pu = p1 .* Ftu + p2 .* Fpu;
41 Qu = p2 .* Ftu + q2 .* Fpu;
42 Pv = p1 .* Ftv + p2 .* Fpv;
43 Qv = p2 .* Ftv + q2 .* Fpv;
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 44 [PAu, QAu, PAv, QAv] = analys(Pu, Qu, Pv, Qv);
45 Pcu = PAu .* filt;
46 Qcu = QAu .* filt;
47 Pcv = PAv .* filt;
48 Qcv = QAv .* filt;
49 scu = dthetac(Pcu) + dphic(Qcu);
591a4f5Reduce the Laplace-Beltrami matvec to 6 transforms per species per iterationDan Fortunato 50 scv = dthetac(Pcv) + dphic(Qcv);
a4fee9cBatch independent transforms through one Legendre dispatchDan Fortunato 51 [Lu, Lv] = synth(scu, scv);
52 lapu = r .* Lu;
53 lapv = r .* Lv;
54 [LAu, LAv] = analys(lapu, lapv);
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 55 dLu = (LAu + lamJ .* Un) .* filt;
56 dLv = (LAv + lamJ .* Vn) .* filt;
8144287WIP: added code for Laplace-Beltrami operator evaluation on smooth genus-0 surfaceOwen Melia 57
e4d6a3bPrecondition with the operator's symbol; project the correction onto the bandDan Fortunato 58 Un = (Bu + (dt * D1) * dLu) ./ (1 + (dt * D1) * lamJ);
59 Vn = (Bv + (dt * D2) * dLv) ./ (1 + (dt * D2) * lamJ);
61end