ma557/ma578/cs557 lecture 8
DESCRIPTION
MA557/MA578/CS557 Lecture 8. Spring 2003 Prof. Tim Warburton [email protected]. Discontinuous Galerkin Scheme. Recall that under sufficient conditions (i.e. smoothness) on an interval we obtained the density advection PDE We again divide the pipe into sections divided by x 1 ,x 2 ,…,x N . - PowerPoint PPT PresentationTRANSCRIPT
![Page 2: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/2.jpg)
2
Discontinuous Galerkin Scheme
• Recall that under sufficient conditions (i.e. smoothness) on an interval we obtained the density advection PDE
• We again divide the pipe into sections divided by x1,x2,…,xN .
• On each section we are going to solve a weak version of the advection equation.
0q qut x
1
1 1
1
Find , such that ,i
i
p pi i i i i
xi i
i i i i ix
P x x v P x x
v u dx v x u x xt x
![Page 3: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/3.jpg)
3
1
1 1
1
Find , such that ,i
i
p pi i i i i
xi i
i i i i ix
P x x v P x x
v u dx v x u x xt x
In the i’th cell we will calculate an approximation of q, denoted by . Typically, this will be a p’th order polynomial on the i’th interval. We will solve the following weak equation for i=1,..,N-1
i
x1 x2 x3 xNxN-1
12
31N
i
![Page 4: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/4.jpg)
4
Discretization of Pp
• In order to work with the DG scheme we need to choose a basis for Pp and formulate the scheme as a finite dimensional problem
• We expand the density in terms of the Legendre polynomials
1
1 1
1
Find , such that ,i
i
p pi i i i i
xi i
i i i i ix
P x x v P x x
v u dx v x u x xt x
,0
,
1
1
where: is the m'th coefficient of the Legendre
expansion of the density in the i'th cell.2
m p
i i m mm
i m
i i
i i
L x
x x xxx x
![Page 5: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/5.jpg)
5
Discretization of Pp
• The scheme:
• Becomes:
1
1 1
1
Find , such that ,i
i
p pi i i i i
xi i
i i i i ix
P x x v P x x
v u dx v x u x xt x
,
1,
0 1
1
, 1, ,0 0 01
Find 0,..., such that
1 1 1 1
i m
m pi m
n mm
m p m p m pm
n i m n i m m n i m mm m m
m p
ddx L L dxdx dt
dLdxu L dx uL L uL Ldx dx
![Page 6: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/6.jpg)
6
Simplify, simplify• Starting with:
• We define two matrices:
1
1
1
1
1
1
1
1
nm n m
nm n m
n m
n m
dxM L x L x dxdx
dx dD L x L x dxdx dx
dx dx dL x L x dxdx dx dx
dL x L x dxdx
,
1,
0 1
1
, 1, ,0 0 01
Find 0,..., such that
1 1 1 1
i m
m pi m
n mm
m p m p m pm
n i m n i m m n i m mm m m
m p
ddx L L dxdx dt
dLdxu L dx uL L uL Ldx dx
![Page 7: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/7.jpg)
7
Then:
,
1,
0 1
1
, 1, ,0 0 01
Find 0,..., such that
1 1 1 1
i m
m pi m
n mm
m p m p m pm
n i m n i m m n i m mm m m
m p
ddx L L dxdx dt
dLdxu L dx uL L uL Ldx dx
,
,, 1, ,
0 0 0 0
Find 0,..., such that
1 1 1 1
i m
m p m p m p m pi m
nm nm i m n i m m n i m mm m m m
m p
dM u D uL L uL L
dt
Becomes:
![Page 8: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/8.jpg)
8
Questions• This raises the following questions how can
we compute Mnm and Dnm
• We will need some of the following results.
![Page 9: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/9.jpg)
9
The Legendre Polynomials(used to discretize Pp)
• Let’s introduce the Legendre polynomials.
• The Legendre polynomials are defined as eigenfunctions of the singular Sturm-Liouville problem:
, 0,1,...mL x m
1 1 ( 1) 0mm
d dLx x x m m L xdx dx
![Page 10: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/10.jpg)
10
Closed Form Formula for Lm
• If we choose Lm(1) =1 then:
• Examples:
• Warning: this is not a stable way to compute the value of a Legendre polynomial (unstable as m increases)
( / 2)
2
0
2 21 12
l floor ml m l
m ml
m m lL x x
l m
0
0 11
20 12 0
2 2
1
1 21 10 12
2 4 2 21 3 11 10 2 1 22 2
L x
L x x x
xL x x x
![Page 11: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/11.jpg)
11
Stable Formula for Computing Lm • We can also use the following recurrence
relation to compute Lm
• Starting with L0=1 L1=x we obtain:
• This is a more stable way to compute the Legendre polynomials at some x.
1 12 1
1 1m m mm mL x xL x L xm m
22 1 0
3 1 1 3 12 2 2
L x xL x L x x
![Page 12: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/12.jpg)
12
The Rodriguez Formula• We can also obtain the m’th order Legendre
polynomial using the Rodriguez formula:
21 12 !
m m
m m m
dL x xm dx
![Page 13: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/13.jpg)
13
Orthogonality of the Legendre Polynomials
• The Legendre polynomials are orthogonal to each other:
• Since 2m < m+p
11 2 2
11
1 2 2
1
1 11 2 21 11
1 2 2
1
1 11 12 ! 2 !
1 1 1 12 ! 2 !
1 1 1 12 ! 2 !
1 11 1 12 ! 2 !
0
p mp m
p m p p m m
p mp m
p m p m
p mp m
p m p m
m pp mp
p m m p
d dL x L x dx x x dxp dx m dx
d dx x dxp m dx dx
d dx x dxp m dx dx
dx x dxp m dx
![Page 14: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/14.jpg)
14
Miscellaneous Relations
m
12
1
1, -1 x 1
L 1 1
1, -1 x 1
21
1 12
22 1
m
m
m
mm
m
L x
m mdL xdx
m mdLdx
L x dxm
![Page 15: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/15.jpg)
15
Differentiation• Suppose we have a Legendre expansion for
the density in a cell:
• We can find the coefficients of the Legendre expansion for the derivative of the function as:
where:
,0
m p
i i m mm
L x
(1),
0
m pi
i m mm
d x L xdx
(1), ,
1 odd
2 1j p
i m i jj mj m
m
![Page 16: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/16.jpg)
16
Coefficient Differentiation Matrix
(1), ,
11 odd
(1), ,
01
(1)
1
2 2 1
(2 1) if j>m and j+m oddˆ 0 otherwise
2 ˆ
2 ˆor in matrix-vector notation
j p
i m i jj mi ij m
mj
j p
i m mj i jji i
i ii i
mx x
mD
Dx x
x x
ρ Dρ
i.e. if we create a vector of the Legendre coefficients for rho in the I’th cell then we can compute the Legendre coefficients of the derivative of rho in the I’th cell by pre-multiplying the vector of coefficients with the matrix:
1
2 ˆi ix x
D
![Page 17: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/17.jpg)
17
The D Matrix• We can use a simple trick to compute D
• Recall:
• We use:
1
1
1
1
nm n m
nm n m
dxM L x L x dxdx
dx dD L x L x dxdx dx
1
1
1
1
1
1
0
simple change of variables
ˆ
2 ˆ2 1
nm n m
n m
n m
j p
nj jmj
nm
dx dD L x L x dxdx dx
dx dx dL x L x dxdx dx dx
dL x L x dxdx
M D
Dn
![Page 18: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/18.jpg)
18
The Vandermonde Matrix• It will be convenient for future applications to be able
to transform between data at a set of nodes and the Legendre coefficients of the p’th order polynomial which interpolates the data at these nodes.
• Consider the I’th cell again, but imagine that there are p+1 nodes in that cell then we have:
• Notice that the Vandermonde matrix defined by is square and we can obtain the coefficients by multiplying both sides by the inverse of V
,0
n=0,...,pm p
i n i m m nm
x L x
nm m nV L x
1, ,
0 0
m p n p
i n nm i m i m i nmnm n
x V V x
![Page 19: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/19.jpg)
19
Vandermonde• Reiterate:
– that the inverse of the Vandermonde matrix is very useful for transforming nodal data to Legendre coefficients
– that the Vandermonde matrix is very useful for transforming Legendre coefficients to nodal data
![Page 20: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/20.jpg)
20
Results So Far• 0<=n,j,m<=p
11
1
1
1
1
0 (n )2
2 n=m = 2 2 1
0 (n m)
(2 1) if j>m and j+m oddˆ 0 otherwise
2 ˆ2 1
i inm n m
i i
mj
mnm n
nm
nm m n
x xM L x L x dx m
x xn
mD
dLD L x x dxdx
Dn
V L x
Mass matrix:
Coeff. Differentiation
Stiffness matrix
Vandermonde matrix
![Page 21: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/21.jpg)
21
Homework 3Q1) Code up a function (LEGENDRE) which
takes a vector x and m as arguments and computes the m’th order Legendre polynomial at x using the stable recurrence relation.
Q2) Create a function (LEGdiff) which takes p as argument and returns the coefficient differentiation matrix D
Q3) Create a function (LEGmass) which takes p as argument and returns the mass matrix M
![Page 22: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/22.jpg)
22
Homework 3 contQ4) Create a function LEGvdm which returns the following matrix:
Q5) Test them with the following matlab routine:
0 i,j pij j iV L x
3) Compute the Chebychev nodes
4) Build the Vandermonde matrix using theChebychev nodes and Legendre polynomials
7) Build the coefficient differentiation matrix
9) Build the Legendre mass matrix
12) Evaluate x^m at the Chebychev nodes
14) Compute the Legendre coefficients
16) Multiply by Dhat (i.e. differentiate in coeff space)
18) Evaluate at the nodes
20) Compute the error in the derivative
![Page 23: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/23.jpg)
23
Homework 3 contQ5cont) Explain the output from this test case
![Page 24: MA557/MA578/CS557 Lecture 8](https://reader035.vdocument.in/reader035/viewer/2022062323/56816784550346895ddc9921/html5/thumbnails/24.jpg)
24
Next Lecture (9)• We will put everything together to build a 1D
DG scheme for advection…