resolution of PDE

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

Andrew Newell
Andrew Newell am 8 Mai 2011
What error are you encountering?
Andrew Newell
Andrew Newell am 8 Mai 2011
Your first two lines are not coming out properly. What are the question marks?
Andrew Newell
Andrew Newell am 8 Mai 2011
Many of them, but probably not in ((1-?)/?). Thanks for formatting it, Walter.
Walter Roberson
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 ?
Walter Roberson
Walter Roberson am 8 Mai 2011
((1-?)/?) is a puzzler alright.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Andrew Newell
Andrew Newell am 8 Mai 2011

0 Stimmen

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).

Produkte

Gefragt:

am 7 Mai 2011

Community Treasure Hunt

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

Start Hunting!

Translated by