solving daes - lecture 9
TRANSCRIPT
-
8/11/2019 Solving DAEs - Lecture 9
1/23
Systems Realization Laboratory
Solving
Differential Algebraic Equations(based on Continuous System Simulation by Cellier and Kofman)
Chris Paredis
2009, Chris Paredis
. .
Systems Realization Laboratory
Product and Systems Lifecycle Management CenterGeorgia Institute of Technology
Lecture Overview
Converting implicit DAE into semi-explicit DAE Graph-based algorithm
Tearing algorithm
Challenge 2: Structural singularities What is it? How to deal with it?
Higher-index problems
Challenge 3: Handling Discrete Events
Systems Realization Laboratory 2009, Chris Paredis
Zero crossings
Overview of Dymola solvers and their properties
For more info refer to: Continuous System Simulation by Cellier and Kofman
-
8/11/2019 Solving DAEs - Lecture 9
2/23
DAE problems in Dymola
Object-oriented model results in implicit DAE system:
0 ( , , , )F y y z t = &
Before solving, Dymola converts this into a semi-explicit DAE:
0
( , , )
( , , ) 0
(0)
y f y z t
g y z t
y y
=
= =
&
0 ( , , , )F y y z t = &
Systems Realization Laboratory 2009, Chris Paredis
ro ems a nee o e a resse :
Selection of state variables,y
Causality assignment: For each equation determine which variable is thedependent variable
Order in which equations should be evaluated
Simple System Convert to Explicit ODE
0
1 1 1
2 2 2
( )u f t
u R i
u R i
=
=
=
0 1
LL
CC
C
diu L
dt
dui C
dt
u u u
=
=
= +
Systems Realization Laboratory 2009, Chris Paredis
1 2
2
0 1
1 2
L
C
L
C
u u
i i i
i i i
==
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
3/23
Causality Assignment and State Selection
State variables? Variables for which derivatives appear
State variables can be considered as known
0
1 1 1
2 2 2
( )u f t
u R i
u R i
=
=
=
Which are the unknowns?
Causality assignment: If equation has only 1 unknown
0 1
LL
CC
C
diu L
dt
dui C
dt
u u u
=
=
= +
Systems Realization Laboratory 2009, Chris Paredis
use t to so ve or un nown
If unknown appears only in 1 equation use it to solve for unknown
1 2
2
0 1
1 2
L
C
L
C
u u u
u u
i i i
i i i
=
=
= +
= +
Causality Assignment and State Selection
State variables? Variables for which derivatives appear
State variables can be considered as known
0
1 1 1
2 2 2
( )u f t
u R i
u R i
=
=
=
Which are the unknowns?
Causality assignment: If equation has only 1 unknown
0 1 2 0 1 2CL
L C
dudiu u u u i i i i
dt dt
0 1
LL
CC
C
diu L
dt
dui C
dt
u u u
=
=
= +
Systems Realization Laboratory 2009, Chris Paredis
use t to so ve or un nown
If unknown appears only in 1 equation use it to solve for unknown
1 2
2
0 1
1 2
L
C
L
C
u u
i i i
i i i
==
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
4/23
Graph-Based Approach for Causality Assignment:
Tarjan Algorithm
0 0
1 1 1 1
( )u f t u
u R i u
=
=
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= += +
Step 0: Connect Equations and Unknowns
0 0
1 1 1 1
( )u f t u
u R i u
=
=
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
5/23
Step 1: Identify Equations with Only 1 Unknown
Color Scheme: Acausal equation = only black and blue lines
Causal equation = one red line
=
Known variable = one red line
Algorithm step 1:
f or al l acausal equations doi f equation has only one black line t hen
Systems Realization Laboratory 2009, Chris Paredis
col or l i ne red
f ol l ow l i ne t o var i abl e
col or al l ot her l i nes f or vari abl e bl ue
Step 2: Identify Variables in Only 1 Equation
Color Scheme: Acausal equation = only black and blue lines
Causal equation = one red line
=
Known variable = one red line
Algorithm step 1:
f or al l unknown variables doi f variable has only one black line t hen
Systems Realization Laboratory 2009, Chris Paredis
col or l i ne red
f ol l ow l i ne t o equat i on
col or al l ot her l i nes f or equat i on bl ue
-
8/11/2019 Solving DAEs - Lecture 9
6/23
Final Result
(1)
(5)
0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(9)
(4)
(7)
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(2)
(8)
(6)
2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= += +
Final Result Sorted & Causality Assigned
0 0
2 2
: ( )
:C
u f t u
u u u
=
=
(1)
(2)
2 2 2 2
1 0 1
11 1 1
1 2
1 2
:
: /
:
:
C
CC
LL
u u u u
ii u R
ii i i
uu u u
=
=
=
= +
(4)
(5)
(6)
(7)
Systems Realization Laboratory 2009, Chris Paredis
00 1:
// : /
// : /
L
CC C
LL L
ii i i
du dt du dt i C
di dt di dt u L
= +
=
=
(8)
(9)
(10)
-
8/11/2019 Solving DAEs - Lecture 9
7/23
Lecture Overview
Converting implicit DAE into semi-explicit DAE Graph-based algorithm
Tearing algorithm
Challenge 2: Structural singularities What is it? How to deal with it?
Higher-index problems
Challenge 3: Handling Discrete Events
Systems Realization Laboratory 2009, Chris Paredis
Zero crossings
Overview of Dymola solvers and their properties
System 2 Algebraic Loop
0
1 1 1
( )u f t
u R i
=
=
= 2 2 2
3 3 3
0 1 3
LL
diu L
dt
u R i
u u u
u u u
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
2 3
0 1
1 2 3
L
u u
i i i
i i i
=
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
8/23
0 0
1 1 1 1
( )u f t u
u R i u
=
=
Step 0: Connect Equations and Unknowns
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= += +
0 0
1 1 1 1
( )u f t u
u R i u
=
=
Step 1: Identify Equations
(1)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
9/23
0 0
1 1 1 1
( )u f t u
u R i u
=
=
Step 2: Identify Variables
(1)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
(10)
Systems Realization Laboratory 2009, Chris Paredis
3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= += +
(9)
0 0
1 1 1 1
( )u f t u
u R i u
=
=
Step 1: Identify Equations None Available
(1)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
(10)
Systems Realization Laboratory 2009, Chris Paredis
3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= +
= +
(9)
-
8/11/2019 Solving DAEs - Lecture 9
10/23
0 0
1 1 1 1
( )u f t u
u R i u
=
=
Step 2: Identify Variables
(1)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
(10)
(8)
Systems Realization Laboratory 2009, Chris Paredis
3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= += +
(9)
STUCK!! Algebraic Loop
(1) 0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(8)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(9)
3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
11/23
Algebraic Loop Tearing Algorithm
6 equations in 6 unknowns Simplify problem by assuming one of the unknown
variable to be known: e. .i If we knew i3 , we could compute i3newGuess i3 , and iterate until the residual is zero:
i3new -i3 = 0 (residual equation)
Also works for nonlinear equations
With symbolic differentiation,
3 3 3
2 3
2 2 2
1 0 3
1 1
:
:
: /
:
: /i
u R i
u u
i u R
u u u
i u R
=
=
=
=
=
Systems Realization Laboratory 2009, Chris Paredis
era on s very as
Multiple tearing variables may be needed
Tricky part: How to choose the tearing variable? can only be determined using heuristics
3 1 2:newi i i=
Tearing Algorithm
(1) 0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(8)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(9)
tear3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
12/23
Tearing Algorithm
(1)0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(8)
(2*)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(9)
tear3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= += +
Tearing Algorithm
(1) 0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(8)
(2*)
(3*)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(9)
tear(4*) 3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
13/23
Tearing Algorithm
(1)
(5*)
*
0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(8)
(2*)
(3*)
2 2 2 2
3 3 3 0
0 1 3 1
1 2 2
( / )
L L L
L
u L di dt u
u R i i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(9)
tear(4*)
residual
3 2 3
0 1
31 2 3
/L L
u u i
i i i di dt
ui i i
=
= += +
Algebraic Loop Example Summary
( , , )
( , , ) 0
y f y z t
g y z t
=
= =
&
0 ( , , , )F y y z t = &
0
: /LL
diu L=
3 3 3
2 3
2 2 2
:
:
: /
u R i
u u
i u R
=
=
=0 : ( )u f t=
1 2:
:
Lu u u
i i i
= +
= +
Algebraic Equations
Differential Equation
Systems Realization Laboratory 2009, Chris Paredis
1 0 3
1 1
3 1 2
: /
:
i
new
i u R
i i i
=
=
=
Solve Iteratively
-
8/11/2019 Solving DAEs - Lecture 9
14/23
Lecture Overview
Converting implicit DAE into semi-explicit DAE Graph-based algorithm
Tearing algorithm
Challenge 2: Structural singularities What is it? How to deal with it?
Higher-index problems
Challenge 3: Handling Discrete Events
Systems Realization Laboratory 2009, Chris Paredis
Zero crossings
Overview of Dymola solvers and their properties
System 3 Structural Singularity
0
1 1 1
2 2 2
( )u f t
u R i
u R i
=
=
=
0 1
LL
CC
L
diu L
dt
dui C
dt
u u u
=
=
= +
Systems Realization Laboratory 2009, Chris Paredis
1 2
2
0 1
1 2
C
L
C
L
u u
i i i
i i i
==
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
15/23
0 0
1 1 1 1
( )u f t u
u R i u
=
=
Step 0: Connect Equations and Unknowns
2 2 2 2
0
0 1 1
21 2
( / )
( / )
L L L
C C
L
C
u L di dt u
i C du dt i
u u u i
iu u u
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
2
0 1
1 2
/
/
CL
LC
CL
iu u
di dt i i i
du dt i i i
=
= += +
0 0
1 1 1 1
( )u f t u
u R i u
=
=
Apply Both Rules
(1)
2 2 2 2
0
0 1 1
21 2
( / )
( / )
L L L
C C
L
C
u L di dt u
i C du dt i
u u u i
iu u u
=
=
= +
= +
(10)
(9)
Systems Realization Laboratory 2009, Chris Paredis
2
0 1
1 2
/
/
CL
LC
CL
iu u
di dt i i i
du dt i i i
=
= +
= +
(8)
-
8/11/2019 Solving DAEs - Lecture 9
16/23
STUCK! Structural Singularity
(1)0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(9)
2 2 2 2
0
0 1 1
21 2
( / )
( / )
L L L
C C
L
C
u L di dt u
i C du dt i
u u u i
iu u u
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(8)
2
0 1
1 2
/
/
CL
LC
CL
iu u
di dt i i i
du dt i i i
=
= += +
What is the problem?
0
1 1 1
2 2 2
( )u f t
u R i
u R i
=
=
=
0 1
LL
CC
L
diu L
dt
dui C
dt
u u u
=
=
= +
Systems Realization Laboratory 2009, Chris Paredis
1 2
2
0 1
1 2
C
L
C
L
u u
i i i
i i i
==
= +
= +
-
8/11/2019 Solving DAEs - Lecture 9
17/23
Structural Singularity
Main approach Pantelides Algorithm Use symbolic differentiation to remove singularity in equations
1. Determine constraint equation (could be hidden use tearing)
2. Differentiate constraint equation and assign dummy derivatives
3. Remove corresponding integration equations remain square
Details of algorithm are tricky
(For details see: Continuous System Simulation by Cellier and Kofman)
Systems Realization Laboratory 2009, Chris Paredis
Algorithm is also called an index reduction algorithm
What is an index?
Characteristic of DAE: Perturbation Index
Loosely defined:
The number of differentiations needed
to turn a DAE into a pure ODE
Examples: Pure ODE is index-0
Systems Realization Laboratory 2009, Chris Paredis
ODE with algebraic loop is index-1 Structurally singular system index-2 (or larger)
-
8/11/2019 Solving DAEs - Lecture 9
18/23
Lecture Overview
Converting implicit DAE into semi-explicit DAE Graph-based algorithm
Tearing algorithm
Challenge 2: Structural singularities What is it? How to deal with it?
Higher-index problems
Challenge 3: Handling Discrete Events
Systems Realization Laboratory 2009, Chris Paredis
Zero crossings
Overview of Dymola solvers and their properties
Mixed Systems: DAE + Discrete event
mg
At impact: v -v*k[]
Discrete Event
Systems Realization Laboratory 2009, Chris Paredis
mg
when height
-
8/11/2019 Solving DAEs - Lecture 9
19/23
Mixed DAEs
Hybrid systems require additional solvercapabilities:1. Event Detection solving for zero-crossings
Height changes continuously as function of time step size needs to be selected such that height = radius
2. Event Handling Stop the integration algorithm
Find a new state consistent with the algebraic constraints
Restart the inte ration al orithm
Systems Realization Laboratory 2009, Chris Paredis
Be careful!
Event handling can be slow Chattering
Summary of Method Characteristics
Appropriate for DAE or only ODE?
Capable of finding initial conditions?
Capable of solving Stiff systems? Stiff implies implicit method
Capable of handling overdetermined systems? More convenient than having to remove redundant constraints
manually
Systems Realization Laboratory 2009, Chris Paredis
Order of method? Typically higher is better
-
8/11/2019 Solving DAEs - Lecture 9
20/23
Dymola Methods
Method Model
Type
Order Stiff Root
Find
Algorithm
DEABM ODE 1-12 No No Adams/Bashforth/Moulton; reliable, maybe slow
LSODE1 ODE 1-12 No No Adams/Bashforth/Moulton; faster than DEABM
LSODE2 ODE 1-5 Yes No Backward Difference Formulae; Gear method
LSODAR ODE 1-12, 1-5 Both Yes Adams/Bashforth/Moulton
DOPRI5 ODE 5 No No Runge-Kutta by Dormand and Prince
DOPRI8 ODE 8 No No Runge-Kutta by Dormand and Prince
GRK4T ODE 4 Yes No Linearly-implicit Rosenbrock
Systems Realization Laboratory 2009, Chris Paredis
DASSL DAE 1-5 Yes Yes BDF; default choice in Dymola
ODASSL ODAE 1-5 Yes Yes Modified DASSL for overdetermined DAEs
MEXX ODAE 2-24 No No Special index-2 DAE; not for ODE!
Summary
Identify types and properties of ODE systems
Identify types and properties of ODE solvers Accuracy
Stability
Stiffness
Higher Order Methods and their properties
Causalization, tearing, index reduction
Complexities of mixed DAE problems
Overview of Dymola solvers and their properties
Systems Realization Laboratory 2009, Chris Paredis
Solver implementation is for Professionals Only
Do not try this at home
Not-so-fine print:
-
8/11/2019 Solving DAEs - Lecture 9
21/23
Step 1: Identify Equations with Only 1 Unknown
(1)0 0
1 1 1 1
( )u f t u
u R i u
=
=
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(2)2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= += +
Solution for Example 1
Step 2: Identify Variables in Only 1 Equation
(1) 0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(9)
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(2)
(8)
2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= +
= +Solution for Example 1
-
8/11/2019 Solving DAEs - Lecture 9
22/23
Repeat Step 1: Identify Equations
(1)0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(9)
(4)
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(2)
(8)
2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= += +
Solution for Example 1
Repeat Step 2: Identify Variables
(1) 0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(9)
(4)
(7)
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(2)
(8)
(6)
2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= +
= +Solution for Example 1
-
8/11/2019 Solving DAEs - Lecture 9
23/23
Repeat Step 1: Identify Equations
(1)
(5)
0 0
1 1 1 1
( )u f t u
u R i u
=
=
(10)
(9)
(4)
(7)
2 2 2 2
0
0 1 1
1 2 2
( / )
( / )
L L L
C C
C
L
u L di dt u
i C du dt i
u u u i
u u u i
=
=
= +
= +
Systems Realization Laboratory 2009, Chris Paredis
(2)
(8)
(6)
2
0 1
1 2
/
/
C C
L L
CC
u u i
i i i di dt
du dt i i i
=
= += +
Solution for Example 1