8/12/2019 CAAM452Lecture4b http://slidepdf.com/reader/full/caam452lecture4b 1/44 Partial Differential Equations (Numerical Method) CAAM 452 Spring 2005 Lecture 4 1-step time-stepping methods: stability, accuracy Runge-Kutta Methods,
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 1/44
Partial Differential Equations
(Numerical Method)
CAAM 452
Spring 2005
Lecture 41-step time-stepping methods: stability, accuracy
Runge-Kutta Methods,
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 2/44
CAAM 452 Spring 2005
Today
• Recall AB stability regions and start up issues
• Group analysis of the Leap-Frog scheme
• One-step methods
• Example Runge-Kutta methods:
– Modified Euler
– General family of 2nd order RK methods – Heun’s 3rd Order Method
– The 4th Order “Runge-Kutta” method
– Jameson-Schmidt-Turkel
• Linear Absolute Stability Regions for the 2nd order family RK
• Global error analysis for general 1-step methods (stops slightly short ofa full convergence analysis)
• Warning on usefulness of global error estimate
• Discussion on AB v. RK
• Embedded lower order RK schemes useful for a posteriori errorestimates.
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 3/44
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 4/44
CAAM 452 Spring 2005
Recall:
Requirements Starting Requirements
AB1:
AB2:
AB3:
1
0
1 1
03 1
2 2n n n n
u u dt
u u
u u dt f u f u
0
1
0
n n n
u u
u u dt f u
2
1
0
1 1 2
2
0
23 16 512
n n n n n
u u dt
u u dt
u u
dt u u f f f
1 solution level for start
2 solution levels for start
3 solution levels for start
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 5/44
CAAM 452 Spring 2005
cont
• So as we take higher order version of the ABscheme we also need to provide initial values at
more and more levels.
• For a problem where we do not know the solution
at more than the initial condition we may have to:
– Use AB1 with small dt to get the second restart level
– Use AB2 with small dt to get the third restart level – March on using AB3 started with the three levels
achieved above.
AB1
AB2
AB3
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 6/44
CAAM 452 Spring 2005
Recall: Derivation of AB Schemes
• The AB schemes were motivated by consideringthe exactly time integrated ODE:
• Which we approximated by using a p’th order
polynomial interpolation of the function f
1
1
n
n
t
n n
t
u t u t f u t dt
1
1
n
n
t
n n p
t
u t u t I f u t dt
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 7/44CAAM 452 Spring 2005
Leap Frog Scheme
• We could also have started the integral at:
• And used the mid point rule:
• Which suggests the leap frog scheme:
1nt
1
1
1 1
n
n
t
n n
t
u t u t f u t dt
1 1 2n n nu t u t dtf u t
1 1 2n n nu u dtf u
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 8/44CAAM 452 Spring 2005
Volunteer Exercise
1) accuracy: what is the local truncation error?
2) stability: what is the manifold of absolute linear
stability (try analytically) in the nu=dt*mu plane?
2a) what is the region of absolute linear-stability?
1 1 2n n nu u dtf u
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 9/44CAAM 452 Spring 2005
cont
3) How many starting values are required?
4) Do we have convergence?
5) What is the global order of accuracy?
6) When is this a good method?
1 1 2n n nu u dtf u
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 10/44CAAM 452 Spring 2005
One Step Methods
• Given the difficulties inherent in starting the higher order ABschemes we are encouraged to look for one-step methodswhich only require to evaluate
• i.e.
• Euler-Forward is a one-step method:
• We will consider the one-step Runge-Kutta methods.
• For introductory details see: – “An introduction to numerical analysis”, Suli and Mayers, 12.2
(p317) and on
– Trefethen p75-
– Gustafsson,Kreiss and Oliger p241-
nu1n
u
1 , ;n n n nu u dt u t dt
1 , ; :n n n n n nu u dtf u u t dt f u
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 11/44CAAM 452 Spring 2005
Runge-Kutta Methods
• The Runge-Kutta are a family of one-step methods.
• They consist of s stages (i.e. require s evaluations
of f)
• They will be p’th order accurate, for some p.
• They are self starting !!!.
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 12/44
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 13/44CAAM 452 Spring 2005
Linear Stability Analysis
• As before we assume that f is linear in u andindependent of time
• The scheme becomes (for some given mu):
• Which we simplify (eliminate the uhat variable):
1
1 1 1/ 2
,ˆ
2
,ˆ
n n n
n n n
dt u u f u t
u u dtf u t
1
1 1
ˆ
2
ˆ
n n
n n
dt u u u
u u dt u
1
1 1
ˆ
2
ˆ
n n
n n
dt u u u
u u dt u
2
12
n n n n
dt u u dt u u
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 14/44CAAM 452 Spring 2005
cont
• We gather all terms on the right hand side:
• [ Note: the bracketed term is exactly the first 3
terms of the Taylor series for exp(dt*mu), more on
that later ]
• We also note for the numerical solution to be
bounded, and the scheme stable, we require:
2
1 1
2n n
dt u dt u
2
1 12
dt dt
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 15/44CAAM 452 Spring 2005
cont
• The stability region is the set of nu=mu*dt in the complexplane such that:
• The manifold of marginal stability can be found (as in thelinear multistep methods) by fixing the multiplier to be of unitmagnitude and looking for the corresponding values of nuwhich produce this multiplier.
• i.e. for each theta find nu such that
2
1 12
2
1
2
ie
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 16/44CAAM 452 Spring 2005
cont
• We can manually find the roots of this quadratic:
• To obtain a parameterized representation of the
manifold of marginal stability:
2
12
ie
1 1 2 1 ie
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 17/44CAAM 452 Spring 2005
Plotting Stability Region for
Modified Euler
1 1 2 1 i
e
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 18/44CAAM 452 Spring 2005
Checking Modified Euler
at the Imaginary Axis
• As before we wish to check how much of theimaginary axis is included inside the region of
absolute stability.
• Here we plot the real part of the “+” root
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 19/44CAAM 452 Spring 2005
Is the Imaginary Axis in
the Stability Region ?
• We can analytically zoom in by choosingnu=i*alpha (i.e. on the imaginary axis).
• We then check the magnitude of the multiplier:
• So we know that the only point on the imaginaryaxis with multiplier magnitude bounded above by 1is the origin.
• Modified Euler is not suitable for the advectionequation.
2 2 22 2 2 4
21 1 1 12 2 2 4
i
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 20/44CAAM 452 Spring 2005
General 2 stage RK family
• Consider the four parameter family of RK schemesof the form:
• where we will determine the parameters
(a,b,alpha,beta) by consideration of accuracy.
• [ Euler-Forward is in this family with a=1,b=0
1
2 1
1 1 2
,
,
n n
n n
n n
k f u t
k f u dtk t dt
u u dt ak bk
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 21/44CAAM 452 Spring 2005
cont
• The single step operator in this case is:
1
2 1
1 1 2
1
,
,
,
where , , , ,
n n
n n
n n
n n n n
n n n n n n n n
k f u t
k f u dtk t dt
u u dt ak bk
u u u t
u t af u t bf u dtf u t t dt
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 22/44CAAM 452 Spring 2005
cont
• We now perform a truncation analysis, similar tothat performed for the linear multistep methods.
• We will use the following fact:
2
2
3
3
2 2 2 2
2 2
,
,
...
du f u t t
dt
d u d f f du f f f u t t f
dt dt t u dt t u
d u d f f f
dt dt t u
f f f f f f f f f f f
t t u u t u u t u
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 23/44CAAM 452 Spring 2005
cont (accuracy)
• We expand Phi in terms of powers of dt using thebivariate Taylor’s expansion
• where:
3
2 22 2 2
2 2
, , , ,
2! 2!
n n n n nu t t af u t bf u dtf u t t dt
f
f f af b dt dtf O dt
t u
dt dtf f f f
dt dt f t t u u
,n n f f u t t
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 24/44CAAM 452 Spring 2005
cont
• We construct the local truncation error as:
• Now we choose a,b,alpha,beta to minimize thelocal truncation error.
• Note – we use subindexing to represent partialderivatives.
22
2 2
2 4
,
22 3!
2 2
n n n n n
t u tt tu uu u t u
t u tt tu uu
u t dt u t dt u t t
dt dt dt f f ff f f f f f f f f f
dt dtf dt af b f dtf dtff f dt ff f O dt
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 25/44
CAAM 452 Spring 2005
cont
• Consider terms which are the same order in dt in the localtruncation error:
• Condition 1:
• Condition 2:
• Under these conditions, the truncation is order 3 so the
method is 2nd order accurate. It is not possible to further
eliminate the dt^3 terms by adjusting the parameters.
22
2 2
2 4
23
2
2 !
2
n tt tu uu u t u
tt
t u
t u tu uu
dt f ff
d
dt f
f f
dt f f f f f f f f f
dt dtf dt a b f dt ff tf dtff f O dt
1 0a b
1 102 2
t u t u f ff b dtf dtff f b b
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 26/44
CAAM 452 Spring 2005
Case: No Explicit t Dependence in f
2 2
3
2
,
2!
n nu t t bf u dtf udtf f f
b f dtf O dt u u
22 3 2
22 3 2
,du d u f d u f f f u t f f f dt dt u dt u u
1
22
2 2 4
;
3! 22
n n n n
uu uuu uu
T u t u t dt u t dt
dt dt dt f f f f dt b f O d dt f f f ff t dt f
11,
2b
It is easier to generalize to higher order RK in this case when there is no explicit time dependence in f
S d E l R K tt
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 27/44
CAAM 452 Spring 2005
Second Example Runge-Kutta:
Heun’s Third Order Formula
• Traditional version • In terms of intermediatevariables:
1
,
,3 3
2 2,
3 3
13
4
n n
n n
n n
n n
a dtf u t
a dt
b dtf u t
b dt c dtf u t
u u a c
1
2 1 1/3
1 2 2 /3
,ˆ
3
2,ˆ ˆ
3
1, 3 ,ˆ
4
n n n
n n
n n n n n
dt u u f u t
dt u u f u t
u u f u t f u t
This is a 3rd order, 3 stage single step explicit Runge-Kutta method.
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 28/44
CAAM 452 Spring 2005
1
2
1
2 3
ˆ
3
2ˆ
3 3
234 3 3
23 1 1
4 3 3
1 2 3
n n
n n n
n n n n n n
n n
n
dt u u u
dt dt u u u u
dt dt dt u u u u u u
dt dt dt u u
dt dt dt u
Again Let’s Check the Stability Region
1
2 1 1/3
1 2 2 /3
,ˆ
3
2,ˆ ˆ
3
1
, 3 ,ˆ
4
n n n
n n
n n n n n
dt
u u f u t
dt u u f u t
u u f u t f u t
With f=mu*u reduces to a
single level recursion with avery familiar multiplier:
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 29/44
CAAM 452 Spring 2005
Stability of Heun’s 3rd Order Method
• Each marginally stable mu*dt is such that themultiplier is of magnitude 1, i.e.
• This traces a curve in the nu=mu*dt complex plane.
• Since we are short on time we can plot this using
Matlab’s roots function…
2 3
1 2 6
i
e
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 30/44
CAAM 452 Spring 2005
Stability Region for RK (s=p)
rk2
rk3
rk4
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 31/44
CAAM 452 Spring 2005
• This time we consider points on the imaginary axiswhich are close to the origin:
• And this is bounded above by 1 if
Heun’s Method and The Imaginary Axis
22 3
2 22 3
4 6
12 6
1
2 6
112 36
i
i i
3 1.73
rk3
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 32/44
CAAM 452 Spring 2005
Observation on RK linear stability
• For the s’th order, s stage RKwe see that the stability regiongrows with increasing s:
• Consequently we can take alarger time step (dt) as theorder of the RK scheme
increase.
• On the down side, we requiremore evaluations of f
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 33/44
CAAM 452 Spring 2005
Popular 4th Order Runge-Kutta Formula
• Four stages:
1/ 2
1/ 2
1
1
,
/ 2,
/ 2,
,
1 2 26
n n
n n
n n
n n
n n
a dtf u t
b dtf u a t
c dtf u b t
d dtf u c t
u u a b c d
see: http://web.comlab.ox.ac.uk/oucl/work/nick.trefethen/1all.pdf p76 for details
of minimum number of stages to achieve p’th order.
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 34/44
CAAM 452 Spring 2005
Imaginary Axis (again)
• With the obvious multiplier we obtain:
• For stability we require:
22 3 4
22 3 4 6 8
2
1
2 6 24
1 12 6 24 72 24
i
i i
6 82
2 8 i.e. 2 2 2.83
72 24
rk4
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 35/44
CAAM 452 Spring 2005
Imaginary Axis Stability Summary
2.83 for the 4th Order “Runge-Kutta” method
1.73 for Heun’s 3rd Order Method
0 for modified Euler
B di th Gl b l E i T f th
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 36/44
CAAM 452 Spring 2005
Bounding the Global Error in Terms of the
Local Truncation Error
Theorem: Consider the general one-step method
• and we assume that Phi is Lipschitz continuouswith respect to the first argument (with constant )
• i.e. for
• Then assuming it follows that
1 , ;n n n nu u dt u t dt
L
0 max 0, , , , : ,
we have:
, ; , ;
u t v t D u t t t t u u C
u t dt v t dt L u v
0 1,2,..,nu t u t C n N
0
0 1
1 , 0,1,..., where maxn L t t
n n n
n N
T u u t e n N T T
L
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 37/44
CAAM 452 Spring 2005
cont
Proof: we use the definition of the local truncationerror:
to construct the error equation:
we use the Lipschitz continuity of Phi:
tidying:
,n n n n nT u t dt u t dt u t t
1 1 , ,n n n n n n n n nu t u u t u dt u t t u t T
1 1n n n n n n nu t u u t u dtL u t u T
1 1 1n n n n nu t u dtL u t u T
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 38/44
CAAM 452 Spring 2005
proof cont
1 1
1 1 1
1
0 0
0
0
1
1 10
1 1
1
1 1
1 1
1
1 1max 1 max
1 1
1 1 1
n n n n n
n n n n
m nn m
n m
mm n
m
n m
m
nm nm
m m
m m nm
n n dtL
u t u dtL u t u T
dtL dtL u t u T T
dtL u t u T dtL
T dtL
dtLT dtL T
dtLT T
dtL edtL dtL
1 0 1n L t t T e
dtL
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 39/44
CAAM 452 Spring 2005
proof summary
• We now have the global error estimate:
• Broadly speaking this implies that if the local truncation erroris h^{p+1} then the error at a given time step will scale as
O(h^p):
• Convergence follows under restrictions on the ODE which
guarantee existance of a unique C1 solution and stable
choice of dt.
1 0
1 1 1n L t t
n n
T u t u e
dtL
1 1
p
n nu t u O h
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 40/44
CAAM 452 Spring 2005
Warning About Global Error Estimate
• It should be noted that the error estimate is ofalmost zero practical use.
• In the full convergence analysis we pick a final time
t and we will see that exponential term again.
• Convergence is guaranteed but the constant canbe extraordinarily large for finite time:
1 0
1 1 1n L t t
n n
T u t u e
dtL
01
1 L t t
e L
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 41/44
CAAM 452 Spring 2005
A Posteriori Error Estimate
• There are examples of RK methods which haveembedded lower order schemes.
• i.e. after one full RK time step, for some versions itis possible to use a second set of coefficients to
reconstruct a lower order approximation.• Thus we can compute the difference between the
two different approximations to estimate the localtruncation error committed over the time step.
• google: runge kutta embedded
• Numerical recipes in C:
– http://www.library.cornell.edu/nr/bookcpdf/c16-2.pdf
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 42/44
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 43/44
CAAM 452 Spring 2005
RK v. AB
• When should we use RK and when should we use AB?
rk2
rk3
rk4
8/12/2019 CAAM452Lecture4b
http://slidepdf.com/reader/full/caam452lecture4b 44/44
Class Cancelled on 02/17/05
• There will be no class on Thursday 02/17/05
• The homework due for that class will be due the
following Thursday 02/24/05