Solve 1-D interfacial mass transfer using pdepe
Show older comments
Hi Everyone,
I am trying to use pdepe to solve a diffusion problem and Im having issues trying to set my left side boundary condition.
dP=0.04; %thickness polymer layer [cm]
d=100; %times in days [d]
tt=d*86400; %time in seconds [s]
x = linspace(0,dP,5);
t = linspace(0,tt,100);
m = 0;
sol = pdepe(m,@equa,@IC,@BC,x,t);
u =sol(:,:,1)
function [c,f,s,algo] = equa(x,t,u,DuDx)
∂Cp/∂t=D*∂/∂x(∂Cp/∂x)
c = 1;
f = D*DuDx;
s = 0;
end
function u0 = IC(x)
u0 = Cpo; %Initial concentration[microg/cm^3]
end
function [pl,ql,pr,qr] = BC(xl,ul,xr,ur,t)
pl =0;
ql =1;
pr =h*((ur/K)-Cinf);
qr =D;
end
the first boundary condition (0,t)
∂Cp/∂x=0
the second boundary condition (x,t)
h*(Cp/K-Cinf)+D*∂Cp/∂x=0
Rigth now looks like it is working using Cinf as a constant but actually Cinf should change and increase with time (accumulation).
Cinf=A/V*integral(∂Cp/∂x (t) dt, 0,t)
I really dont know how to solve it this way
Could someone please guide me?
1 Comment
Bill Greene
on 24 Nov 2017
I would be interested in trying to help you with this. Could you reformat your code so that it is more readable. And supply a runnable version with Cinf=constant; the version you have posted is missing values D, Cpo, etc.
Also, please send me a private message with a little background on this example.
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics 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!