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!