# DAEs and initialization

**URL:** <https://discourse.julialang.org/t/daes-and-initialization/27648>\
**Category:** Modelling & Simulations\
**Created:** [August 17, 2019, 11:20am UTC](https://discourse.julialang.org/t/daes-and-initialization/27648 "2019-08-17T11:20:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [August 17, 2019, 11:20am UTC](https://discourse.julialang.org/t/daes-and-initialization/27648/1 "2019-08-17T11:20:15Z")

</div>

I need to use DAE formulation of models, and wonder about the initialization… From the documentation:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/2/f2ac250f6908de02b5676666b896e22852a544ba.png)

**Question** : Does this imply that those `differential_vars` which are differential, are assumed to have correct initial values, and that only the non-differential variables will be adjusted in the initialization phase? In other words, that those marked as differential variables will keep their initial values after the initialization phase, and that the non-differential variables may be adjusted?

The reason why I ask is that I need to know whether I can specify initial states, and _know_ that these are not changed.

There is an added problem to this, of course: for DAEs, the state is not necessarily the same as the differential variable. The state is the vector of freely selectable variables which specifies the solution, and this is not necessarily the same as the differential variables in a model… If the model has more differential variables than the number of states, or fewer differential variables than the number of states, how do I handle that case?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [August 17, 2019, 11:33am UTC](https://discourse.julialang.org/t/daes-and-initialization/27648/2 "2019-08-17T11:33:07Z")

</div>

> [@BLI](#):
>
> Does this imply that those `differential_vars` which are differential, are assumed to have correct initial values, and that only the non-differential variables will be adjusted in the initialization phase? In other words, that those marked as differential variables will keep their initial values after the initialization phase, and that the non-differential variables may be adjusted?

From the docs:

> See [the Sundials manual](https://computation.llnl.gov/sites/default/files/public/ida_guide.pdf) for details on the additional options. The option `init_all` controls the initial condition consistancy routine. If the initial conditions are inconsistant (i.e. they do not satisfy the implicit equation), `init_all=false` means that the algebraic variables and derivatives will be modified in order to satisfy the DAE. If `init_all=true` , all initial conditions will be modified to satify the DAE.

So with IDA it’s an algorithm-specific option. As we get OrdinaryDiffEq with a bunch of initialization as well, we should probably make a change to specifying that option in the problem constructor. Please open an issue in DifferentialEquations.jl and ping @kanav99 on it.
