No Slide Title

Download Report

Transcript No Slide Title

Methods for Ordinary Differential
Equations
Lecture 10
Alessandra Nardi
Thanks to Prof. Jacob White, Deepak Ramaswamy Jaime
Peraire, Michal Rewienski, and Karen Veroy
Outline
• Transient Analysis of dynamical circuits
– i.e., circuits containing C and/or L
• Examples
• Solution of Ordinary Differential Equations
(Initial Value Problems – IVP)
– Forward Euler (FE), Backward Euler (BE) and
Trapezoidal Rule (TR)
– Multistep methods
– Convergence
Application Problems
Signal Transmission in an Integrated Circuit
Signal Wire
Wire has resistance
Wire and ground plane form a capacitor
Logic
Gate
Logic
Gate
Ground Plane
• Metal Wires carry signals from gate to gate.
• How long is the signal delayed?
Application Problems
Signal Transmission in an IC – Circuit Model
resistor
capacitor
Constructing the Model
• Cut the wire into sections.
• Model wire resistance with resistors.
• Model wire-plane capacitance with capacitors.
Application Problems
Signal Transmission in an IC – 2x2 example
v1 iR
v2
iR1
iR3
2
iC1
C1
R2
R1 R3
Constitutive
Equations
iC2
C2
dvc
ic  C
dt
1
iR  vR
R
Conservation
Laws
iC1  iR1  iR2  0
iC2  iR3  iR2  0
Nodal Equations Yields 2x2 System
C1
0

1
1
 dv1 

R R
0   dt 
1
2





C2   dv2 
1

 R
 dt 
2

1 
R2   v1 
 
1
1   v2 
 
R3 R2 

Application Problems
Signal Transmission in an IC – 2x2 example
Let C1  C2  1, R1  R3  10, R2  1
C1
0

1
1
 dv1 

R R
0   dt 
1
2





C2   dv2 
1


 R
 dt 
2

1 
R2   v1 
 
1
1 v
  2
R3 R2 

dx  1.1 1.0 

x

dt  1.0 1.1
A
Eigenvalues and Eigenvectors
1 1  0.1 0   1 1 
A






2.1  1 1  
1 1   0
eigenvectors
Eigenvalues
1
An Aside on Eigenanalysis
dx(t )
Consider an ODE:
 Ax(t ),
dt
Eigendecomposition:

A   E1

E2
x(0)  x0
 1
En   0
  0
0
0
0 
0   E1
n  
E2
E
1
Change of variables: Ey(t )  x(t )  y(t )  E x(t )
dEy (t )
Substituting:
 AEy (t ), Ey (0)  x0
dt
1 0 0 


1 dy (t )
1
0  y(t )
Multiply by E :
 E AEy (t )   0
0 0  
dt

n 

En 

1
An Aside on Eigenanalysis
From last slide:
1
dy(t )   0
dt  0

0
0
0
0 
n 
y(t)
Decoupled
Equations!
dyi (t )
Decoupling:
 i yi (t )  yi (t )  eit y (0)
dt
dx(t )
Steps for solving
 Ax(t ), x(0)  x0
dt
1) Determine E, 
1t
1

e
0 0 
2) Compute y (0)  E x0


3) Compute y (t )   0
0  y (0)
 0 0 ent 


4) x(t )  Ey (t )
Application Problems
Signal Transmission in an IC – 2x2 example
v1 (0)  1
v2 (0)  0
Notice two time scale behavior
• v1 and v2 come together quickly (fast eigenmode).
• v1 and v2 decay to zero slowly (slow eigenmode).
Circuit Equation Formulation
• For dynamical circuits the Sparse Tableau
equations can be written compactly:
dx(t )
F(
, x, t )  0
dt
x(0)  x0
where x is the vector of circuit va riables
• For sake of simplicity, we shall discuss first
order ODEs in the form: dx(t )
 f ( x, t )
