MA578S03Lecture32b

advertisement
MA557/MA578/CS557
Lecture 32
Spring 2003
Prof. Tim Warburton
timwar@math.unm.edu
1
Heat Equation
• Recall Lecture 17 where we derived the advectiondiffusion equation in 1D.
• The same type of derivation for the diffusion process
of a concentrate C yields in 2D:
C
 D 2C
t
where:
2
2


2
  2 2
x y
D  diffusion constant
2
Discretization of the Laplacian
• The LDG, semidiscrete, equation satisfies:
• Zero Dirichlet boundary conditions (concentration
pinned to zero at boundary):
C
 D  DxN DxD + DyN DyD  C
t
• Zero Neumann boundary conditions (insulated
boundaries):
C
 D  DxD DxN + DyD DyN  C
t
3
Heat Equation
• Our first approach will be an explicit time integration
of the equation (using zero Neumann bc):
σ= C
for rk  RKorder : 1:1
n
 dt 
σ =C    D  D Dx D xN  D Dy D Ny  σ
 rk 
end
n
C
n 1
σ
4
Explicit Numerical Heat Equation
• The trouble is that the discrete diffusion matrix has a large
D N
D N
spectral radius:
A  D  Dx Dx + Dy Dy

• We do know that (using the integration by parts formula for
the DG operator) that the operator is non-positive.
• We also need to fit the eigenspectrum in the appropriate
stability region:
5
 C, AC  L  
2
  D Nx   D xN  
 D   N  C,  N  C 
 Dy

  D y   L2   

D 
D 
C
D 
N
x
N
y
D D C
2
D D C
2
N
x
N
x
D
2
L2   
L2   
L2   
D D C
2
D D C
2
N
y
C
 F x C
x
N
y
L2   
L2   
2
D
L2   
C
 F y C
y
2
L2   
2
 C 2

2
2
C
x
y
 kD 

 FC 2  FC 2 
L 
L  
 x L2    y L2   


Dp 4
2
 k 2 C L2    using polynomial inverse inequalities6
h
Dp 4
2
 C, AC L2    k 2 C L2  
h
 C, AC L2   Dp 4
   A   max
k 2
C
h
 C, C L2  
We also know that all the
eigenvalues are non-positive real
numbers and dt*rho(A) must fit in
the stability region..
 dt
h2
which can be small
4
Dp
7
Comment
• We have shown that using an explicit time integration
scheme may require very small time steps…
• The root cause of this is that information diffuses
through the data domain very quickly..
• We will investigate some schemes which solve
globally coupled systems.
8
Backwards Euler Time Integration
• Suppose we consider the backwards Euler scheme:
 Cn1  Cn 
D N
D N
n 1
M

M
D
D
D

D
D
C

x
x
y
y 

dt


• Iterator:
Cn1  ACn
where:
A   M  dtL  M
1
and:
L  MD  D Dx D xN  D Dy D Ny 
thus by non-negativity of L
(for theory, consider this in the PKDO basis M =I)
  A 1   1dt , D  0    A   1
9
Backwards Euler Time Integration
• Suppose we consider the backwards Euler scheme:
 Cn1  Cn 
D N
D N
n 1
M

D
M
D
D

D
D
C

x
x
y
y 

dt


• Thus the only conditions for stability are:
dt , D  0
• However, accuracy depends on dt. The discretization
of the time derivative has a first order truncation
error:
Cn1  Cn Cn1

 O  dt 
dt
t
10
Crank-Nicholson
• We replace the right hand side of the discrete
scheme with:
n
n 1

 Cn1  Cn 
C C 
D N
D N
 DM  D x D x  D y D y  
M


2
dt




 Cn1  ACn
1
L
L 

where: A   M  dt   M  dt 
2
2 

and: L   DM  D Dx D xN  D Dy D Ny 
11
Diagonalize
• If we apply a change of basis so that the inv(M)*L is
diagonal then we decouple the iterator into a
sequence of independent scalar iterators:
Cmn1  mCmn
where:
1
m  
m 

m  1  dt  1  dt 
2  
2 

