MA375 - Rice CAAM Department

MA557/MA578/CS557
Lecture 28
Spring 2003
Prof. Tim Warburton
[email protected]
1
Linear Systems of 2D PDEs
• A general linear pde system will look like:
Find q :   [0, t ] 
d
where d  dim(q) such that:
q
q
q
A
B
0
t
x
y
2
Deriving DG
• Ok – by popular demand here’s a brief derivation of
the DG scheme for advection.
Weak form of the advection equation is,
1
find q : P p T    0, t  
d
such that   P p T 
q
q 
 q

,

A

B

 0
x
t T
 t
Integrate by parts the terms with spatial derivatives:
2
q
q 
 q

,

A

B

 0
x
t T
 t

 q 
 
  
   ,    , Anxq  Bn y q     A  , q     B  , q   0
T
 t T
 x
T  y
T
3

 q 
 
  



,


,
A
n
q

B
n
q


A
,
q


B
,
q

x
y

 
        0

T
 t T
 x
T  y
T
3
 modification to approximate q 
 q 
   ,    ,  Anx  Bn y  qˆ 
 t T

T

 
  
   A  , q     B  , q   0
 x
T  y
T

 q 
 
  

ˆ

,


,
A
n

B
n
q


A
,
q


B
,
q

x
y


        0

T
 t T
 x
T  y
T
 integration by parts of the last two terms

4

T
by qˆ   qˆ   q  , q  

q  
q 
 q  
   ,     , A     , B    ,  Anx  Bn y   qˆ  q  
x T 
y T
 t T 


4
T
0
5
Necessary condition on qhat for stability
Scalar case dim(q)  1:
q  
q 
 q  


ˆ

,


,
a


,
b


,
an

bn
q

q




x
y

 
 

x T 
y T
 t T 
Let's consider stability (usual approach):


T
0
 q, q Tk

d
q
q 



ˆ

q
,
a

b

q
,
an

bn
q

q







x
y


dt k
2

x

y
k 
k
Tk

   anx  bn y   
 q, q Tk
d
 
  q ,
 q 


dt k
2
2
k 

 
0
Tk

  q  ,  anx  bn y  qˆ  q  
Tk
   anx  bn y   
 q, q Tk
d
 
  q ,
 q 


dt k
2
2
k 

 
k

  q  ,  anx  bn y  qˆ 
Tk
k
   anx  bn y   
  q ,
q    q  ,  anx  bn y  qˆ 

 
 
2
k 

 Tk k



Tk


Tk
 0 for stability
5
Tk
0
   

i.e.   q ,  q  2qˆ    0 where    anx  bn y
2
k 
Tk
5 cont
We re-express the sum over all elements into a sum over all unique edges.
    

   
 
  
e  q , 2  q  2qˆ     q , 2  q  2qˆ     0

e 
e 
It is sufficient to make sure that each of these terms is negative, i.e.:

 
  q  ,  q   2qˆ    q  ,  q   2qˆ  
e
   0 having used 
e
Sufficient condition:
6

 
  q  ,  q   2qˆ    q  ,  q   2qˆ  
e

e

 - 
 0 using    - 
Possible solution:
If    0 ("inflow") then qˆ   q  , qˆ   q 
If    0 ("outflow") then qˆ   q  , qˆ   q 
6
Proof of possible solution
Sufficient condition:

 
  q  ,  q   2qˆ    q  ,  q   2qˆ  
e
 0
e
Possible solution:
If    0 ("inflow") then qˆ   q  , qˆ   q 

q ,q
 
   q ,  q


 q  ,  q   2qˆ    q  ,  q   2qˆ    ...

e

 2q 
q ,q   q



e

e

 2q 
e
e
 ...
, q    2  q  , q    0 qed
e
e
If    0 ("outflow") then qˆ   q  , qˆ   q 

q ,q
 
   q ,  q


 q  ,  q   2qˆ    q  ,  q   2qˆ    ...

e

 2q 

e

 2q 
e
e
 ...
-  q  , q     q  , q    2  q  , q    0 qed
e
e
e
7
Upwinding Unveiled
Sufficient condition:

 
  q  ,  q   2qˆ    q  ,  q   2qˆ  
e
 0
e
Possible solution:
If    0 ("inflow") then qˆ   q  , qˆ   q 
If    0 ("outflow") then qˆ   q  , qˆ   q 
This is nothing more than upwinding in disguise
8
Equivalent
Conditions
Sufficient condition:

 
  q  ,  q   2qˆ    q  ,  q   2qˆ  
e
 0
