Pages

Showing posts with label ode15i. Show all posts
Showing posts with label ode15i. Show all posts

15.2.15

Find consistent initial conditions for DAE system [MATLAB - ODE solver]

Matlab can be used to solve DAE systems. Generally speaking a DAE system is a set of differential and algebraic equations that need to be solved simoultaneosly. Matlab provides different tools able to deal with these types of equations; those solvers are named ODE solvers. Even if the name itself would suggest the capability of the solvers to solve only ODEs, also DAEs can be easily managed.

For a complete overview of the different solvers, please visit the following link where all the available builtin solvers and their properties are described in detail.

One of the most important part to get a DAE system to work is to feed it a set of consistent initial conditions. Matlab provides also a tool able to support the user in this process (the function is called decic) but here I would like to explain a more DIY method.

Using the above function (decic) you will be able to find the set of variables which satisfy the consistent initial condition, such that

f(y',y,t0 ) = 0

where f(y',y,t ) describes the set of algebraic and differential equations that you're trying to solve.

Let's suppose to have your DAE system composed of N differential equations and M algebraic equations.

A way to boost the decic function is to fix the initial values for the differential variabless and use those guesses to solve the only set of M algebraic equations.

To do this you can easily use the fsolve Matlab's function. This script will try to find the root of a set of equations; Once you get the result from the fsolve you can just use it, with the guess of the differential states, to build the array of consistent initial conditions for the ODE solver.

Please note that in order to be considered consistent, the result coming from the fsolve should have a low residual from its run.