PDE Toolbox reaction-diffusion model collapses to zero, but FDM works
4 views (last 30 days)
Show older comments
I’m trying to simulate a two–species reaction–diffusion system (modified Thomas model, from Liu & Maini) in MATLAB.
The equations are:

with parameters
delta = 6;
D = 0.45;
alpha = 0.899;
beta = -0.91;
r2 = 2;
r3 = 3.5;
gamma = -alpha;
Finite difference code (works)
When I discretise with a simple finite–difference scheme (explicit Euler, Neumann BCs), I see the expected pattern formation:
%Uconc = deltat*(D*delta*LaplaceU + alpha*Ucurrent + Vcurrent - r2*Ucurrent.*Vcurrent...
% - alpha*r3*Ucurrent.*Vcurrent.^2) + Ucurrent;
%Vconc = deltat*(delta*LaplaceV + gamma*Ucurrent + beta*Vcurrent + r2*Ucurrent.*Vcurrent...
% +alpha*r3*Ucurrent.*Vcurrent.^2) + Vcurrent;
Domain: [0,50]×[0,50], mesh 50×50, deltat=0.02.
This produces spots/stripes as expected (matches paper results).
PDE Toolbox code (fails)
I tried to rewrite the same model using the PDE Toolbox:
model = createpde(2);
L = 200; % square domain
R1 = [3 4 0 L L 0 0 0 L L]';
geometryFromEdges(model, decsg(R1));
generateMesh(model, 'Hmax', 10);
applyBoundaryCondition(model,'neumann', ...
'Edge', 1:model.Geometry.NumEdges,'g',[0;0],'q',[0;0]);
specifyCoefficients(model, ...
'm',0, 'd',1, ...
'c',[D*delta; delta], ...
'a',[0;0], ...
'f',@(region,state)[
alpha*state.u(1,:) + state.u(2,:) ...
- r2*state.u(1,:).*state.u(2,:) ...
- alpha*r3*state.u(1,:).*(state.u(2,:)).^2;
gamma*state.u(1,:) + beta*state.u(2,:) ...
+ r2*state.u(1,:).*state.u(2,:) ...
+ alpha*r3*state.u(1,:).*(state.u(2,:)).^2 ] );
setInitialConditions(model,@(r)[2*rand(1,numel(r.x))-1; ...
2*rand(1,numel(r.x))-1]);
tlist = linspace(0,1000,500);
results = solvepde(model,tlist);
finalU = results.NodalSolution(:,1,end);
finalV = results.NodalSolution(:,2,end);
figure(1); clf;
pdeplot(model, 'XYData', finalU, 'Mesh', 'off');
axis equal; title(sprintf('u at t = 1000'));
But in this FEM version, the solution always decays to the trivial homogeneous state (U=V=0), never forming patterns.
Can anyone spot some reasons that my setup in the PDE toolbox is not correct?
3 Comments
Torsten
on 27 Aug 2025
Edited: Torsten
on 27 Aug 2025
Your mesh is very coarse - you should at least use a finer mesh to reproduce such small local patterns. Although I'm still not convinced that numerical solvers can give senseful results for random initial data ... I'm surprised the FEM solver converges at all.
Answers (1)
Ankita
on 5 Sep 2025
Hi Heath,
It appears that the finite-difference code generates the expected patterns, while the PDE Toolbox version does not. One possible factor could be how the reaction terms are specified in the PDE Toolbox.
In some setups, all reaction terms (both linear and nonlinear) may be placed in the 'f' parameter. However, within the PDE Toolbox, linear reaction terms (those involving only U or V, such as alpha*U, beta*V, V, or gamma*U) are typically included in the 'a' matrix, which can be a 2x2 matrix for a two-equation system. Nonlinear terms are generally placed in 'f'. Adjusting the assignment of linear and nonlinear terms in this way might help the PDE Toolbox simulation to behave more like the FD scheme and potentially allow pattern formation to emerge. For further details on specifying coefficients in the PDE Toolbox, can refer to the official documentation: https://www.mathworks.com/help/pde/ug/pde.pdemodel.specifycoefficients.html
Another aspect to consider is the initial conditions. If these are too close to zero or too homogeneous, and the system is not sufficiently perturbed, patterns may not develop. Introducing some random perturbation to the initial conditions could be beneficial.
It may also help to match the domain size and mesh density to the FD code, and using a finer mesh might improve accuracy.
Hopefully, some of these suggestions will help achieving the desired pattern.
0 Comments
See Also
Categories
Find more on General PDEs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