e
Possible solution:
If    0 ("inflow") then qˆ   q  , qˆ   q 
If    0 ("outflow") then qˆ   q  , qˆ   q 
Can be written:
qˆ  

 
2 
q 

 
2 
q



1 
1


  q  q  
q

q



2
2
and similarly:


1
1


qˆ    q   q   
q

q


2
2 


1 
1



=
q

2
q
  2  q

q
 using 

  9
Returning To DG Scheme
Scalar case, dim(q)  1:
q  
q 
 q  


ˆ

,


,
a


,
b


,
an

bn
q

q




x
y

 
 

x T 
y T
 t T 
becomes:


T
0
  q  q  1  

q  
q  
 q  




q  q   q   0
  ,     , a     , b     ,  

 

x T 
y T 
2  2
 t T 

 T



1
1


using qˆ    q   q   
q

q


2
2 
Finally:

 
q  
q  
 q 

 q q
  ,      , a     , b     ,  
x T 
y T 
2
 t T





 1


q  q 

 

 2
 T





q  
q  
q

q



    , a     , b     , 
    , 
x T 
y T 

 2  T 
 q  q  


2


10 T
Convergence
• Convergence follows as before…however for a given
choice of qhat we need to verify consistency to
guarantee stability.
• In fact for the convergence result to hold we required
the truncation error to vanish in the limit of small h
and also large p.
• For example we required:
qˆ -  P p q  , P p q -  - P p q -
T
 0 as h  0 and/or p  
• This is easily verified for the choice of qhat we just
made.
11
General Choice of qhat
• We established the following sufficient conditions on
the choice of the function qhat(q+,q-):
Sufficient condition:

 
  q  ,  q   2qˆ    q  ,  q   2qˆ  
qˆ -  P p q  , P p q -  - P p q -
e
T
 0
e
 0 as h  0 and/or p  
• As long as these are met for a choice of qhat then the
scheme will be stable.
• However, the choice of qhat may impact accuracy…
12
An Alternative Construction for qhat


1
1





qˆ    q   q   
q

q
where

is
chosen
so





2
2 
• Exercise – prove that this is a sufficient condition for
stability. i.e.
  q  ,  q   2qˆ    q  ,  q   2qˆ    0

 
e

e
• This generates the Lax-Friedrich flux based DG
scheme:




 q  q  
q  
q  
 q 

q q 
  ,      , a     , b     , 
   ,  


t

x

y
2
2

T

T 
T 

 T 

 T
13
Lax-Friedrichs Fluxes
• Suppose we know the maximum wave speed of the
q
q
q
hyperbolic system:
A B
0
t
x
y
 are
• As long as the matrix A, B 
codiagonalizable for any linear combination.
n
n
• i.e. C   A   B Has real eigenvalues for any
real alpha,beta.
• And:
max  | C , x   x for some x 

n

,  ,  |  2   2  1  
• then we can use the following DG scheme:
14
Lax-Friedrichs DG Scheme
For Linear Systems
As before – we can generalize the scalar PDE scheme
to a system:
Find q : P p T   [0, t ] 
d
such that   P p T 
 

 q
q
q    Anx  Bn y  
q      , q    0

  , t  A x  B y     , 
2

T  
 T  2
T
where q   q   q 
15
Discrete LF/DG Scheme
• We choose to discretize the Pp polynomial space on
each triangle using M=(p+1)(p+2)/2 Lagrange
interpolatory polynomials.
• i.e.
P p T   hm 1mM
• The scheme now reads:
Find q m  t  , m  1,..., M  such that:
m M
 h ,h 
m 1
n
m T

 m M   hm 
dq m m M   hm 
   A  hn ,
q m .....
 q m    B  hn ,

dt
x T  m1  
y T 
m 1  
   Anx  Bn y    I  
  hn , 
 hm  q m   0
 
 
2

 T

16
Tensor Form
Find q mcj  t  , m  1,..., M , c  1,...,dim(q), j=1,...,#tri such that:
m M
 h ,h 
m 1
n
d dim( q )

d 1
d=dim(q )

d 1
d 1
dt
 ....
 m M  h 
 
A cd    hn , m  q mdj    ....
 m1 
x T j
 


 m M  h 
 

B cd    hn , m  q mdj    .....
y T j
 m1 
 


d dim( q )

m T
j
dq mcj
  A cd nx  B cd n y    I   m M




    hn , hm T q mdj    0

  m1
2


cd
17
Simplified Tensor Form
Find q ncj  t  , n  1,..., M , c  1,...,dim(q), j=1,...,#tri such that:
dq ncj
dt
 ....
d  dim( q )