dt
Ordinary Differential Equations
Initial Value Problems (IVP)
Solve Initial Value Problem (IVP) :
 dx(t )
 f ( x, t )

 dt
 x(t0 )  x0
in an interval [t0 ,T] given the initial condition x0 .
Typically analytic solutions are not available
 solve it numerically
Ordinary Differential Equations
Assumptions and Simplifications
• Not necessarily a solution exists and is unique for:
dy
F ( , y, t )  0
dt
• It turns out that, under rather mild conditions on the continuity and
differentiability of F, it can be proven that there exists a unique
solution.
dy
We shall assume that F ( , y, t )  0 has a unique solution
dt
• Also, for sake of simplicity only consider
linear case:
 dx(t )
 Ax(t )

 dt
 x(t0 )  x0
Finite Difference Methods
Basic Concepts
First - Discretize Time
t t
t
tL 1 tL  T
0 t1 t2
Second - Represent x(t) using values at ti
3
l
xˆ 2
4
ˆ
x
ˆ
x
x
(
t
)
1
ˆ
x
l
xˆ
Approx.
Exact
sol’n
sol’n
tL
0 t1 t2 t3
l
Third - Approximate d x(tl ) using the discrete xˆ 's
dt
d
Example:
x(tl )
dt
xˆ l  xˆ l 1
xˆ l 1  xˆ l
or
tl
tl 1
Finite Difference Methods
Forward Euler Approximation
x
d
slope  x(tl )
dt

slope 
tl
tl 1
x(tl 1 )  x(tl )
t
x(tl 1 )  x(tl )
d
x(tl )  A x(tl ) 
dt
t
or
x(tl 1 )  x(tl )  t A x(tl )
t
  x(tl 1 )   x(tl )  t A x(tl ) 
Finite Difference Methods
Forward Euler Algorithm
x(t1 )
xˆ1  x(0)  tAx  0 
x(t2 )
xˆ 2  xˆ1  tAxˆ1
x
tAxˆ1
x(t L )
xˆ L  xˆ L 1  tAxˆ L 1
tAx(0)
t1
t2
t3
t
Finite Difference Methods
Backward Euler Approximation
x
d
slope  x(tl 1 )
dt

slope 
tl
tl 1
x(tl 1 )  x(tl )
t
x(tl 1 )  x(tl )
d
x(tl 1 )  A x(tl 1 ) 
dt
t
or
x(tl 1 )  x(tl )  t A x(tl 1 )
t
  x(tl 1 )   x(tl )  t A x(tl 1 ) 
Finite Difference Methods
Backward Euler Algorithm
Solve with Gaussian Elimination
x(t1 )
xˆ1  x(0)  tAxˆ1
 [ I  tA] xˆ1  x(0)
x(t2 )
xˆ 2  [ I  tA] 1 xˆ1
x
tAxˆ 2
tAxˆ1
t1
x(t L )
xˆ L  [ I  tA] 1 xˆ L 1
t2
t
Finite Difference Methods
Trapezoidal Rule Approximation
1 d
d
( x(tl 1 )  x(tl ))
2 dt
dt
1
 ( Ax(tl 1 )  Ax(tl ))
2
x(tl 1 )  x(tl )
t
1
x(tl 1 ) x(tl )  tA( x(tl 1 )  x(tl ))
2
slope 
x
d
x(tl )
d
dt
slope  x(tl 1 )
dt

slope 
x(tl 1 )  x (tl )
t
t
1
1
  ( x(tl 1 )  tAx(tl ))  ( x(tl )  tAx(tl 1 ))
2
2
Finite Difference Methods
Trapezoidal Rule Algorithm
Solve with Gaussian Elimination
t
x(t1 ) xˆ  x(0)   Ax(0)  Axˆ1 
2
t  1 
t 

  I  A xˆ   I  A x (0)
2 
2 


1
x ( t2 )
x (tL )
t

xˆ 2   I 
2