12
Quick Result
• We can bound the iteration multiplier:
1
f   
1 
df
2


0
2
d 1   
 max  f     1
 0
• As long as both the eigenvalues and dt are non-negative then
the multiplier is bounded by one and the scheme is stable.
13
• We have previously shown that L is a non-negative operator.
Crank-Nicholson Accuracy
• We can briefly compute the temporal accuracy:
Cn1  ACn
1
C
n 1
L 
L n

  M  dt   M  dt  C
2 
2

1


M 1L dt 2 M 2L2
M
L n
3
  1  dt

 O  dt   1  dt
C

2
2
4
2 




 1  dtM 1L  O  dt 3  Cn
 Temporal truncation error O  dt 2 
14
ESDIRK4
• A new implicit RK scheme with a lower triangle Butcher
tableau has been proposed by Carpenter et al.
http://fun3d.larc.nasa.gov/papers/carpenter.pdf
• The linear system to invert at each sub stage is the same.
• The RK scheme comes with an embedded scheme to
provide s’th order and (s-1)’th order time approximations:
15
4th Order ESDIRK4 Implicit RK Scheme
initializer + 5 stages
• Iterator: (Ctilde are intermediate values of C, Chat6 is the
embedded 3rd order approximation of Cn+1)
C1  Cn

 dt  a
 dt  a
 dt  a
 dt  a
MC2  MCn  dt a21LC1   LC2
MC3  MCn
MC4  MCn
MC5  MCn
MC6  MCn

1
2
3
LC

a
LC


LC
31
32

1
2
3
4
LC

a
LC

a
LC


LC
41
42
43

1
2
3
4
5
LC

a
LC

a
LC

a
LC


LC
51
52
53
54

1
2
3
4
5
6
LC

a
LC

a
LC

a
LC

a
LC


LC
61
62
63
64
65

ˆ 6  MCn  dt bˆ LC1  bˆ LC2  bˆ LC3  bˆ LC4  bˆ LC5  bˆ LC6
MC
1
2
3
4
5
6
Cn1  C6
16


4th Order ESDIRK4 Implicit RK Scheme
• Iterator: (Ctilde are intermediate values of C, Chat5 is
the embedded 3rd order approximation of Cn+1)
C1  Cn
 M  dt L  C2  MCn  dt  a21LC1 
 M  dt L  C3  MCn  dt  a31LC1  a32LC2 


 dt  a LC  a LC  a LC  a LC 
 dt  b LC  b LC  b LC  b LC  b LC 
4
n
1
2
3
M

dt

L
C

MC

dt
a
LC

a
LC

a
LC


41
42
43
 M  dt L  C5  MCn
 M  dt L  C6  MCn

1
2
51
52
1
1
3
53
2
2
4
54
3
3
4
4
5
5
ˆ 6  MCn  dt bˆ LC1  bˆ LC2  bˆ LC3  bˆ LC4  bˆ LC5  bˆ LC6
MC
1
2
3
4
5
6
Cn1  C6
17

4th Order ESDIRK4 Implicit RK Scheme
• If L is a linear operator then:
C1  Cn
 M  dt L  C2  MCn  dtL  a21C1 
 M  dt L  C3  MCn  dtL  a31C1  a32C2 
 M  dt L  C4  MCn  dtL  a41C1  a42C2  a43C3 
 M  dt L  C5  MCn  dtL  a51C1  a52C2  a53C3  a54C4 
 M  dt L  C6  MCn  dtL  b1C1  b2C2  b3C3  b4C4  b5C5 

ˆ 6  MCn  dtL bˆ C1  bˆ C2  bˆ C3  bˆ C4  bˆ C5  bˆ C6
MC
1
2
3
4
5
6
Cn1  C6

