resolution of PDE
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a system of equations:
(?C/?t)+(u/?)?C/?z+((1-?)/?)*(?s/?f)*Ki*a*(q-KéqC)=0
?q/?t=-Ki a(q-KéqC)
the initial condition is:
t=0, q=q0 and C=C0,z>0
the boundary conditions are:
z=0;C=0 and q=q0
z=L; ?C/?z=0 ,?q/?z=0
this is my program: i don't find the error so pleaaase help me. thanks in advance.
function modelediffusion
m=0;
z=linspace(0,1,26);
t=linspace(0,2,200);
sol = pdepe(m,@pdexpde,@pdexic,@pdexbc,z,t);
C = sol(:,:,1);
q = sol(:,:,2);
figure
plot(t,C(:,15))
function[g,f,s]= pdexpde(z,t,C,DCDz)
rhos=0.55;
rhof=0.385;
dp=0.03;
a=6/dp;
epsilon=0.45;
Ki=1.4E-7;
u=0.098;
Keq=16.86;
A=Ki*a*(C(2)-(Keq.*C(1)));
B=((1-epsilon)/epsilon)*(rhos/rhof)*A;
g=[1; 1];
f=[0; 0];
s=[((-u)/epsilon).*DCDz-B; A];
function C0 = pdexic(z)
c0=1.5E-3;
q0=2.53E-2;
C0 = [c0; q0];
% -------------------------------------------------------------------------
function [pl,ql,pr,qr] = pdexbc(zl,Cl,zr,Cr,t)
q0=2.53E-2;
pl = [C1(1);q0-Cl(2)];
ql = [1; 0];
pr = [0; 0];
qr = [0; 1];
댓글 수: 5
Walter Roberson
2011년 5월 8일
The question marks indicate derivative. Except the ones that appear isolate right after a "/" -- I don't know what those are.
Is KéqC a complete variable, or is it Kéq * C ?
답변 (1개)
Andrew Newell
2011년 5월 8일
Here is one error: in this line,
pl = [C1(1);q0-Cl(2)];
the first C1 is C followed by the numeral 1, but it should be C followed by the letter l.
Debugging note: It is a good idea to have just one command per line. That way, when you get an error message, you know which command triggered it (if not which command actually caused it).
참고 항목
카테고리
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!