Coupled ODE-PDE system with method of lines.
조회 수: 5 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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
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 Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!