Finite Differences: Parabolic Problems - MIT OpenCourseWare · Finite Differences: Parabolic...
Transcript of Finite Differences: Parabolic Problems - MIT OpenCourseWare · Finite Differences: Parabolic...
SMA-HPC ©2002 NUS
16.920J/SMA 5212 Numerical Methods for PDEs
Thanks to Franklin Tan
Finite Differences: Parabolic Problems
B. C. Khoo
Lecture 5
SMA-HPC ©2002 NUS
Outline
• Governing Equation • Stability Analysis • 3 Examples • Relationship between σ and λh • Implicit Time-Marching Scheme • Summary
2
SMA-HPC ©2002 NUS
[ 2
2 0,u x t
υ π∂ =
∂ ∂
GoverningEquation
3
Consider the Parabolic PDE in 1-D
0subject to at 0, atu u x u u xπ π= = =
• If υ ≡ viscosity → Diffusion Equation • If υ ≡ thermal conductivity → Heat Conduction Equation
0x = x π=
0u π
( ), u x t =
] u x ∂
∈
=
u
?
SMA-HPC ©2002 NUS
Stability Analysis Discretization
4
Keeping time continuous, we carry out a spatial discretization of the RHS of
There is a total of 1 grid points such that ,
0,1, 2,...., jN j x
j
+ = ∆
=
0x = x π=
0x 1x 3x 1Nx − Nx
2
2
u t
υ∂ ∂ =
∂ ∂
x
N
u x
SMA-HPC ©2002 NUS
Stability Analysis Discretization
5
2 1 2
2
2 ( j j
j
u uu O x x
+ − ∂ = ∆
∂
2
2Use the Central Difference Scheme for u x ∂
∂
which is second-order accurate.
• Schemes of other orders of accuracy may be constructed.
1 2 )j u
x −++
∆
SMA-HPC ©2002 NUS 6
Stability Analysis Discretization
We obtain at
0
0
Note that we need not evaluate at and since and are given as boundary conditions.
N
N
u x x x u
= =
1 1 22: 2 )o
du x u udt x
υ = + ∆
2 2 2 32: 2 )du x u u
dt x υ
= + ∆
1 2: 2 )j j j j
du x u u
dt x υ
− + = + ∆
1 1 12: 2 )N
N N N du x u u
dt x υ−
− − = + ∆
x u
1 ( u −
1 ( u −
1( j u −
2 ( N u − −
SMA-HPC ©2002 NUS 7
Stability Analysis Matrix Formulation
Assembling the system of equations, we obtain 1
1 2
2
2
2
1 1 2
2 1
01 1
0
1 1
1 0
1
o
jj
NN N
du u udt x du
udt
udu x dt
udu u xdt
υ
υ
υ − −
− ∆ − = −∆ − ∆
0
0
A
2
2
2
+
SMA-HPC ©2002 NUS 8
Stability Analysis PDE to Coupled ODEs
Or in compact form
du Au bdt
=
We have reduced the 1-D PDE to a set of Coupled ODEs!
[ ]1 1where T Nu u u − =
2 0 0 T
o u b x
υ = ∆
+
2 u
20 Nux
υ∆
SMA-HPC ©2002 NUS 9
Stability Analysis Eigenvalue and
Eigenvector of Matrix A
If A is a nonsingular matrix, as in this case, it is then possible to find a set of eigenvalues
{ 1 1, ,...., ,....,j λ λ λ λ − =
For each eigenvalue , we can evaluate the eigenvector consisting of a set of mesh point values , i.e.
j j
j i
V v
λ
1 1 Tj j j
NV v v − =
( from det 0.A λ−
}2 Nλ
2 j v
)I =
SMA-HPC ©2002 NUS 10
Stability Analysis Eigenvalue and
Eigenvector of Matrix A
The ( 1) ( 1) matrix formed by the ( 1) columns diagonalizes the matrix byj
N E N V
− × − −
1E AE− = Λ 1
2
1
where
N
λ
λ
λ −
Λ =
0
0
N A
SMA-HPC ©2002 NUS 11
Stability Analysis Coupled ODEs toUncoupled ODEs
Starting from du Au bdt
= +
1Premultiplication by yieldsE −
1 1duE E Au E bdt
− −=
( 1 1 1duE E A EE u E bdt
− − −=
I
( 1 1 1duE E AE E u E bdt
− − −=
Λ
1 − +
)1 − +
)1 − +
SMA-HPC ©2002 NUS 12
Stability Analysis Coupled ODEs to Uncoupled ODEs
1 Let and , we haveU E u F E b− =
d U Fdt
= Λ +
which is a set of Uncoupled ODEs!
1 1duE u E bdt
− −= Λ +
Continuing from
1−=
U
1 E −
SMA-HPC ©2002 NUS 13
Stability Analysis Coupled ODEs to Uncoupled ODEs
Expanding yields
Since the equations are independent of one another, they can be solved separately.
The idea then is to solve for and determineU EU=
1 1 1 1
dU U dt
λ= +
2 2 2
dU U dt
λ= +
j j j
dU U
dt λ= +
1 1 1
N N N
dU U dt
λ− − − =
u
F
2 F
j F
1 N F − +
SMA-HPC ©2002 NUS 14
Considering the case of independent of time, for the general equation,th
b j
Stability Analysis Coupled ODEs to Uncoupled ODEs
1jt j j
j
U e Fλ
λ =
is the solution for j = 1,2,….,N–1.
Evaluating, ( ) 1 tu EU E ce E E bλ − = − Λ
Complementary (transient) solution
Particular (steady-state) solution
( 11 1 1where j N
Tt tt t j ce c e c e c e c e λ λλ λ −
− =
j c −
1−=
) 2 2
tN
λ
SMA-HPC ©2002 NUS
We can think of the solution to the semi-discretized problem
15
Stability Analysis Stability Criterion
( ) 1 tu E ce E E bλ − = Λ
This is the criterion for stability of the space discretization (of a parabolic PDE) keeping time continuous.
Since the transient solution must decay with time,
for all j( )Real 0jλ ≤
Each mode contributes a (transient) time behaviour of the form to the time-dependent part of the solution.j t
j e λ
as a superposition of eigenmodes of the matrix operator A.
1−−
SMA-HPC ©2002 NUS 16
Stability Analysis Use of Modal (Scalar)
Equation
It may be noted that since the solution is expressed as a contribution from all the modes of the initial solution, which have propagated or (and) diffused with the eigenvalue
, and a contribution frj
u
λ
om the source term , all the properties of the time integration (and their stability properties) can be analysed separately for each mode with the scalar equation
jb
j
dU U Fdt
λ =
+
SMA-HPC ©2002 NUS 17
Stability Analysis Use of Modal (Scalar)
Equation
The spatial operator A is replaced by an eigenvalue λ, and the above modal equation will serve as the basic equation for analysis of the stability of a time-integration scheme (yet to be introduced) as a function of the eigenvalues λ of the space-discretization operators.
This analysis provides a general technique for the determination of time integration methods which lead to stable algorithms for a given space discretization.
SMA-HPC ©2002 NUS 18
1 11 1 12 2
2 21 1 22 2
du a u a udt du a u a udt
=
=
1 1 12
2 1 22
Let , u a
u u a
= ⇒
du Audt
=
Consider a set of coupled ODEs (2 equations only):
Example 1 Continuous Time
Operator
+
+
1
2
a A
a =
SMA-HPC ©2002 NUS 19
Proceeding as before, or otherwise (solving the ODEs directly), we can obtain the solution
1
1
1 11 2 12
2 21 2 22
t
t
u e c e
u e c e
λ
λ λ
ξ
ξ
=
=
11 21 1
21 22
1
where and are eigenvalues of and and are
eigenvectors pertaining to and respectively.
A ξ
λ ξ
λ
( )j As the transient solution must decay with time, it is imperative that Real 0 for 1, 2.jλ ≤
Example 1 Continuous Time
Operator
2
2
1
1
t
t
c
c
λ ξ
ξ
+
+
2
2
ξλ
ξ λ
=
SMA-HPC ©2002 NUS 20
Suppose we have somehow discretized the time operator on the LHS to obtain
1 1 1 1 12 2
1 2 1 1 22 2
n n
n n
u u a u
u u a u
− −
− −
=
=
where the superscript n stands for the nth time level, then
1 11 12 1
21 22
where and Tn n n a
u u u u u A a
− = =
Since A is independent of time, 1 0
.... n n nu u AAu A u
− = = =
Example 1 Discrete Time Operator
1 1
1 2
n
n
a
a
+
+
2
n n a A
a =
2 n A
− =
SMA-HPC ©2002 NUS 21
Example 1 Discrete Time Operator
1 0 1
2
0where =
0
n n n
n u E u λ
λ −
= Λ Λ
' 1 1 11 1 2 12 2
' 2 1 21 1 2 22 2
n n
n n
u c
u c
λ ξ λ ξ
λ ξ λ ξ
=
=
1 1 0
2
' where are constants.
' c
E u c
− =
1
1 1 0
,
.... n
A E E
u E E E E E u
−
− −
= Λ
= Λ ⋅ Λ ⋅ ⋅ Λ ⋅
As
A A A
n E
'
'
n
n
c
c
+
+
1 E −
SMA-HPC ©2002 NUS 22
Example 1 Comparison
Comparing the solution of the semi-discretized problem where time is kept continuous
[ 1
2
1 1 12 1
2 1 22
t
t
u e c
u e
λ
λ
ξ
ξ
=
to the solution where time is discretized
[ 1 1 12 1 1
2 1 22 2
' n n
n
u c
u ξ ξ
ξ λ
=
coTh nte di inuofference equation where time is hus exponential solution
as . teλ
The difference equation where time is hasdiscretized power solution . nλ
] 12
2
c ξ
ξ
] 12
2
' c λ
ξ
SMA-HPC ©2002 NUS 23
Example 1 Comparison
In equivalence, the transient solution of the difference equation must decay with time, i.e.
for this particular form of time discretization.
1nλ <
SMA-HPC ©2002 NUS 24
Consider a typical modal equation of the form
t
j
du u aedt
µλ =
where is the eigenvalue of the associated matrix .j Aλ
(For simplicity, we shall henceforth drop the subscript j). We shall apply the “leapfrog” time discretization scheme given as
Substituting into the modal equation yields
( 1
2
n t
t nh
u u aeh
µλ +
=
− =
n nu eµλ=
1
where 2
n du u u h dt h
+ − = ∆
Example 2 Leapfrog Time Discretization
+
)1 n u −
+
ha+
1 n
t−
=
SMA-HPC ©2002 NUS
Solution of u consists of the complementary solution cn, and the particular solution pn, i.e.
un = cn + pn
There are several ways of solving for the complementary and particular solutions. shift operator S and characteristic polynomial.
The time shift operator S operates on cn such that
Scn = cn+1
S2cn = S(Scn) = Scn+1 = cn+2
25
( 1
1 2 2 2
n n n n n n hnu u e u h u u ha e
h µ λ
+ + −
= ⇒ − − =
Example 2 Leapfrog Time Discretization Time Shift Operator
One way is through use of the
)1
1n
hu a µλ −
−+
SMA-HPC ©2002 NUS 26
The complementary solution cn satisfies the homogenous equation
1
2
2
2
2
1( ) 0
( 1) 0
n n
n n
n n
n
c c c cSc h c S
S c h Sc c S
cS S S
λ
λ
λ
λ
+ − =
− =
− =
− =
2( ) ( 2 1) 0p S S h Sλ= − =
characteristic polynomial
Example 2 Leapfrog Time Discretization Time Shift Operator
1 0
0
2
2
n
n
n
h
h
−−
−
−
−
−
SMA-HPC ©2002 NUS 27
The complementary solution to the modal equation would then be
1 1 2 2 n nc β σ σ=
The particular solution to the modal equation is 2
2 2
hn h n
h
ahe e p e e
µ
µ λ =
− −
Combining the two components of the solution together,
( ) ( )n nu p=
( ) ( )2 2 2 2 1 2
21 2
hn hn
h
ahe eh h h e e
µ
µ β λ λ β λ λ λ
= + + − + + − −
The solution to the characteristic polynomial is 2 2( ) 1h h hσ λ λ λ= = ± + σ1 and σ2 are the two roots
Example 2 Leapfrog Time Discretization Time Shift Operator
nβ+
1 h h
µ
µ
n c +
2 1 1
n
h h h
µ
µ
+
S
SMA-HPC ©2002 NUS 28
For the solution to be stable, the transient (complementary) solution must not be allowed to grow indefinitely with time, thus implying that
is the stability criterion for the leapfrog time discretization scheme used above.
( ) ( )
2 2 1
2 2 2
1
1
h
h
σ λ
σ λ
= + <
= − <
Example 2 Leapfrog Time Discretization Stability Criterion
1
1
h
h
λ
λ
+
+
SMA-HPC ©2002 NUS 29
Im(σ )
Re(σ )-1 1
Region of Stability
The stability diagram for the leapfrog (or any general) time discretization scheme in the σ-plane is
Example 2 Leapfrog Time Discretization Stability Diagram
SMA-HPC ©2002 NUS 30
In particular, by applying to the 1-D Parabolic PDE 2
2
u t
υ∂ ∂ =
∂ ∂
the central difference scheme for spatial discretization, we obtain
which is the tridiagonal matrix.
Example 2 Leapfrog Time Discretization
2
2 1 1 1
1 1
A x υ
− −
= ∆
−
0
0
u x
2
2
SMA-HPC ©2002 NUS 31
Example 2 Leapfrog Time Discretization
According to analysis of a general triadiagonal matrix B(a,b,c), the eigenvalues of the B are
2
2 cos , 1,..., 1
2 2 cos
j
j
jb c j NN
j N
πλ
π λ
= + −
= − + ∆ The most “dangerous” mode is that associated with the eigenvalue of largest magnitude
max 2
4 x υλ = −
∆
( (
2 max1 ax max
2 max2 ax max
1
1
h h
h h
σ λ λ λ
σ λ λ λ
= +
= +
i.e.
which can be plotted in the absolute stability diagram.
a
x υ
=
) )
2 m
2 m
h
h
+
−
SMA-HPC ©2002 NUS 32
Example 2 Leapfrog Time Discretization Absolute Stability Diagram for σ
As applied to the 1-D Parabolic PDE, the absolute stability diagram for σ is
Region of stability
Unit circle
Region of instability
σ2 at h = ∆t = 0
σ2 with h increasing
σ1with h increasing σ1 at h = ∆t = 0
Re(σ)
Im(σ)
SMA-HPC ©2002 NUS 33
Stability Analysis Some Important
Characteristics Deduced
A few features worth considering:
1. Stability analysis of time discretization scheme can be carried out for all the different modes .
2. If the stability criterion for the time discretization scheme is
jλ
valid for all modes, then the overall solution is stable (since it is a linear combination of all the modes).
3. When there is more than one root , then one of them is the principal root which represents
σ
( 0
an approximation to the physical behaviour. The principal root is recognized by the fact that it tends towards one as 0, i.e. lim 1. (The other roots are spurious, which affect the stability
h h
λ λ λ
→ →
but not the accuracy of the scheme.) )h σ =
SMA-HPC ©2002 NUS 34
Stability Analysis Some Important
Characteristics Deduced
1
4. By comparing the power series solution of the principal root to , one can determine the order of accuracy of the time discretization scheme. In this example of leapfrog time discretization,
1
he
h
λ
σ = ( ( 1
2 2 2 2 4 42
2 2
1
2 2
1 .1 2 1 2 !
1 ...2
and compared to
1 ..2!
is identical up to the second order of . Hence, the above scheme is said to be second-order accurate.
h
h h h
hh
h e
h
λ
λ λ λ
λσ
λλ
λ
− + + + +
= + + +
= + + +
λ + ) )1 2 .
2
.
h
h
λ
λ
=
SMA-HPC ©2002 NUS 35
Analyze the stability of the explicit Euler-forward time discretization 1n du u u
dt t
+ − =
∆
as applied to the modal equation du udt
λ=
1
1
Substituting where
into the modal equation, we obtain (1 ) 0
n
n
du u h h tdt
u uλ
+
+
= = ∆
− +
Euler-Forward Time Discretization Stability Analysis
Example 3
n
n
n
u
h
+
=
SMA-HPC ©2002 NUS 36
Making use of the shift operator S 1 (1 ) (1 ) [ (1 )] 0n n n nc c Sc h c S h cλ λ+ − + = − + = − + =
Therefore ( ) 1 and n
h c σ λ
βσ
= +
=
characteristic polynomial
The Euler-forward time discretization scheme is stable if
Euler-Forward Time Discretization Stability Analysis
Example 3
1 hσ ≡ +
or bounded by 1 s.t. 1 in the -plane.h λ σ λ= − <
n h λ
n
h λ
1λ <
hσ
SMA-HPC ©2002 NUS 37
Euler-Forward Time Discretization Stability Diagram
Example 3
Im(λh)
0-1-2
Unit Circle
Region of Stability
Re(λh)
The stability diagram for the Euler-forward time discretization in the λh-plane is
SMA-HPC ©2002 NUS 38
Euler-Forward Time Discretization Absolute Stability Diagram
Example 3
max 2
4As applied to the 1-D Parabolic PDE, x υλ λ= −
∆
max
2The stability limit for largest h λ −
≡ ∆ =
1-1
σ leaves the unit circle at λh = −2
σ at h (=∆t) = 0
Re(σ)
Im(σ)
σ with h increasing
=
t
SMA-HPC ©2002 NUS 39
Relationshipbetween σ and λh
σ = σ(λh)
Thus far, we have obtained the stability criterion of the time discretization scheme using a typical modal equation. generalize the relationship between σ and λh as follows:
• Starting from the set of coupled ODEs
du Au bdt
= +
• Apply a specific time discretization scheme like the “leapfrog” time discretization as in Example 2
1
2
n du u u dt h
+ −− =
We can
1 n
SMA-HPC ©2002 NUS 40
Relationshipbetween σ and λh
σ = σ(λh)
• The above set of ODEs becomes 1
2
n nnu Au h
+ − = +
• Introducing the time shift operator S
1
2
2
n nn
nn
uSu hAu hbS
S SA I u bh
−
= +
−− −
1
1 Premultiplying on the LHS and RHS and introducing
operating on n E
I EE u
−
−= i
1 1 1 1
2 nS SE AE E E E u E b
h
− − − − −
− −
Λ
1 n u b−
2 n +
=
1 − =
SMA-HPC ©2002 NUS 41
Relationshipbetween σ and λh
σ = σ(λh)
• Putting 1 , nn nU u F E b− =
1
2j j S S U
hλ
− −− = −
we obtain 1
1
2 n S SE U F
h
− − −
Λ − −
1
2 S S
h
−−
i.e. 1
2 n S S U
h
− −Λ − = −
which is a set of uncoupled equations.
Hence, for each j, j = 1,2,….,N-1,
1 n E −=
j F
nE
=
nF
SMA-HPC ©2002 NUS 42
Relationshipbetween σ and λh
σ = σ(λh)
Note that the analysis performed above is identical to the analysis carried out using the modal equation
j
dU U Fdt
λ =
All the analysis carried out earlier for a single modal equation is applicable to the matrix after the appropriate manipulation to obtain an uncoupled set of ODEs.
Each equation can be solved independently for and the 's can then be coupled through .
th
n n n j
j U u EU=
+
n j U
SMA-HPC ©2002 NUS 43
Relationshipbetween σ and λh
σ = σ(λh)
1. Uncoupling the set, 2. Integrating each equation in the uncoupled set,
3. Re-coupling the results to form the final solution.
These 3 steps are commonly referred to as the
ISOLATION THEOREM
Hence, applying any “consistent” numerical technique to each equation in the set of coupled linear ODEs is mathematically equivalent to
SMA-HPC ©2002 NUS 44
Implicit Time-Marching Scheme
Thus far, we have presented examples of explicit time-marching methods and these may be used to integrate weakly stiff equations.
Implicit methods are usually employed to integrate very stiff ODEs efficiently. solution of a set of simultaneous algebraic equations at each time-step (i.e. matrix inversion), whilst updating the variables at the same time.
Implicit schemes applied to ODEs that are inherently stable will be unconditionally stable or A-stable.
However, use of implicit schemes requires
SMA-HPC ©2002 NUS 45
Implicit Time-Marching Scheme
Euler-Backward
Consider the Euler-backward scheme for time discretization 1 1n n du u u
dt h
+ + − =
tdu u aedt
µλ=
(
( (
1 11
111
n n n
n n
u u eh h u u ahe
µ
µ
λ
λ
+ ++
++
− =
− =
Applying the above to the modal equation for Parabolic PDE
yields
n
+
)
) )
n h
hn
u a+
−
SMA-HPC ©2002 NUS 46
Implicit Time-Marching Scheme
Euler-Backward
Applying the S operator,
( ) ( 11 n nh S u aheµλ + − = the characteristic polynomial becomes
( ) ( ) ( )1 0S Sσ Ρ Ρ = − − = The principal root is therefore
2 21 which, upon comparison with 1 .... , is only2
first-order accurate.
he hλ λ = + + +
2 21 1 .... 1
h h
σ λλ
= = + + + −
The solution is (
( 11
1 1
n u n
h
aheU h e
µ
µ β λ
+ = − −
)1 h−
1 h λ =
h λ
hλ
)
) 1
h
h λ + −
SMA-HPC ©2002 NUS 47
Implicit Time-Marching Scheme
Euler-Backward
For the Parabolic PDE, λ is always real and < 0. Therefore, the transient component will always tend towards zero for large n irregardless of h (≡ ∆t).
The time-marching scheme is always numerically stable.
In this way, the implicit Euler/Euler-backward time discretization scheme will allow us to resolve different time-scaled events with the use of different time-step sizes. scaled events, and then a large time-step size used for the longer time-scaled events. hmax.
A small time-step size is used for the short time-
There is no constraint on
SMA-HPC ©2002 NUS 48
Implicit Time-Marching Scheme
Euler-Backward
However, numerical solution of u requires the solution of a set of simultaneous algebraic equations or matrix inversion, which is computationally much more intensive/expensive compared to the multiplication/ addition operations of explicit schemes.
SMA-HPC ©2002 NUS
Summary
49
• Stability Analysis of Parabolic PDE � Uncoupling the set.
� Integrating each equation in the uncoupled set → modal equation.
� Re-coupling the results to form final solution.
• Use of modal equation to analyze the stability |σ(λh)| < 1.
• Explicit time discretization versus Implicit time discretization.