Error in solving system of two reaction-diffusion equations?
Hello there,
I have a system of two reaction-diffusion equations that I want to solve numerically (attached is the file). However, it doesn't resemble with the standard system used in pdepe.m example. The problems I have are:
(1) I don't know how to incorporate it and write c, f, s for my system. As per my knowledge the problem is with the extra term $\gamma \partial u/\partial x$.
(2) I tried coding it up but I got an error:
Warning: Failure at t=2.806210e-02. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (5.551115e-17) at time t. > In ode15s (line 730) In pdepe (line 289) In pde_bee (line 67)
Here is the code I wrote:
m = 0; % not sure what m should be for my system of equations x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1]; t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t); u1 = sol(:,:,1); u2 = sol(:,:,2);
figure;
surf(x,t,u1);
title('u1(x,t)');
xlabel('Distance x');
ylabel('Time t');
figure;
surf(x,t,u2);
title('u2(x,t)');
xlabel('Distance x');
ylabel('Time t');
% --------------------------------------------------------------------------
function [c,f,s] = pdex4pde(x,t,u,DuDx) delta = 0.5; gamma = 0.1; alpha = 0.1; beta = 0.1; muB = 0.2; kB = 0.2; deltaB = 0.1; Du1Dx = DuDx(1); %Du2Dx = DuDx(2); u1 = u(1); % u in my eqns u2 = u(2); % v in my eqns c = [1; 1]; f = [delta*Du1Dx-gamma*u1; 0] .* DuDx; F = -alpha*u1 + beta*u2; s = [F; muB*kB*u2^2/(kB^2+u2^2)-deltaB*u2-F];
% --------------------------------------------------------------------------
function u0 = pdex4ic(x) u0 = [1; 0];
% --------------------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t) pl = [0; ul(2)]; ql = [1; 0]; pr = [ur(1)-1; 0]; qr = [0; 1];
Thank you so much for your attention.
Accepted Answer
More Answers (1)
3 Comments
Categories
Find more on Eigenvalue Problems 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!