d 1
 mM x
 d=dim(q )
 mM y

A cd   Dnmq mdj    B cd   Dnmq mdj   .....
d 1
 m1

 m1

  A cd nxe  B cd n ey    I   m M

e




S
q



nm  mdj    0



2
d 1
e 1


cd  m1
where:
d  dim( q ) e 3
M nm   hn , hm T
D
x
nm
k M
 hm 
x
1
x
  hn ,
,
D

M
D



nm

nk km
x T

k 1
D
y
nm
k M
 hm 
y
y
  hn ,
, Dnm    M 1  Dkm

nk
y T
k 1

S
e
nm
  hn , hm T , S
e
e
nm

k M
 M 
k 1
1
nk
S ekm
18
Geometric Factors
• We use the chain rule to compute the Dx and Dy
matrices:
r r s s
D  D  D
x
x
r r s s
y
D  D  D
y
y
x
• In the umSCALAR2d scripts the
umDr  D
r
umDs  Ds
r
s
r
s
rx  , sx  , ry  , sy 
x
x
y
y
19
Surface Terms
• In the Matlab code first we extract the nodes on the edges
of the elements:
• fC = umFtoN*C
• The resulting matrix fC has dimension
(umNfaces*(umP+1))xumNel
• This lists all nodes from element 1, edge 1 then element
1, edge 2 then…
• In order to multiply, say fC, by Se we use
umNtoF*(Fscale.*fC) where:
Fscale = sjac./(umNtoF*jac);
20
Example Matlab Code
(Upwind DG Advection Scalar Eqn)
• This is not strictly a global Lax-Friedrichs scheme
since the lambda is chosen locally!!!
21
Example Matlab Code cont
22
Specific Example
• We will try out this scheme on the 2D, transverse
mode, Maxwell’s equations.
23
Maxwell’s Equations (TM mode)
• In the absence of sources, Maxwell’s equations are:
Hx 
t

Ez
0
y
H y 
Ez

0
t
x
   Ez  H x H y


0
t
y
x
Hx 

H y 
x
  permittivity
• Where
y
0
  permeability
H  magnetic field
E  electric field
24
Free Space..
• For simplicity we will assume that the permeability
and permittivity are =1 we then obtain:
H x Ez

t
y
H y Ez

t
x
Ez H x H y


t
y
x
H x H y

x
y
0
0
0
0
25
Divergence Condition
• We next notice that by taking the x derivative of the
first equation and the y derivative of the second
equation we find that:
  H x H y


t  x
y

0

• i.e. the fourth equation (divergence condition) is a
natural result of the equations – assuming that the
initial condition for the magnetic field H is divergence
free.
26
The Maxwell’s Equations We Will Use
H x Ez

0
t
y
H y Ez

0
t
x
Ez H x H y


0
t
y
x
H y
H x
 x, y , t  0  
 x, y , t  0   0
x
y
27
The Maxwell’s Equations As Conservation Rule
H x 

  0    Ez   0
y
x
t
H y 

   Ez    0   0
y
x
t

Ez 
  H y    H x   0
y
t x
H y
H x
 x, y , t  0   0
 x, y , t  0  
y
x
28
TM Maxwell’s Boundary Condition
• We will use the following PEC boundary condition –
which corresponds to the boundary being a perfectly,
electrical conducting material:

x
H H

x
H y  H y
Ez   Ez
29
The Maxwell’s Equations In Matrix Form
q
q
q
A
B
0
t
x
y
 Hx 
0 0 0 
0 0 1
q   H y  , A   0 0 1 , B   0 0 0 






E 
 0 1 0 
1 0 0
 z




• We are now assuming that the magnetic field is going
to be divergence free – so we just neglect this for the
moment.
30
Eigenvalues
• Then:
0 0 0 
0 0 1
0
A   0 0 1 , B   0 0 0   C   0





 0 1 0 
1 0 0






0
0

 
 

0 
• C has eigenvalues which satisfy:
 
0  C  I   0



 
  

  
0
 0  C   I       2   2      
   0,   2   2
• So the matrices are co-diagonalizable for all real alpha, beta and
    1 given     1
2
2
31
Project Time
• Due 04/11/03
• Code up a 2D DG solver for an arbitrary hyperbolic
system based on the 2D DG advection code
provided.
• Test it on TM Maxwell’s
– Set A and B as described, set lambdatilde = 1 and
test on some domain of your choosing.
– Use PEC boundary conditions all round.
• Test it on a second set of named equations of your
own choosing (determine these equations by
research)
• Compute convergence rates.. For smooth solutions.
32