Coupled ODE-PDE system with method of lines.

6 Ansichten (letzte 30 Tage)
Erik Cavalcanti
Erik Cavalcanti am 14 Jan. 2015
Kommentiert: Torsten am 20 Jan. 2015
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.

Antworten (1)

Torsten
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
Erik Cavalcanti
Erik Cavalcanti am 19 Jan. 2015
Bearbeitet: Erik Cavalcanti am 19 Jan. 2015
Hello Torsten, Thanks for the reply.
In the Method of Lines the PDE is converted in a system of ODEs. In Matlab that system is solved by ODE15s (for example), but the input and output of ODE15s is a vector of lenght "n". I'm confused in how to join the Equation (2) in the system, once that a system like this requires an output of "2 x n", a column for each variable "C" and "q".
Torsten
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by