Coupled ODE-PDE system with method of lines.

조회 수: 5 (최근 30일)
Erik Cavalcanti
Erik Cavalcanti 2015년 1월 14일
댓글: Torsten 2015년 1월 20일
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.

답변 (1개)

Torsten
Torsten 2015년 1월 15일
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
Erik Cavalcanti
Erik Cavalcanti 2015년 1월 19일
편집: Erik Cavalcanti 2015년 1월 19일
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 2015년 1월 20일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by