필터 지우기
필터 지우기

ode inside ode ; coupled ode ?

조회 수: 4 (최근 30일)
Moritz
Moritz 2013년 8월 13일
답변: Torsten 2015년 6월 30일
Hi,
my ode requires a solution of another ode. The therm diff(sol.y)/diff(sol.x)/sol.y(end) is needed in the second ode.
for example
function dvdt=myfun(t,v,...)
% Calculating the height of the liquid and its derivative
sol = ode45(f,TSPAN,h,OPTIONS,v,v0,uclose,Au,dw);
h_nm1=h_n;
h_n=sol.y(end);
dh=diff(sol.y)./diff(sol.y);
% my ode MOL discretization calculating the concentration of particles
i=1
dvdt=...
i=2:N-1
dvdt=...
i=N
dvdt=...
Two Questions:
I do not need to solve the first ode always from zero. So i could use the old solution as initial conditions and the old time like TSPAN=[told t] ?
The way i am solving it makes me somehow uncomfortable. I am sure there is a better way. Could i solve both odes at once? But still the second one needs the solution of the first one. So it would be better to set them up as coupled ODES ?
I know you could answer those questions with "yes" or "no", but please comment an that.
Moritz
  댓글 수: 2
Moritz
Moritz 2013년 8월 13일
well i should say, that the first ode is a simple ode. The second one is a pde discretized with MOL.
I need to calculate the height of the interface h(t) and use diff(h(t)/h(t) in the pde. Since my discretization is different for both odes i do not know how to code that the best way.
The first ode needs only the last point of the pde. This point is updated with every timestep. So do i need to use global variables here ? Or can i pass the solution of the pde to the ode as an argument ? While calling the ode at the every call of the pde ?
RahulTandon
RahulTandon 2015년 6월 30일
Could you please provide the two basic equations, to start with. The approach here is different!

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

답변 (1개)

Torsten
Torsten 2015년 6월 30일
Solve the (N+1) ODEs simultaneously in one call to ODE15s:
dv(1)/dt = ...
dv(2)/dt = ...
...
dv(N)/dt = ...
+
dh/dt = ...
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