solving PDE with boundary conditions involving derivative
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Torsten
2022-3-26
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 PDE Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!