フィルターのクリア

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 Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by