resolution of PDE
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 8 Mai 2011
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 ?
Antworten (1)
Andrew Newell
am 8 Mai 2011
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).
Siehe auch
Kategorien
Mehr zu Eigenvalue Problems finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!