ma557/ma578/cs557 lecture 19
DESCRIPTION
MA557/MA578/CS557 Lecture 19. Spring 2003 Prof. Tim Warburton [email protected]. Advection-Diffusion Equation. DG Scheme for the Scalar ADE (Lax-Friedrichs flux – equivalent to upwind). DG Derivative Operator. - PowerPoint PPT PresentationTRANSCRIPT
![Page 2: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/2.jpg)
2
Advection-Diffusion Equation
2
2C C C
u Dt x x
![Page 3: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/3.jpg)
3
DG Scheme for the Scalar ADE(Lax-Friedrichs flux – equivalent to upwind)
2
2
C C Cu D
t x x
1
1 1 1 1 1
1 1 1 1
1
, : , ,
, ,
,
+ 2 2
+2 2
,
j
j
j
j
j
j j
x
Ix
j j j j j j
I
j j j j j j j j
j j
j jII
I
j j
f g f x t g x t dx
C x C x C x C xCq
Cux
u u u ux C x C x x C x C x
x xx
C
t
1 1 1 1
1
, +
2 2j
j j j j j j j j
j jI
q x q x q x q xqD x D x Dx
![Page 4: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/4.jpg)
4
DG Derivative Operator• We are going to introduce a DG derivative operator to simplify
the scheme definition.
• The linear operator Dtilde is such that the following holds for all intervals Ij
• With the choice of penalty terms tauL and tauR to be determined.
,
1 1 1 1
1
, :
, +
2 2
L Rj
j
I
j j j j j j j j
L j R jI
D C
C x C x C x C xCx x
x
![Page 5: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/5.jpg)
5
In Operator Notation
1,1
,2 2
1,1,
, ,
,,
j j
jj
ju u u u
u u
I
I
I
I
I
u D
q D C
CqC D D
t
Advectionterm
(Lax-Friedrichs flux ~ upwind flux
for scalar case)
Diffusionterm
![Page 6: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/6.jpg)
6
General Dtilde Operator
• We previously defined Dtilde for the special case where the test function is compactly supported on the j’th cell.
• We generalize by:
, : ,,
1 1 11 1 1 2
1
+1 2
CD C
x IL R I jj
C x C xj j j j
x xL j j j j
C x C xj j j j
x xR j j j j
![Page 7: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/7.jpg)
7
Skew-symmetry of Dtilde1,1
1,1
1,
1 1 1 1 1 12
1 +
12
,
1
D C x x C x C xj j j j j j j jI
j
x x C x C xj j j j j
C
j
j
x I
j j
1
1 1 1 1 1 12
1 +
2
,1 1
x x C x C xj
C x C x x C xj j j j j j
j j j j j j j
x
j j
j j
x Ij
11 1 1 1 1 12
1
1
1
,
2
1
x x C x C xj
x C x C xj j j j j j
j j j j j j j
x x C x Cj j j j j j
Cx I
j
j
1,1
1
,j
x
D CI
j
[integrate by parts]
![Page 8: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/8.jpg)
8
Skew-symmetry
• Note:
the negative sign when the operator moves.
• Trivially:
1,1 1,1, ,D CIj
D CIj
1,1 1,1 1,1 1,1,, D D C DI
D CIjj
![Page 9: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/9.jpg)
9
Recap• We already proved that the DG scheme, with
Lax-Friedrichs fluxes, for advection (D=0) is stable in the sense that :
• Adding the diffusion term (dropping boundary terms) gives:
• In terms of norms:
11 1 2
21
1 1
, , some boundary termsj
j
xj N j N
j j j j jj jx
dC dx u C x t C x t
dt
1 11 1 12 22
1 1,11 1 1
1, ,
2 2
j j
j j
x xj N j N j N
j j j j j jj j jx x
udC dx C x t C x t D D C dx
dt
2 2
1 2 22
1 1,11
1, ,
2 2
j N
j j j jL Lj
udC C x t C x t D D C
dt
![Page 10: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/10.jpg)
10
Stability!!
• Assuming D>=0 (reasonable since particles do not jump randomly with negative rates)
2 2
1 2 22
1 1,11
1, ,
2 2
0
j N
j j j jL Lj
udC C x t C x t D D C
dt
![Page 11: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/11.jpg)
11
D operator
• If we move to the Legendre basis we can write down a discrete description of Dtilde:
, 1 11
[ 1,1]
[ 1,1]
2:
,
,
1 1 , 1 1
1 1 , 1 1
L R j j L j L j R j R jj j
n m
mnm n
nm n m nm n m
nm n m nm n m
x x
L L
LL
x
L L L L
L L L L
1D C M DC GC FC HC JC
M
D
G F
H J
![Page 12: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/12.jpg)
12
Implementation of Dtildefunction [dfdx] = LEGdgderiv(f, nodex, tauL, tauR, D, F, G, H, J)
[p,N] = size(f); % p = maximum polynomial order p=p-1; % N = number of nodes N=N+1;
% space for derivative dfdx = zeros(p+1,N-1);
% cells 2 to N-2 ids = (2:N-2); dfdx(:,ids) = (D*f(:,ids) + tauL*F*f(:,ids) + tauL*G*f(:,ids-1) + tauR*H*f(:,ids) + tauR*J*f(:,ids+1));
% cell 1 (periodicity assumed) dfdx(:,1) = (D*f(:,1) + tauL*F*f(:,1) + tauL*G*f(:,N-1) + tauR*H*f(:,1) + tauR*J*f(:,2));
% cell N-1 (periodicity assumed) dfdx(:,N-1) = (D*f(:,N-1) + tauL*F*f(:,N-1) + tauL*G*f(:,N-2) + tauR*H*f(:,N-1) + tauR*J*f(:,1));
% apply chain rule for physical cell width dx = nodex(2:N)-nodex(1:N-1); coeff = ones(p+1,1)*(2./dx); dfdx = dfdx.*coeff;
![Page 13: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/13.jpg)
13
In Action (advection eqn)% TIME STEPPING
tauL = (1/u)*(u+abs(u))/2;tauR = (1/u)*(u-abs(u))/2;
for tstep = 1:Ntsteps
sigma = rho;
for rkstage = 3:-1:1 dsigmadx = LEGdgderiv(sigma, nodex, tauL, tauR, D, F, G, H, J); sigma = rho + (dt/rkstage)*(-u*dsigmadx); end
rho = sigma;
if ( ~mod(tstep, 100) ) q = V*rho;
% plot(x(:),abs(q(:)-exp(-(x(:)-dt*tstep).^2))); plot(x,q); pause(0.1);
tstep*dt endend
![Page 14: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/14.jpg)
14
Discrete Scheme
• Step 1: q = x DG derivative of C
• Step 2: time rate of change of C
1,1
1,1,
2 2
ju u u u
j j
jj
u u
u Dd
dt
q D
CC
D qD
C
Advectionterm
(Lax-Friedrichs flux ~ upwind flux
for scalar case)
Diffusionterm
![Page 15: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/15.jpg)
15
Dropping q• We can do away with q:
• This should make the following observation clear. The dt dependence for stability is now:
• The first term is due to the spectral radius of the advection operator.
• The second term is due to the spectral radius of the diffusion operator.
,
2
1
2
, ,111ju u u u
u u
jjDu
d
dt
C
DC CDD
1
2
42 2min ,Dh
cdtuh
cp p
![Page 16: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/16.jpg)
16
In Action (ADE)% TIME STEPPING
for tstep = 1:Ntsteps
sigma = rho;
for rkstage = p:-1:1 % advection: upwind bias on flux terms dsigmadx = LEGdgderiv(sigma, nodex, tauL, tauR, D, F, G, H, J); % diffusion: centered fluxes dsdx = LEGdgderiv(sigma, nodex, 1, 1, D, F, G, H, J); d2sdx2 = LEGdgderiv(dsdx, nodex, 1, 1, D, F, G, H, J);
sigma = rho + (dt/rkstage)*(-u*dsigmadx+Dcoeff*d2sdx2); end
rho = sigma;
if ( ~mod(tstep, 400) ) q = V*rho; plot(x,q); axis([xmin xmax 0 1]) pause(0.1); endend
![Page 17: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/17.jpg)
17
Downloads
• You can download the Dtilde based scripts from:
• http://www.math.unm.edu/~timwar/MA578S03/MatlabScripts/LEGadvectionLaxF.m
• http://www.math.unm.edu/~timwar/MA578S03/MatlabScripts/LEGade.m
![Page 18: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/18.jpg)
18
Legendre Scheme To Lagrange Scheme(modal to nodal)
• So far we have used Legendre expansions to represent the solution in each cell.
• This representation causes some problems if we wish to evaluate non-linear function of the solution.
• For instance solving the inviscid Burger’s equation:
requires the evaluation of u2
2
02
u u
t x
![Page 19: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/19.jpg)
19
Transforming the Modal Advection Scheme
• Recall that given a Legendre expansion we may evaluate it at a set of points by:
• We substitute: into the scheme:
,
2 2
ju u u u
u u
jd
du
t
D
CC
,
,0
,0
:
where
j n j n
m p
j m m nm
m p
nm j mm
nm m n
c C x
C L x
C
L x
V
V
1, ,
0
C = m p
j m j nmnm
c
V
,
2 2
u u u ju
u u
jd
dtu
1
1V cVD c
![Page 20: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/20.jpg)
20
Nodal Scheme
• Multiplying both sides on the left with V
• This clearly shows that the nodal scheme is a change of basis away from the modal scheme.
,2 2
,2 2
jj
j
u u u u
u u
u u u u
u u
j
d
dt
d
dt
u
u
11
1
V cV c
c
D
V cDV
![Page 21: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/21.jpg)
21
Summary of Nodal Scheme
1
,2 2
1 1,
2 2
[ 1,1]
[ 1,1]
,
,
1 1
where
, 1 1
1 1 ,
:
2
u u u u
u u
j L j L j R j R ju u u u
u u
n m
mnm n
nm n m nm n m
n
j
jj
m m
j
j
n
u
L L
LL
x
L L L L
L
d
dt
x x
L
1
1
1 1
cV V c
V V c V
D
D M DC GC FC HC JC
M
D
G F
H
V
1 1nm n mL L J
Note: we do not need to transform the initial condition or solution for visualization…
![Page 22: MA557/MA578/CS557 Lecture 19](https://reader035.vdocument.in/reader035/viewer/2022062723/56813f55550346895daa1cce/html5/thumbnails/22.jpg)
22
Next Lecture
1) The lecture on Friday 03/07 is cancelled in favour of the Analysis Conference
2) The lecture on Monday 03/10 will be the first time we generalize the DG to two spatial dimensions.
3) Do not miss the Monday lecture
4) Run the LEGade.m script (you will need the LEGdgderiv.m script as well)
5) How to use nodal methods in general.