Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Slide 1
18-660: Numerical Methods for Engineering Design and Optimization
Xin Li Department of ECE
Carnegie Mellon University Pittsburgh, PA 15213
Slide 2
Overview
Ordinary Differential Equation (ODE) Numerical integration Stability
Slide 3
Ordinary Differential Equation (ODE)
Transient analysis for electrical circuit
( ) ( ) ( )( )
( ) ( )0100≥=
=−=
ttux
txtutx Ordinary differential equation
Initial condition
F1
Ω11
0
1
0
( )tu ( )tx
Slide 4
Ordinary Differential Equation (ODE)
General mathematical form
( ) ( ) ( )[ ] ( ) XxtutxtxF == 00,,
N-dimensional vector of unknown variables
Vector of input sources
Nonlinear operator
( ):tx
( ):tu
:F
Initial condition :X
Slide 5
Numerical Integration
In general, closed-form solution does not exist Even if ODE is linear, we cannot find analytical solutions in
many practical cases
Numerical methods must be applied to approximate the
solution – numerical solution Numerical integration for differential operator
( ) ???≈tx
Algebraic equation
Slide 6
Numerical Integration
Several different formulas exist for numerical integration One-step numerical integration approximates differential
operator from two successive time points
( )xfx = ( ) ( ) ( )[ ] ( )nn
nn tftxft
txtx=≈
∆−+1Forward
Euler (FE)
( ) ( ) ( )11
++ ≈∆−
nnn tf
ttxtxBackward
Euler (BE)
( ) ( ) ( ) ( )2
11 ++ +≈
∆− nnnn tftft
txtxTrapezoidal (TR)
( )xft
txtx nn ≈∆−+ )()( 1
Slide 7
Trapezoidal Approximation
Trapezoidal is often more accurate but also more expensive than BE and FE
)(tf
nt 1+nt t ( ) ( ) ( )[ ]
( )[ ] ( )[ ]2
1
1
1
+
+
+⋅∆≈
⋅=− ∫+
nn
t
tnn
txftxft
dttxftxtxn
n
( )xfx =
( ) ( ) ( )[ ] ( )[ ]2
11 ++ +≈
∆− nnnn txftxft
txtx
Slide 8
Backward Euler Approximation
Similar to TR but is less accurate and expensive Widely used for practical applications
tnt 1+nt
)(tf
( ) ( ) ( )[ ]
( )[ ]1
1
1
+
+
⋅∆≈
⋅=− ∫+
n
t
tnn
txft
dttxftxtxn
n
( )xfx =
( ) ( ) ( )[ ]11
++ ≈∆−
nnn txf
ttxtx
Slide 9
Backward Euler Example
First-order system example
( ) ( ) ( )( )
( ) ( )0100≥=
=−=
ttux
txtutx
( ) ( ) ( )
( ) 0
1
0
11
=
−=∆−
++
tx
txt
txtxn
nn
( )( ) ( ) ( )1
1+
+ ≈∆−=
nnn tf
ttxtx
xfx
t
x(t)
t1 t0 t2 t3 t4 t5 t6 t7
Slide 10
Backward Euler Example
First-order system example
t
x(t)
t1 t0 t2 t3 t4 t5 t6 t7
( ) ( ) ( )
( ) 0
1
0
11
=
−=∆−
++
tx
txt
txtxn
nn
( ) ( ) ( )
( ) 0
1
0
101
=
−=∆−
tx
txt
txtx
( ) ( ) ( )101 txtttxtx ⋅∆−∆=−
( ) ( )t
tttxttx
∆+∆
=∆+
+∆=
110
1
Slide 11
Backward Euler Example
First-order system example
t
x(t)
t1 t0 t2 t3 t4 t5 t6 t7
( ) ( ) ( )212 1 tx
ttxtx
−=∆−
( ) ( ) ( )212 txtttxtx ⋅∆−∆=−
( ) ( )ttxttx
∆++∆
=1
12 Continue iteration to determine x(t)
( ) ( ) ( )
( ) 0
1
0
11
=
−=∆−
++
tx
txt
txtxn
nn
Slide 12
Forward Euler Approximation
Least accurate compared to TR and BE Difficult to guarantee stability
tnt 1+nt
)(tf
( ) ( ) ( )[ ]
( )[ ]n
t
tnn
txft
dttxftxtxn
n
⋅∆≈
⋅=− ∫+
+
1
1
( )xfx =
( ) ( ) ( )[ ]nnn txf
ttxtx
≈∆−+1
Slide 13
Forward Euler Example
First-order system example
( ) ( ) ( )( ) ( ) 010 ==
−=tux
txtutx
( ) ( ) ( )
( ) 10
1
=
−=∆−+
tx
txt
txtxn
nn
( )( ) ( ) ( )n
nn tft
txtxxfx
≈∆−=
+1
t
x(t)
t1 t0 t2 t3 t4 t5 t6 t7
Slide 14
Forward Euler Example
First-order system example
t
x(t)
t1 t0 t2 t3 t4 t5 t6 t7
( ) ( ) ( )
( ) 10
1
=
−=∆−+
tx
txt
txtxn
nn
( ) ( ) ( )
( ) 10
001
=
−=∆−
tx
txt
txtx
( ) 11 +∆−= ttx
( ) ttx ∆−=11
Slide 15
Forward Euler Example
First-order system example
t
x(t)
t1 t0 t2 t3 t4 t5 t6 t7
( ) ( ) ( )
( ) 10
1
=
−=∆−+
tx
txt
txtxn
nn
( ) ( ) ( )
( ) ttx
txt
txtx
∆−=
−=∆−
11
112
( ) ( ) ( )112 txtxttx +⋅∆−=
( ) ( ) ( )( )2
12
1
1
t
txttx
∆−=
⋅∆−=
Slide 16
Forward Euler Example
First-order system example
( ) ( ) ( )
( ) 10
1
=
−=∆−+
tx
txt
txtxn
nn
t
x(t)
t1 t0 t2 t3 t4 t5 t6 t7
( ) ( )33 1 ttx ∆−=
( ) ( )nn ttx ∆−= 1
( ) ( )44 1 ttx ∆−=
Slide 17
Forward Euler Example
First-order system example ( ) ( )nn ttx ∆−= 1
0 1 2 3 4 5 60
0.2
0.4
0.6
0.8
1
Time (Sec.)
x(t)
0 10 20 30-1000
-500
0
500
1000
1500
Time (Sec.)x(
t)
∆t = 0.1 (correct answer) ∆t = 3 (fail to converge)
Forward Euler fails to converge if ∆t is too large
Slide 18
Numerical Integration Stability
∆t must be sufficiently small for FE to guarantee stability In practice, it is not easy to determine the appropriate ∆t
BE and TR do not suffer from stability issue
Stability is guaranteed for any ∆t > 0
First-order system example
( ) ( ) ( )( ) ( ) 010 ==
−=tux
txtutxBE ( )
( )nn ttx
∆+=
11
Always stable for ∆t > 0
Slide 19
Nth-Order Linear ODE
Our simple example solves a first-order linear ODE
In general, an Nth-order linear time-invariant dynamic system is described by the following ODE:
( ) ( ) ( )txtutx −=
( ) ( ) ( )( ) 00 =
⋅+⋅=x
tuBtxAtx Ordinary differential equation Initial condition
N-dimensional vector of unknown variables
Vector of input sources
Matrices
( ):tx
( ):tu
:, BA
Slide 20
Nth-Order Linear ODE
Backward Euler example ( ) ( ) ( ) ( ) 00 =⋅+⋅= xtuBtxAtx
( ) ( ) ( ) ( ) ( ) 00111 =⋅+⋅=∆−
+++ txtuBtxA
ttxtx
nnnn
( ) ( ) ( ) ( ) ( ) 00111 =⋅⋅∆+⋅⋅∆=− +++ txtuBttxAttxtx nnnn
( ) ( ) ( ) ( )[ ] ( ) 0011
1 =⋅⋅∆+⋅⋅∆−= +−
+ txtuBttxAtItx nnn
Solve linear algebraic equation to find x(tn+1)
Slide 21
Nth-Order Nonlinear ODE
Many physical systems are both high-order and nonlinear
( ) ( ) ( )[ ] ( ) 000,, == xtutxtxF
N-dimensional vector of unknown variables
Vector of input sources
Nonlinear operator
( ):tx
( ):tu
:F
Slide 22
Nth-Order Nonlinear ODE
Backward Euler example
Solving nonlinear algebraic equation requires iterative algorithm More details in future lectures...
( ) ( ) ( )[ ] ( ) 000,, == xtutxtxF
( ) ( ) ( ) ( ) ( ) 00,, 0111 ==
∆−
+++ txtutx
ttxtxF nn
nn
Solve nonlinear algebraic equation to find x(tn+1)
Slide 23
Advanced Topics for ODE Solver
Local truncation error estimation Estimate approximation error for numerical integration
Adaptive time step control
Dynamically determine ∆t
High-order integration formula
Apply multi-step numerical integration
Some of these advanced topics are covered by 18-762 that
particularly focuses on ODE solver for circuit simulation
Slide 24
Summary
Ordinary differential equation (ODE) Numerical integration Stability