Algebraic variable derivatives in the DAE solution process
Show older comments
I'm trying to solve a DAE system of the form:
x' = f(x,y,u)
0 = g(x,y,u)
using the ode15s method.
Is it possible to determine the derivatives of the algebraic variables y with respect to time during the integration process and use them as inputs u when evaluating f and g?
Answers (1)
0 = dg/dx * x' + dg/dy * y' + dg/du * u' = dg/dx * f + dg/dy * y' + dg/du * u'
Solve for y'.
5 Comments
Lazar
on 12 Oct 2024
Mr. Pavl M.
on 12 Oct 2024
just constructive thought to the answer:
- Can it be simpler to transform derivative of y to use in odeset ode15s arguments list, Jacobian and Mass matrix function handles?
- Should Torsten's function be solved symbolically?
- Are you going to call the ode15s with time ranges in loop or once?
Is that correct?
You are given x and y by the solver in each time step because these are your solution variables (differential and algebraic).
You explicitly know g - thus you can compute dg/dx, dg/dy and dg/du in advance as functions of x and y (maybe symbolically).
Therefore, you have all that is necessary to compute y' directly as y' = (dg/dy)^(-1)*(-dg/dx*f - dg/du * u').
No need use anything from the last time step, and y' is not needed to evaluate f.
But you did not yet tell us why you need y' at all during the integration process.
The ode solvers are adaptive in their time stepping. There is no "previous time step". Thus I wouldn't trust in what you get from the solver.
Since g depends on y', could you update the correct form of your DAE system ? Maybe f depends on y', too ?
If you say that g depends on y', can't you simply solve 0 = g(x,y,y',u) for y' and get a purely differential system without algebraic equations ? Or use ODE15I instead of ODE15S ?
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!