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

采纳的回答

Torsten
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 个评论
YeEn Kim
YeEn Kim 2022-3-26
I cleared it and it worked!!! Thank you so much!
Though, it still doesn't give me anything in the figure, but I guess I will slowly figure that out...
Thank you for your help XD

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by