MATLAB solves ODEs on an invariant manifold

I have a system that looks like

dn/dt=f(n,v) dh/dt=g(h,v) 

I want to solve this equation on the manifold F(v,n,h)=0 , of a nonlinear function in v . I tried using something like v=fzero(@(x) F(x,n,h),0) to solve for the value of v on the manifold at each time step. But this is incredibly slow, and ode15s (my system is a relaxation generator) does not meet integration tolerance. How to find a solution for ODE on a manifold defined by F(v,n,h)=0 ?

+5
source share
2 answers

I find @LutzL's comment very helpful. With ode15s you can configure the DAE solver. Example: "Solve Robertson's problem as semi-branched differential algebraic equations (DAEs)" at https://www.mathworks.com/help/matlab/ref/ode15s.html

In my case, I would set the matrix:

 M=[zeros(1,3);0,1,0;0,0,1]; options = odeset('Mass',M,'RelTol',1e-5,'AbsTol',1e-6,'MaxStep',0.01); y0=[v0,n0,h0]; [T,Y]=ode15s(@slow,[0 50],y0,options); 

And slow is a function defined as:

 function dy = slow(t,y) v=y(1); n=y(2); h=y(3); dy=zeros(3,1); dy(1)=F(v,n,h); dy(2)=f(n,v); dy(3)=g(h,v); end 
+2
source

One possible way to solve this problem is to differentiate the equation F(v,n,h)=0 :

gif.latex?%5Cfrac%7B%5Cpartial&space;F%7D%7B%5Cpartial&space;v%7D%5Cfrac%7Bdv%7D%7Bdt%7D+%5Cfrac%7B%5Cpartial&space;F%7D%7B%5Cpartial&space;n%7D%5Cfrac%7Bdn%7D%7Bdt%7D+%5Cfrac%7B%5Cpartial&space;F%7D%7B%5Cpartial&space;h%7D%5Cfrac%7Bdh%7D%7Bdt%7D=0

Now we can get an ODE system

&space;%5Cleft(&space;%5Cfrac%7B%5Cpartial&space;F%7D%7B%5Cpartial&space;v%7D&space;%5Cright&space;)

or

&space;%5Cleft(&space;%5Cfrac%7B%5Cpartial&space;F%7D%7B%5Cpartial&space;v%7D&space;%5Cright&space;)

which can be solved in the usual way.

0
source

Source: https://habr.com/ru/post/1257666/


All Articles