Professional Documents
Culture Documents
Lecture 12.
Error Control in
Transient Simulation
2010-11-19 Slide 1
Outline
• Truncation error
• Local Truncation Error (LTE)
for FE/BE/TR
• Local error of LMS methods
• Time step control
Finite difference calculation
Numerical
solution
t
Δt Δt Δt
Numerical
solution
t
Model errors
Error of
Integration Method numerical
solution
Round-off errors
Numerical
solution
Δt
t
time step
changes
LTE := y (t n ) − y n
exact solution simulated
(exact) (approx)
(exact)
•
xn
LTE
x (t )
hn
tn t n +1
i
xn , x n are assumed known exactly
(assume exact)
i
Forward Euler: xn +1 = xn + hn x n x n = x (t n )
• •
x n = x (t n )
i
x (t n ) + hn x (t n ) = xn +1 ≈ x (t n +1 )
hn
LTE := x (t n +1 ) − x n +1 = ?
tn t n +1
2010-11-19 Lecture 12 slide 12
LTE of Forward Euler
Taylor expanding x(t) at t = tn+1 :
(assume exact)
• hn2 ••
x (t n +1 ) = x (t n ) + hn x (t n ) + x(t n ) + O(hn3 ) x n = x (t n )
2 • •
x n = x (t n )
⎡ •
⎤ hn ••
2
x (t n +1 ) = ⎢ xn + hn x n ⎥ + x n + O(hn3 )
⎣ ⎦ 2
i hn2 ••
xn +1 = xn + hn x n = xn +1 + x n + O(hn3 )
2
Forward Euler
formula
LTE
(exact)
(exact)
•
x (t )
x n +1
LTE
(approx)
hn
tn t n +1
i
xn , x n +1 are assumed known exactly
(assuming) x n = x (t n ) x (t ) = f (x )
•
x n +1
• •
approx. x n +1 = x (t n +1 ) x (t )
perfect
• hn
xn +1 = xn + hn x n +1
tn t n +1
i
x (t n ) + hn x (t n +1 ) = xn +1 ≈ x (t n +1 )
ii x n +1 = x (t n +1 )
i x (t n +1 )
x (t ) = x (t n +1 ) + x (t n +1 )(t − t n +1 ) + (t − t n +1 )2 + O((t − t n +1 )3 )
2
Evaluate at t = tn :
i hn2 ii
x (t n ) = x (tn +1 ) − hn x (t n +1 ) + x (t n +1 ) + O(hn3 )
2
⎡ •
⎤ hn ••
2
x (t n +1 ) = ⎢ xn + hn x n +1 ⎥ − x (t n +1 ) + O(hn3 )
⎣ ⎦ 2
hn2 ••
• = xn +1 − x (t n +1 ) + O(hn3 )
xn +1 = xn + hn x n +1 2
by B.E.
hn2 ••
hn2 ii
LTE := x (t n +1 ) − x n +1 = − x (t n +1 ) + O (hn )
3
LTEBE =− x (t n +1 )
2 2
•
xn +1 = x (t n ) + hn x (t n +1 )
(approx)
hn
tn t n +1
i i
xn , x n , x n +1 are assumed known exactly
• • • • hn
x n = x (t n ) x n = x (t n ) x n +1 = x (t n +1 )
tn t n +1
•
h ⎛• •
⎞ x n +1 := f ( xn +1 )
xn +1 = xn + n ⎜ x n + x n +1 ⎟
2 ⎝ ⎠
h ⎛• •
⎞ The error between xn+1
x (t n ) + n ⎜ n
x ( t ) + x ( t n +1 ⎟ = x n +1 ≈ x (t n +1 )
)
2 ⎝ ⎠ and x(tn+1)?
LTE := x (t n +1 ) − x n +1 = ?
error?
(to be cancelled)
Taylor expand x’(t) at t = tn and evaluate at t = tn+1 :
i i ii hn2 iii
x (t n +1 ) = x n + hn x n + x n + O(hn3 )
2
⎡• •
⎤ hn iii
3
h
x (t n +1 ) = xn + n ⎢⎣ x n + x (t n +1 ) −
⎥⎦ 12 x n + O( hn )
4
2
hn3 iii
= xn +1 − x n + O(hn4 )
12
by T.R. • •
Assuming x n +1 = x (t n +1 )
h ⎛• •
⎞
xn +1 = xn + n ⎜ x n + x n +1 ⎟
2 ⎝ ⎠
2
hn3 iii
= xn +1 − x n + O(hn4 )
12
LTE
2010-11-19 Slide 25
Error Analysis of LMS Methods
• We shall compare “local error” and “local truncation
error”:
Local Error – also known as the Error of the formula (or
called “residue”)
LTE – One-step Error of the solution
k m •
∑α y
i =0
i n −i + hn ∑ β j y n− j = 0, (α0 = 1)
j =0
simulated values
(simulated)
If the simulated values are replaced
by the exact values, the LMS formula yn−i ↔ y(tn−i )
might result in “errors”, because the • •
exact solution might not satisfy the y n− j ↔ y(tn− j )
LMS formula.
k m • (exact)
∑α y(t
i =0
i n −i ) + hn ∑ β j y(tn− j ) ≠ 0
j =0
Error
2010-11-19 Lecture 12 slide 27
LMS Local Error
k m •
∑α y(t
i =0
i n −i ) + hn ∑ β j y(tn− j ) ≠ 0
j =0
k m •
Define:
LE ∑α y(t
i =0
i n −i ) + hn ∑ β j y(tn− j )
j =0
y n ≈ y (t n ) In general, yn is only an
approximation of y(tn).
LTEn := y (t n ) − y n
• k m •
= y(tn ) + hn β0 y(tn ) + ∑αi y(tn−i ) + hn ∑ β j y(tn− j )
i =1 j =1
• k m • by
= y(tn ) + hn β0 y(tn ) + ∑αi yn−i + hn ∑ β j y n− j assumption
i =1 j =1
⎡• •
⎤ k m •
LEn = [ y(tn ) − yn ] + hn β0 ⎢ y(tn ) − y n ⎥ + ∑αi yn−i + hn ∑ β j y n− j
⎣ ⎦ i =0 j =0
⎡i i
⎤
LE = [ y (t n ) − y n ] + hn β0 ⎢ y (t n ) − y n ⎥
⎣ ⎦ = 0 by LMS
definition
⎡ i
⎤
= [ y (t n ) − y n ] + hn β0 ⎢f ( y (t n ) ) − y n ⎥
⎣ ⎦
= LTE
LTE = 0 Î LE = 0 (easy to see)
i i
LTE = y (t n ) − y n = 0 f ( y (t n )) − y n = f ( y (t n )) − y (t n ) = 0
y = f ( x)
f (x 1 ) − f (x 2 ) ≤ L x 1 − x 2
LE
LTE ≤ If L is large, choose h small
1 − h β0 L
to get a valid bound.
∑ α y (t ∑β
•
L E = E [ y ( t ), h ] : = i n −i )+ h i y (tn −i )
i =0 i =0
y (p+1) (t n )
p rp (t) = (t − t n ) p +1 + ...
y (i ) (t n ) (p + 1)!
q p (t ) = ∑ (t − t n )i
i =0 i! = O ((t − t n ) p +1 )
(polynomial part) for the remainder
2010-11-19 Lecture 12 slide 35
Analytical Expression for LE
linear
k m
∑ α y (t ∑β
•
L E = E [ y ( t ) , h ] := i n−i )+ h i y (tn −i )
i =0 i =0
plug in
y (t ) = q p (t ) + r p (t )
p
y (i ) (t n )
pth order polynomial: q p (t ) = ∑ i ! (t − t n )
i
i =0
y ( p +1) (t n )
remainder: r p (t ) =
( p + 1)!
(
(t − t n ) p +1 + O (t − t n ) p + 2 )
⎡ y ( p +1) (t n ) ⎤
y (t ) = y (t n ) + y (t n )(t − t n ) + ... + ⎢
(1 )
(t − t n )p +1 ⎥ + ...
⎣ ( p + 1)! ⎦
2010-11-19 Lecture 12 slide 37
Analytical Expression for Local Error
LE = E ⎡⎣r p (t ), h ⎤⎦
k
⎡α i y ( p +1) (t n ) p +1 ⎤
m
⎛ h βi y ( p +1) (t n ) p ⎞
= ∑⎢ (t n −i − t n ) ⎥ + ∑ ⎜ (t n −i − t n ) ⎟ + O (h p +2 )
i =0 ⎣ ( p + 1)! ⎦ i =1 ⎝ p! ⎠
k ⎡ p +1 p
⎛ t n −i − t n ⎞ ⎤ m ⎡
⎛ t n −i − t n ⎞ ⎤ y
( p +1)
(t n ) p +1
= ∑ ⎢α i ⎜ ⎟ ⎥ + ( p + 1) ∑ ⎢ β i ⎜ ⎟ ⎥ h + O (h p + 2 )
i =0 ⎣⎢ ⎝ h ⎠ ⎦⎥ ⎢ ⎝
i =1 ⎣ h ⎠ ⎦⎥ ( p + 1)!
= ε p +1y ( p +1) (t n )h p +1 +
High Order Terms
coefficient
O(hp+1)
⎡ p +1 p
⎛ t n −i − t n ⎞ ⎤ 1
k
⎛ t n −i − t n ⎞
ε p +1 ∑ ⎢α i
i =0 ⎢
⎜
⎝ h ⎟
⎠
+ ( p + 1) βi ⎜
⎝ h ⎟ ⎥
⎠ ⎥⎦ ( p + 1)!
⎣
h = t n − t n −1 time stepsize
1 k
1 m
∑ ( ) ∑ ( )
p +1 p
ε p +1 −i α i + −i βi
( p + 1)! i=1 p ! i= 1
LE = E ⎡⎣r p (t ), h ⎤⎦ = ε p +1 y ( p +1) (t n )h p +1 +
(for a pth order LMS)
2010-11-19 Lecture 12 slide 39
LE Examples
Applying the analytical LE expression to some basic
integration methods:
• Forward Euler
• Backward Euler
• Trapezoidal Rule
• Gear Integration Formulas
ii
1 ii
LE = E [r1 (t ), h ] = ε 2 y (t n )h = y (t n )h 2
2
(Same result as the
2 LTE analysis)
k
The coefficient equations:
∑ (i
i =0
q
)α i − ( q i0 q −1 )β0 = 0; q = 0,1, , k
∑ ( )
k +1
ε k +1 −i αi
(k + 1)! i=1
α0 = 1 ⎧α 0 + α1 = 0
⎨ α1 = −1, β0 = −1,
⎩α1 = β0
α1 1
ε2 = =−
2nd order Gear k=2 2! 2
⎧α 0 + α1 + α 2 = 0,
α0 = 1 ⎪ 4 1 2
⎨α1 + 2α 2 = β0 , α1 = − , α 2 = , β0 = − ,
⎪α + 4α = 0. 3 3 3
⎩ 1 2
α1 + 2 3 α 2 2
ε3 = = = 0.222222
3! 9
2010-11-19 Lecture 12 slide 45
Gear Coefficients
3rd order Gear k=3 3 •
∑α y
i =0
i n −i + h β0 y n = 0
Coef. eqn.:
α0 = 1
⎧α1 + α 2 + α 3 = −1, 18 9 2
⎪ α1 = − , α2 = , α3 = − ,
⎪α1 + 2α 2 + 2α 3 = β0 , 11 11 11
⎨ 6
⎪α1 + 4α 2 + 9α 3 = 0, β0 = − ,
11
⎪⎩α1 + 8α 2 + 27α 3 = 0.
1 k
∑ ( ) αi
k +1
ε k +1 −i
(k + 1)! i=1
α1 + 2 4 α 2 + 3 4 α 3 3
ε4 = =− = −0.1363636
4! 22
2010-11-19 Lecture 12 slide 46
PRINCIPLES OF CIRCUIT SIMULATION
2010-11-19 Slide 47
Time Step Control
• Let E be the allowed LTE bound at any time point.
LTE (t n ) ≤ E
xn − xn −1
1st order FD: Δ x (t n ) = hn = t n − t n −1
hn
xn −1 xn
2nd order FD: Δ x (t n ) − Δ x (t n −1 )
Δ 2 x (t n ) ≈
hn xn − 2
hn −1 hn
Higher-order FD computation will tn −2 t n −1 tn
have to use polynomial interpolation.
p −1 p −1
Δ x ( t ) − Δ x (t n −1 ) Derived from Lagrange
Δ p x (t n ) = n
(t n − t n − p )( p − 1) p p≥2
interpolation (details
omitted).
(approximated by)
(hn + hn −1 + + hn − p −2 ) ( p − 1)hn
dv d 2 v 1 di ••
1 i(tn+1 ) − i(tn )
i=C 2
= v (t n ) =
dt dt C dt C hn
hn2 •• hn2 •• h
LTEBE =− xn LTEBE = v n = n i (t n +1 ) − i (t n ) ≤ EC
2 2 2C
2C
Δt n ≤ EC
iC (t n +1 ) − iC (t n )
di d 2 i 1 dv ••
1 v(tn+1 ) − v(tn )
v =L 2
= i (t n ) =
dt dt L dt L hn
hn2 •• hn2 •• h
LTEBE =− xn LTEBE = i n = n v (t n +1 ) − v (tn ) ≤ EL
2 2 2L
2L
Δt n ≤ EL
v L (t n +1 ) − v L (t n )