• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
WENO-based first and second centered derivatives
This document derives the coefficients necessary to implement WENO-based derivatives following ideas from thefollowing papers:1. Jiang and Peng, “Weighted ENO schemes for Hamilton--Jacobit Equations”, SIAM J. Sci. Comput. 20002. Shu, “High order weighted essentially nonoscillatory schemes for convection dominated problems”, SIAM Review20093. Martin, Taylor, Wu, and Weirs, “A bandwidth-optimized WENO scheme for the effective direct numerical simula-tion of compressible turbulence”, J. Comput. Phys 2006Note that the order-of-accuracy of these schemes is optimized, not their bandwidth.
Initialization
Build a list of uniform gridpoints with spacing
x and function values
 f 
i
. Use that list to build the
 j
th
interpolatingpolynomial for
 j
1,...,
.
In[1]:=
StencilPoints
r_
:
Table

i
x, u
i
,
i,
r
1
,
r
1

SubstencilPoints
r_, j_
:
Take
StencilPoints
r
,
j, j
r
1

StencilPolynomial
r_, j_
:
Collect
InterpolatingPolynomial
SubstencilPoints
r, j
, x
, u
 _
, Simplify
Check these functions will return the three expected interpolant values at
x/2 for the r = 3 case from Shu’s 2009SIAM Review paper equations (2.1), (2.2), and (2.3).
In[4]:=
StencilPoints
3
Table
StencilPolynomial
3, j
,
j, 3
 
. x
x2

Expand

MatrixForm 
Out[4]=

2
x, u
2
,
x, u
1
,
0, u
0
,
x, u
1
,
2
x, u
2

Out[5]//MatrixForm=
3 u
2
8
5 u
1
4
15 u
0
8
u
1
8
3 u
0
4
3 u
1
83 u
0
8
3 u
1
4
u
2
8
Compute smoothness indicators following Shu 2009 equation (2.8). These smoothness indicators were originallyproposed in Jiang and Shu JCP 1996 and will likely not match those used for flux reconstruction from earlier papers.
In[6]:=
StencilSmoothness
r_, j_
:
Together
Expand
Sum 
x
2 d
1
Integrate
D
StencilPolynomial
r, j
,
x, d

2
,
x,
x2,
x2

,
d, r
1

Check smoothness indicators against the result from Shu 2009 equation (2.9).
 
In[7]:=
StencilSmoothness
3, 1
StencilSmoothness
3, 2
StencilSmoothness
3, 3
Out[7]=
13
4 u
22
19 u
2
u
1
25 u
12
11 u
2
u
0
31 u
1
u
0
10 u
02
Out[8]=
13
4 u
12
13 u
1
u
0
13 u
02
5 u
1
u
1
13 u
0
u
1
4 u
12
Out[9]=
13
10 u
02
31 u
0
u
1
25 u
12
11 u
0
u
2
19 u
1
u
2
4 u
22
Using a Horner factorization of the smoothness indicators may provide a cleaner (and possibly more performant)representation when r > 3.
In[10]:=
SmoothnessFactor
r_, A_
:
Map
Together, HornerForm 
 A, Last
Transpose
StencilPoints
r

The optimal, full-width stencil (in terms of order of accuracy) for a given derivative at x=0 is
In[11]:=
Optimal
r_, d_
:
D
InterpolatingPolynomial
StencilPoints
r
, x
,
x, d
 
. x
0

Together
The stencil-by-stencil contributions for a given derivative at x = 0 are
In[12]:=
Contributions
r_, d_
:
D
Table
StencilPolynomial
r, j
,
j, r

,
x, d
 
. x
0

Together
The linear weights must satisfy these constraints resulting from combining the stencil-by-stencil contributions to matchthe optimal result.
In[13]:=
LinearWeights
r_, d_
:
Quiet
 With

Γ
Table
Γ
j
,
j, r

,Solve

Γ
.Contributions
r, d
Optimal
r, d
,Total
Γ
1
,
Γ
, Reals
 
. Rule
Equal
We will need to extract tables of coefficients of 
u
i
.
In[14]:=
CoefficientTable
r_, A_
:
Table
Coefficient
 A, u
i
,
i,
r
1
,
r
1

We will want to perform linear solves on these tables of coefficients.
In[15]:=
LinearSolveWeights
r_, d_
:
LinearSolve
CoefficientTable
r, Contributions
r, d

, CoefficientTable
r, Optimal
r, d

Nonlinear weights should be computed in the usual WENO manner from these linear weights following Shu 2009equation (2.10).
3-point WENO derivative stencil
In[16]:=
r
2;
First derivative
Display the optimal 3-point stencil coefficients for the derivative, the 2-point substencil coefficients, and the linearweights necessary to recover the maximum order of accuracy.
2
 
WENO Centered Derivatives.nb
 
In[17]:=
d
1;o
r, d
Optimal
r, d
s
r, d
Contributions
r, d
w
r, d
LinearWeights
r, d
Out[18]=
u
1
u
1
2
x
Out[19]=
u
1
u
0
x,
u
0
u
1
x
Out[20]=

Γ
1
12,
Γ
2
12

Second derivative
The r=2 case only has a trivial second derivative.
Smoothness indicators
In[21]:=
Table
StencilSmoothness
r, j
,
j, r
 
Simplify

MatrixForm 
Out[21]//MatrixForm=
u
1
u
0
2
u
0
u
1
2
5-point WENO derivative stencils
In[22]:=
r
3;
First derivative
In[23]:=
d
1;
Display the optimal 5-point stencil coefficients for the derivative, the 3-point substencil coefficients, and the linearweights necessary to recover the maximum order of accuracy.
In[24]:=
o
r, d
Optimal
r, d
s
r, d
Contributions
r, d
w
r, d
LinearWeights
r, d
Out[24]=
u
2
8 u
1
8 u
1
u
2
12
x
Out[25]=
u
2
4 u
1
3 u
0
2
x,
u
1
u
1
2
x,
3 u
0
4 u
1
u
2
2
x
Out[26]=

Γ
1
1
Γ
2
5 u
2
16 u
1
18 u
0
8 u
1
u
2
6 u
2
Γ
2
18 u
1
Γ
2
18 u
0
Γ
2
6 u
1
Γ
2
6 u
2
24 u
1
36 u
0
24 u
1
6 u
2
,
Γ
3
5 u
2
16 u
1
18 u
0
8 u
1
u
2
6 u
2
Γ
2
18 u
1
Γ
2
18 u
0
Γ
2
6 u
1
Γ
2
6 u
2
24 u
1
36 u
0
24 u
1
6 u
2

Brute forcing the solve for the linear weights is less fruitful in the r = 3 case. Extract the various coefficients andperform a linear solve.
WENO Centered Derivatives.nb
3
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...