solving PDE with boundary conditions involving derivative
2 views (last 30 days)
Show older comments
Hi!
I'm trying to solve a PDE problem with boundary conditions: C(0,t)=Cf & dC(L,t)dz=0
My final goal is to find the C(z,t) and L.
Here is my full code for now:
Da=findDa(d_p,u,epsilon,Rho,eta);%function
constant=findConstant(epsilon, q_max, k_eq);
% z=findz(u, Da,Cf);
z = linspace(0,0.1,50);
t = linspace(0,1,50);
m = 0;
eqn = @(z,t,C,dCdz) setPDE(z,t,C,dCdz,Da,constant,u);
sol = pdepe(m,eqn,@findIC,@setBC,z,t);
C = sol(:,:,1);
function constantVal=findConstant(epsilon, q_max, k_eq)
constantVal=(1+(1-epsilon)/epsilon*q_max*k_eq);
end
function Daval=findDa(d_p,u,epsilon,Rho,eta)
Re=u*d_p*Rho/eta;
Daval=d_p*u*epsilon/(0.339+0.033*Re^0.48);
end
function [g,f,s]=setPDE(z,t,C,dCdz,Da,constant,u)
g=1;
f=Da/constant*dCdz;
s=-u/constant*dCdz;
end
function C0=findIC(z)
C0=0;
end
function [pl,ql,pr,qr]=setBC(zl,Cl,zr,Cr,t)
...
end
0 Comments
Accepted Answer
Torsten
on 26 Mar 2022
Cf = ...;
bcfcn = @(zl,Cl,zr,Cr,t)setBC(zl,Cl,zr,Cr,t,Cf);
sol = pdepe(m,eqn,@findIC,bcfcn,z,t);
function [pl,ql,pr,qr]=setBC(zl,Cl,zr,Cr,t,Cf)
pl = Cl - Cf;
ql = 0.0;
pr = 0.0;
qr = 1.0;
end
3 Comments
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!