t
ˆx L   I 
2

1
t
 
A  I 
2
 
1
t
 
A  I 
2
 

A xˆ1


A xˆ L1

x
t1
t2
t
Finite Difference Methods
Numerical Integration View
tl 1
d
x(t )  A x(t )  x (tl 1 )  x(tl )   Ax( )d
tl
dt
tl 1
t
Trap
Ax
(
t
)

Ax
(
t
)
Ax
(

)
d




l
l
tl
2
tAx(tl 1 ) BE
tAx(tl )
tl
tl 1
FE
Finite Difference Methods
Summary of Basic Concepts
Trap Rule, Forward-Euler, Backward-Euler
Are all one-step methods
ˆx l is computed using only xˆ l 1 , not xˆ l 2 , xˆ l 3 , etc.
Forward-Euler is simplest
No equation solution
explicit method.
Boxcar approximation to integral
Backward-Euler is more expensive
Equation solution each step
implicit method
Trapezoidal Rule might be more accurate
Equation solution each step
implicit method
Trapezoidal approximation to integral
Multistep Methods
Basic Equations
Nonlinear Differential Equation:
k-Step Multistep Approach:
l 2
xˆ
l k
xˆ ˆ l 1 l
x xˆ
d
x(t )  f ( x(t ), u (t ))
dt

l j
l j
ˆ
ˆ

x


t

f
x
, u  tl  j 
 j
 j
k
k
j 0
j 0
Multistep coefficients
Solution at discrete points
tl  k
tl 3 tl  2 tl 1 tl
Time discretization

Multistep Methods – Common Algorithms
TR, BE, FE are one-step methods

l j
l j
ˆ
ˆ

x


t

f
x
, u  tl  j 
Multistep Equation:  j
 j
k
k
j 0
j 0
Forward-Euler Approximation:
FE Discrete Equation:
Multistep Coefficients:
BE Discrete Equation:
Multistep Coefficients:

x  tl   x  tl 1   t f  x  tl 1  , u tl 1  
xˆ l  xˆ l 1  t f  xˆ l 1 , u  tl 1  
k  1, 0  1, 1  1, 0  0, 1  1
xˆ l  xˆ l 1  t f  xˆ l , u  tl  
k  1, 0  1, 1  1, 0  1, 1  0
t
f  xˆ l , u  tl    f  xˆ l 1 , u  tl 1  
2
1
1
Multistep Coefficients: k  1,  0  1, 1  1,  0  , 1 
2
2
Trap Discrete Equation: xˆ l  xˆ l 1 


Multistep Methods
Definition and Observations
Multistep Equation:

l j
l j
ˆ
ˆ

x


t

f
x
, u  tl  j 
 j
 j
k
k
j 0
j 0

1) If 0  0 the multistep method is implicit
2) A k  step multistep method uses k previous x ' s and f ' s
3) A normalization is needed, 0  1 is common
4) A k -step method has 2k  1 free coefficients
How does one pick good coefficients?
Want the highest accuracy
Multistep Methods – Convergence Analysis
Convergence Definition
Definition: A finite-difference method for solving
initial value problems on [0,T] is said to be
convergent if given any A and any initial condition
max
xˆ  x  l t   0 as t  0
l
 T
l0, 
 t 
xˆ computed with t
t
l
xˆ computed with
2
l
xexact
Multistep Methods – Convergence Analysis
Order-p Convergence
Definition: A multi-step method for solving initial
value problems on [0,T] is said to be order p
convergent if given any A and any initial condition
max
xˆ  x  l t   C  t 
l
 T
l0, 
 t 
