solving PDE with boundary conditions involving derivative

조회 수: 2 (최근 30일)
YeEn Kim
YeEn Kim 2022년 3월 25일
댓글: YeEn Kim 2022년 3월 26일
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
Torsten
Torsten 2022년 3월 26일
Check the values of your inputs Da, constant, u and Cf
.
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개)

카테고리

Help CenterFile Exchange에서 PDE Solvers에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by