Coupled ODE-PDE system with method of lines.
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
Im trying to simulate a fixed bed column, the model results in a coupled PDE-ODE system:
dC/dt = f(d2C/dz2, dC/dz, dq/dt) (1)
dq/dt = g(C, q) (2)
C and q -> dependent variables
t and z -> independent variables
I tried to use Method of Lines (I saw that is the best way in other posts), but Im confused in how to couple de ODE (2) in the system of ODEs that comes from the discretization in space of the PDE (1).
I appreciate any help.
0 Kommentare
Antworten (1)
Torsten
am 15 Jan. 2015
I'm not sure I understand your problem.
The coupling between PDE and ODE is automatically introduced by the dependence of f on dq/dt.
Best wishes
Torsten.
2 Kommentare
Torsten
am 20 Jan. 2015
Before calling ODE15s, define a vector y of length 2*n where n is the number of grid points. Then define initial conditions for C and q in vectors of length n, respectively. After this, copy these ínitial conditions in the vector y by setting
y(1:n)=C(1:n); y(n+1:2*n)=q(1:n);
In the function where you calculate the time derivatives, proceed just the other way round:
C(1:n)=y(1:n); q(1:n)=y(n+1:2*n);
Then collect time derivatives for C and q in vectors dCdt and dqdt of length n and return a vector dydt of length 2*n of the form
dydt=[dCdt;dqdt];
Best wishes
Torsten.
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!