I found the missing part. Since it's in spherical coordinates (m=2), then all left boundary conditions should be ignored which is translated to be Neumann boundary conditions.
No Results from pdepe Solver
1 view (last 30 days)
Show older comments
Hi all,
I am trying to solve a system of multivariables pdes using pdepe solver. Everything seems good, however, the results of all concentration variables do not show any change. One thing I've noticed, the boundary conditions do not appear in the graphs as shown below especially the left ones (all of them are constants CA(0,t)=1CB(0,t)=1, CD(0,t)=2, CC(0,t)=2. I am providing my codes too.
function pdepesolver
clear;
R=1;
tend=1;
m=2;
x=linspace(0,R,2000);
t=linspace(0,tend,1000);
sol=pdepe(m, @pdepet1func,@pdepet1ic, @pdepet1BC, x, t);
A=sol(:,:,1);
B=sol(:,:,2);
D=sol(:,:,3);
C=sol(:,:,4);
figure(1)
surf(x,t,A)
title('concentration of A')
xlabel('x')
ylabel('t')
zlabel('C_A')
figure(2)
surf(x,t,B)
title('concentration of B')
xlabel('x')
ylabel('t')
zlabel('C_B')
figure(3)
surf(x,t,D)
title('concentration of D')
xlabel('x')
ylabel('t')
zlabel('C_D')
figure(4)
surf(x,t,C)
title('concentration of C')
xlabel('x')
ylabel('t')
zlabel('C_C')
function [pl, ql, pr, qr]=pdepet1BC(xl, ul, xr, ur, t)
pl=[ul(1)-1; ul(2)-1; ul(3)-2; ul(4)-2];
ql=[0; 0; 0; 0];
pr=[0;0;0;0];
qr=[1;1;1;1];
function [c,f,s]=pdepet1func(x,t,u,dudx)
DA=0.25;
DB=0.7;
DD=0.15;
DC=0.4;
muA=0.35;
muB=0.5;
muD=0.5;
c=[1; 1; 1; 1];
f=[DA*dudx(1)-(1/(muA*u(1)+muB*u(2)+4*muD*u(3)))*(muA*u(1)*DA*dudx(1)-muA*u(1)*DB*dudx(2)-2*muA*u(1)*DD*dudx(3));
DB*dudx(2)-(1/(muA*u(1)+muB*u(2)+4*muD*u(3)))*(muB*u(2)*DA*dudx(1)-muB*u(2)*DB*dudx(2)-2*muB*u(2)*DD*dudx(3));
DD*dudx(3)-(1/(muA*u(1)+muB*u(2)+4*muD*u(3)))*(2*muD*u(3)*DA*dudx(1)-2*muD*u(3)*DB*dudx(2)-4*muD*u(3)*DD*dudx(3));
DC*dudx(4)];
s=[0; 0; 0; 0];
function u0=pdepet1ic(x)
u0=[0.001;0.001;0.001;0.001];
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on PDE Solvers 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!