p
for all t less than a given t0
Forward- and Backward-Euler are order 1 convergent
Trapezoidal Rule is order 2 convergent
Multistep Methods – Convergence Analysis
Two types of error
The Local Truncation Error (LTE) of an integratio n method at tl 1
is the difference between th e computed value xˆ l 1 and the exact
value of the solution x(tl 1 ), assuming no previous error has been made.
The Global Truncation Error (GTE) of an integratio n method at tl 1
is the difference between th e computed value xˆ l 1 and the exact
value of the solution x(tl 1 ), assuming that only the initial
condition is known exactly.
Multistep Methods – Convergence Analysis
Two conditions for Convergence
• For convergence we need to look at max error
over the whole time interval [0,T]
– We look at GTE
• Not enough to look at LTE, in fact:
– As I take smaller and smaller timesteps t, I would
like my solution to approach exact solution better
and better over the whole time interval, even
though I have to add up LTE from more timesteps.
Multistep Methods – Convergence Analysis
Two conditions for Convergence
1) Local Condition: One step errors are small
(consistency)
Typically verified using Taylor Series
2) Global Condition: The single step errors do not
grow too quickly (stability)
All one-step methods are stable in this sense.
One-step Methods – Convergence Analysis
Consistency definition
Definition: A one-step method for solving initial
value problems on an interval [0,T] is said to be
consistent if for any A and any initial condition
xˆ  x  t 
1
t
 0 as t  0
One-step Methods – Convergence Analysis
Consistency for Forward Euler
Forward-Euler definition
xˆ1  x  0  tAx  0
  0, t 
Expanding in t about zero yields
dt
2
dt 2
x( t )  x  0   t

dx  0   t  d 2 x  
2
dt
Noting that
x (0)  Ax(0) and subtracting
d
2
dt 2
xˆ1  x  t  
 t  d 2 x  
2
Proves the theorem if
derivatives of x are
bounded
One-step Methods – Convergence Analysis
Convergence Analysis for Forward Euler
Forward-Euler definition
xˆ l 1  xˆ l  tAxˆ l
Expanding in t about l t yields
x   l  1 t   x  l t   tAx  l t   el
where el is the "one-step" error bounded by
el  C  t  , where C  0.5max [0,T ]
2
dt 2
d 2 x  
One-step Methods – Convergence Analysis
Convergence Analysis for Forward Euler
Subtracting the previous slide equations
xˆ l 1  x   l  1 t    I  tA  xˆ l  x  l t    el
Define the "Global" error E l  xˆ l  x  l t 
E l 1   I  tA E l  el
Taking norms and using the bound on el
 1  t A
E
l
 C  t 
E l 1   I  tA E l  C  t 
2
2
One-step Methods – Convergence Analysis
A helpful bound on difference equations
A lemma bounding difference equation solutions
u l 1  1    u l  b, u 0  0,   0

Then
ul 
b
e l
If
To prove, first write ul as a power series and sum
u l   1   
j 0
l 1
j
1  1   
b
b
1  1   
l
One-step Methods – Convergence Analysis
A helpful bound on difference equations
To finish, note (1   )  e  (1   )l  e l
1  1   


ul 
b
b
b
1     1 e l
1  1   
l
l
Mapping the global error equation to the lemma
b

 
E l 1


  1  t A  E l  C  t 
2


One-step Methods – Convergence Analysis
Back to Convergence Analysis for Forward Euler
Applying the lemma and cancelling terms
b

 


t A
E l   1  t A  E l 1  C  t  


C

t
2
2
e


l t A
Finally noting that l t  T ,
max l0,L E l  e
AT
A
t
C
One-step Methods – Convergence Analysis
Observations about Convergence Analysis for FE
max l0,L E l  e
AT
A
t
C
• Forward-Euler is order 1 convergent
• The bound grows exponentially with time interval
• C is related to the solution second derivative
• The bound grows exponentially fast with norm(A).
Summary
• Transient Analysis of dynamical circuits
– i.e., circuits containing C and/or L
• Examples
• Solution of Ordinary Differential Equations
(Initial Value Problems – IVP)
– Forward Euler (FE), Backward Euler (BE) and
Trapezoidal Rule (TR)
– Multistep methods
– Convergence