PDEPE for Reaction – Diffusion Model not Working?

1 view (last 30 days)
Joao Sa
Joao Sa on 17 Dec 2015
Answered: Torsten on 17 Dec 2015
Hello,
I have a system of coupled 1 PDE and 2 ODE and I’m using PDEPE solver. The model is coded according to the standard as in other systems of coupled equations however, it is not yet working properly and I don’t understand why.
The system is:
dCb/dt = Deff*(1/r)*d/dr(r*dCb/dr)-Rb
where:
Rb = kf*Cb*Cg – kr*Cbg
dCg/dt = n*kr*Cbg – n*kf*Cb*Cg
dCbg/dt = -kr*Cbg + kf*Cb*Cg
Boundary Conditions:
For r = 0 -Deff*dCb/dr = PCp = P*(Cp0*[alpha*exp(-lambda1*t)+(1-alpha)*exp(-lambda2*t)])
For r = 75 µm
-Deff*dCb/dr = 0
Initial Conditions:
Cb = 0; Cg = 1000; Cbg = 0
The code I made is as follows:
n = 2; %IgG Antibody alpha = 0.27; kr = 5.3E-5; %s^-1 kf = 2.7E-5; %(nM.s)^-1 lambda1 = 1.9E-4; %s^-1 lambda2 = 7.4E-6; %s^-1 Cp0 = 100; %nM Deff = 1.3; %µm^2/s P = 0.0057; %µm/s R = 75; %µm Ri = 10; %µm
m = 1; x = linspace(0,R,5); %Spacial Coordinates t = linspace(0,28800,7200); %Time Coordinates ==== 80 h!!!
C = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
u1 = C(:,:,1); u2 = C(:,:,2); u3 = C(:,:,3);
function [c,f,s]=pdex1pde(~,~,u,DuDx)
c = [1; 1; 1];
f = [Deff; 0; 0].*DuDx;
s = [-kf*u(1)*u(2)+kr*u(3); n*kr*u(3)+kf*u(2)*u(1); -kr*u(3)+kf*u(1)*u(2)];
end
% ------------------------------------------------------
function u0 = pdex1ic(~)
u0 = [0; 1000; 0];
end
% ------------------------------------------------------
function [pl,ql,pr,qr] = pdex1bc(~,ul,~,ur,t)
pl = [P*Cp0*(alpha*exp(-lambda1*t)+(1-alpha)*exp(-lambda2*t)); 0; 0];
ql = [Deff; 0; 0];
pr = [0; ur(2); ur(3)];
qr = [-Deff; 0; 0];
end

Answers (1)

Torsten
Torsten on 17 Dec 2015
You can't solve a mixed system of PDEs and ODEs using pdepe.
The main problem is that the ODEs don't need boundary conditions.
You will have to discretize your equations in space and solve the resulting system of ODEs using ODE15s (method-of-lines).
Best wishes
Torsten.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!