18
Coefficients
Gamma = 1/4
a21 = 1/4
a31 = 8611/62500
a32 = -1743/31250
a41 = 5012029/34652500
a42 = -654441/2922500
a43 = 174375/388108
a51 = 15267082809/155376265600
a52 = -71443401/120774400
a53 = 730878875/902184768
a54 = 2285395/8070912
b1
b2
b3
b4
b5
= 82889/524892
= 0
= 15625/83664
= 69875/102672
= -2260/8211
bhat1 =4586570599/29645900160
bhat2 = 0
bhat3 = 178811875/945068544
bhat4 = 814220225/1159782912
bhat5 = -3700637/11593932
bhat6 = 61727/225920
19
Implementation Details
• As they are computed we are required to store Ctilde1,
Ctilde2, …, Ctilde6 until the end of the 6th ESDIRK stage.
• Each stage 2,3,4,5,6 requires the solution of the same linear
system, with different data on the right hand side.
• Chat6 may be computed without solving a linear system.
• The systems can be solved using an iterative (say conjugate
gradient) method. i.e. the L matrix does not need to be computed
and stored.
• We need to be able to compute (M+dt*gamma*L)*x for a given
vector x.
• ||Ctilde6-Chat6|| will give an estimate of the difference
between a 3rd order and the 4th order approximation in time.
This can be used to estimate the error made in this time
20
step and can suggest a change in dt.
Solving the System
• We are going to use an iterative method to solve the
following sequence of symmetric matrix problems:
L   DM  D Dx D xN  D Dy D Ny 
C1  Cn
 M  dt L  C2   MCn  dtL  a21C1  
 M  dt L  C3   MCn  dtL  a31C1  a32C2  
 M  dt L  C6   MCn  dtL  b1C1  b2C2  b3C3  b4C4  b5C5  

ˆ 6  MCn  dtL bˆ C1  bˆ C2  bˆ C3  bˆ C4  bˆ C5  bˆ C6
MC
1
2
3
4
5
6
Cn1  C6

21
Summary of Temporal Implicit Schemes
L   DM  D Dx D xN  D Dy D Ny 
• Backwards Euler is unconditionally stable for nonnegative diffusion parameter D (i.e. any dt>=0) and
first order in dt.
1
n1
n
C
  M  dtL  MC
• Crank-Nicholson is unconditionally stable for nonnegative diffusion parameter D (i.e. any dt>=0) and
second order in dt.
1
C
n 1
L 
L n

  M  dt   M  dt  C
2 
2

• ESDIRK4 – generalizes to fourth order in dt.
22
Homework 10
Q1) Modify/use the umDIFFUSION.zip files to solve the
diffusion equation with the following time integrators:
a) Backwards Euler
b) Crank-Nicholson
c) ESDIRK4
Q2) Create a domain and determine convergence rates in h
for p=1,3,5,7 for a small dt (i.e. make sure the
convergence does not bottom out above 1e-10). Repeat for
two of the above time integrators.
Q3) Choose p=7 and h small and verify rates of convergence
in dt for integration to some fixed time T. Use the one time
integrator you did not use in Q2.
23
Homework 10
• This homework can be completed in pairs or
individually.
• This homework is due Monday 04/21/03
• Remember – no more than 5 email questions will be
replied to for this homework.
24
Driver for Backwards Euler Diffusion Scheme
(umDIFFUSIONdemo.m)
25
Time Loop (umDIFFUSIONrun.m)
1-12) Set parameters
14-16) Set initial conditions
19) Set solver parameters
22-40) Time stepping loop
28) Solves linear system
using conjugate gradient
32-40) Plot solution and
compute integral of C
26
umDIFFUSIONop.m
• Set up storage for computing:
(M*C +dt*gamma*D* L*C)
27
umDIFFUSIONop.m
15-25) compute qx,qy using
Neumann bcs
27-40) compute div(qx,qy) using
Dirichlet bcs
42-48) compute
(M*C+gamma*dt*D*L*C)
28
Demo Run
29
Discussion of Final Project
• Now is the time to ready your final projects.
• Submit a one page description of the PDE you intend to
discretize with DG by 04/21/03
• This is a proposal and may be rejected – requiring a
resubmission or assignment of a set of PDEs.
• Include:
– List of PDEs to be discretized
– List boundary conditions and initial conditions to be
discretized
– Relevance to your own research (if any)
– List of group members (max 3, with one proposal per group)
– Interesting issues (application of PML, creation of specific
30
PML, specific physical application/model…)
Download