Content uploaded by Andrea D. Beck
Author content
All content in this area was uploaded by Andrea D. Beck on Mar 16, 2021
Content may be subject to copyright.
preprint manuscript No.
(will be inserted by the editor)
A p-adaptive discontinuous Galerkin method with
hp-shock capturing
Pascal Mossier ·Andrea Beck
·Claus-Dieter Munz
Received: date / Accepted: date
Abstract In this work, we present a novel hybrid Discontinuous Galerkin
scheme with hp-adaptivity capabilities for the compressible Euler equations.
In smooth regions, an ecient and accurate discretization is achieved via lo-
cal p-adaptation. At strong discontinuities and shocks, a nite volume scheme
on an h-rened element-local subgrid gives robustness. Thus, we obtain a hp-
adaptive scheme that exploits both the high convergence rate and eciency
of a p-adaptive high order scheme as well as the stable and accurate shock
capturing abilities of a low order nite volume scheme, but avoids the inher-
ent resolution loss through h-renement. A single a priori indicator, based
on the modal decay of the local polynomial solution representation, is used
to distinguish between discontinuous and smooth regions and control the p-
renement. Our method is implemented as an extension to the open source
software FLEXI1. Hence, the ecient implementation of the method for high
performance computers was an important criterion during the development.
The eciency of our adaptive scheme is demonstrated for a variety of test
cases, where results are compared against non adaptive simulations. Our nd-
ings suggest that the proposed adaptive method produces comparable or even
better results with signicantly less computational costs.
Keywords Discontinuous Galerkin ·high order schemes ·p-adaptivity ·
shock capturing ·h-renement
Pascal Mossier
Pfaenwaldring 21
70569 Stuttgart
Deutschland
Tel.: +49 711 685-63421
E-mail: pascal.mossier@iag.uni-stuttgart.de
1www.exi-project.org, GNU GPL v3.0
2 Pascal Mossier et al.
1 Introduction
The stable and accurate simulation of transsonic and supersonic ow phe-
nomena, that are encountered at high speed ight conditions, is a demanding
task for the computational uid dynamics community. The challenge, posed
by the described ow conditions, is due to the presence of both regions with
smooth and discontinuous solutions. Hence, a numerical approximation has
to be able to capture shock waves, strong velocity gradients and shear layers,
where uid properties change sharply, as well as smooth laminar or turbu-
lent ow. Due to their low approximation errors and favorable scale resolving
capabilities, high order methods are currently objects of research and devel-
opment. In particular, the discontinuous Galerkin (DG) method is well suited
for practical applications since it features an element local polynomial solution
representation that is only coupled by numerical uxes. This makes it highly
parallelizable and ecient for high-performance computing. The discretization
error eof a polynomial approximation of degree p−1can be roughly estimated
as e≈khp, with the constant kdepending on the solution regularity and the
element size h. In regions of smooth ow, the high order discretization can
prot from an exponential convergence rate with the exponent p. However, in
regions with strong gradients or under-resolved regions, these schemes suer
from spurious oscillations, called the Gibb’s instability, that causes stability
issues and a loss of accuracy. There exist dierent strategies to capture shocks
and discontinuities. One approach is to smooth out shocks and strong gradi-
ents in the solution with articial viscosity by locally applying an additional
dissipation term, originally proposed by von Neumann and Richtmyer in [17].
Persson and Peraire [20] adapted this to high order discontinuous Galerkin
methods to eliminate the high frequencies without widening the shock over
a couple of cells. In a recent article, Zeifang et al. [30] used a smoothness
indicator, based on articial neural networks [2], to control the amount of ar-
ticial viscosity. Another approach is the application of limiting techniques
such as those applied to the nite volume (FV) approach, adapted to the DG
formulation. Qiu and Shu [21] combined the DG method with a weighted es-
sentially non-oscillatory (WENO) limiting in [21] and more recently by Zhu et
al. in [31]. A third approach is to change the discretization operator around a
shock wave to a nite volume scheme. Dumbser et al. combined an ADER-DG
scheme with an ADER-FV WENO approach, applied to nite volume sub-
cells, see [5]. A variant is to decrease locally the order of accuracy while the
loss of accuracy is remedied by local mesh renement (h-renement). This was
applied in the work of Huerta et al. [8] and Persson et al. [19] by introduc-
ing piecewise constant ansatz functions and subdividing the DG element into
sub-cells. A similar strategy, presented in [13], is called rp-renement, where
the mesh renement is achieved by deforming the mesh and clustering DOFs
around shocks, rather than rening the mesh though subdivision of elements.
Both, hp- and rp-renement have the common strategy of locally reducing the
polynomial degree and increasing the mesh resolution to resolve shocks and
discontinuities accurately. In this paper we employ a concept based on the work
A p-adaptive discontinuous Galerkin method with hp-shock capturing 3
of Sonntag and Munz [25] that follows the same idea. A DG element contain-
ing shocks or strong gradients is subdivided into FV sub-cells that represent
the solution with a stable second order FV-scheme. Low order FV schemes
are well suited for shock capturing but suer from a high discretization error.
Therefore a ner sub-cell grid is used to compensate for the loss of accuracy.
The combination of a high order DG method with a FV sub-cell scheme pro-
vides a stable numerical framework to resolve both smooth and discontinuous
regions encountered in the transsonic and supersonic ow phenomena consid-
ered in this paper. The goal of this work is to provide an adaptive strategy
for the hybrid DG and FV sub-cell approach, to improve the accuracy and
reduce the computational cost. A common renement strategy is adaptive
mesh renement, or h-renement. Its usefulness has been demonstrated in [7,
9,22], where h-renement techniques were successfully applied to high order
DG methods to solve the compressible Euler equations. A method, well suited
for high order schemes, is p-renement, where adaptivity is achieved through a
variable ansatz degree. P-adaptive DG methods have been investigated in [16,
1,3]. Since Li and Jameson showed in [12], that h-renement produces better
results at ow discontinuities while p-renement is more ecient in smooth
regions we decide to use booth techniques for our hybrid DG/FV scheme.
In smooth regions, where the DG scheme is stable, adaptive p-renement is
applied by locally increasing and decreasing the polynomial degree. In the
vicinity of shocks and discontinuities, the low order FV discretization is ap-
plied to a sub-cell grid of FV cells. In contrast to the scheme proposed by
Sonntag and Munz [25], the FV resolution can be chosen independently of the
DG method, allowing to increasing the local number of DOFs per element at
shocks. The resulting scheme combines the advantages of high order schemes
and p-adaptivity in smooth regions, with the robustness and accuracy of FV
schemes with h-renement for shock capturing. To switch between the two
schemes, an indicator, based on the modal decay of the polynomial solution
representation, proposed by Mavriplis [14] is used. Based on the modal decay
rate, oscillations of the local solution polynomials within an element can be de-
tected. Additionally, the modal decay rate inside an element provides an error
estimate to chose the local polynomial degree of the DG elements. This paper
is organized as follows. In Section 2, the governing equations are introduced.
In Section 3, we outline the DG discretization and the p-renement technique,
used in smooth regions. The FV sub-cell scheme, used for shock capturing, is
introduced in Section 4. In Section 5 we briey discuss the chosen indicator for
FV sub-cell limiting and p-renement. In Section 6, the hp-adaptive method
is assembled from the building blocks and the implementation is outlined. Fi-
nally, in Section 7 we present and discuss numerical examples to validate the
method and demonstrated its superior computational eciency when com-
pared to uniformly rened computations.
4 Pascal Mossier et al.
2 Governing equations
In this work, we consider the Euler equations as the model for an inviscid
compressible uid ow in a computational domain Ωwith the boundary Γ=
∂Ω on a nite time interval (0, T ]. They can be written in the conservation
form: ∂u
∂t +∇x·F(u) = 0in Ω ×(0, T ].(1)
Here, [ρ, ρv, E]denotes the transposed vector of conserved variables uwith
density ρ, velocity vector v, and total energy Eper unit volume. The vector
Fis the convective ux and is written in components as F= [ρv, ρv×v+
pI,v(E+p)]. To compute the pressure pand to close the system, the equation
of state of a perfect gas is assumed, given by
p(ρ, ρv, E):= (γ−1)(E−1
2ρkvk2
2)(2)
with the isentropic expansion coecient γ= 1.4. The equation system is
subjected to initial conditions, dened as u(x,0) = u0(x), and appropriate
boundary conditions, dened as u(xΓ, t) = uΓ(xΓ, t)for the spatial coordi-
nate vector xΓ∈Γ. The boundary conditions are specied for the presented
test cases in Section 8.
3 P-adaptive Discontinuous Galerkin discretization
In this section, a p-adaptive high order approximation for the Euler equations,
based on the Discontinuous Galerkin Spectral Element Method (DGSEM), is
outlined. The DGSEM is a computationally ecient DG variant that exhibits
the basis functions in a tensor basis structure, described in detail in [10] and
our version in [11].
3.1 Spatial discontinuous Galerkin discretization
Equation (1) is approximated by DGSEM for an arbitrary approximation order
Non a computational domain Ω∈R3that is subdivided into K∈Nnon
overlapping hexahedral elements Ωe, so that Ω=SK
e=1 Ωeand TK
e=1 Ωe=∅
are valid. We apply a transformation from physical space x= (x1, x2, x3)T
to reference space ξ= (ξ1, ξ2, ξ3)Tand map a physical element Ωeto the
reference element E:= [−1,1]3. The transformed equation (1) can be written
as
J∂u
∂t +∇ξ·F(u) = 0(3)
with the ux Fin reference space, called contravariant ux, and the Jacobian
determinant Jof the mapping. Subsequently, the weak form is obtained by
projection onto the test space spanned by φ∈P:
ZE
(J∂u
∂t )φdΩ +ZE
(∇ξ·F)φdΩ (4)
A p-adaptive discontinuous Galerkin method with hp-shock capturing 5
Integration by parts yields
ZE
(J∂u
∂t )φdΩ +I∂ E
(F·nξ)φdSξ−ZE
(F· ∇ξ)φdΩ =0(5)
with the unit normal vector nξand the surface of the reference element Sξ.
Since discontinuities are allowed across element interfaces, the term F·nξis
not unique at the interface and is approximated by a numerical ux (F·nξ)∗.
The element local solution and the contravariant ux are both approximated
as
u(ξ, t)≈
N
X
i,j,k=0
ˆ
uijk (t)ψijk (ξ),(6)
F(ξ, t)≈
N
X
i,j,k=0
Fijk (ˆ
uijk )ψijk (ξ)(7)
in the space spanned by tensor products of one-dimensional Lagrange polyno-
mials of degree N:
ψijk (ξ) = `i(ξ1)`j(ξ2)`k(ξ3)(8)
and with the degrees of freedom (DOFs) ˆ
uijk . Following Galerkin’s idea, we use
the same polynomials for the basis functions ψand the test functions φ. The
node distribution for the one-dimensional Lagrange polynomials is dened by
the Legendre-Gauss nodes of the reference element in every direction. If these
points are also used for the numerical quadrature, we obtain a semi discrete DG
operator with a tensor product structure and a reduced number of required
operations per degree of freedom. Due to the tensor product structure, the
DG operator can be split into one-dimensional operations that are applied
for every direction of the reference element separately. The total number of
degrees of freedom per variable for an element of order Nin dspace dimensions
corresponds to (N+ 1)d. The node distribution is illustrated in Fig. 1 for
the two- dimensional case and two elements with dierent local polynomial
degrees. For a more detailed derivation of the DGSEM operator, which is used
in the code framework, the reader is referred to [11].
3.2 Coupling of DG elements with variable order
To construct a p-adaptive DGSEM scheme, interfaces between elements with
varying polynomial degrees have to be considered. Since coupling is achieved
trough the numerical ux, the ux computation has to be adapted to allow
for dierent degrees among adjacent elements. Furthermore, switching of the
element local degree requires a transformation of the elements solution repre-
sentation between dierent polynomial degrees. Without loss of generality, the
transformation formula can be derived for the one-dimensional case, due to the
tensor basis structure. A transformation of the element local volume or sur-
face solution from a degree Nto a degree Mwith N < M can be achieved by
6 Pascal Mossier et al.
u−
N
u−
N7→ u−
M
F∗
M7→ F∗
N
0
ξ1
ξ2
u−
Mu+
M
0
ξ1
ξ2
Fig. 1 Node distribution inside two-dimensional reference elements with degrees N= 3
(left) and M= 4 (right) indicated by dots and surface node distributions u−
Nand u+
M
indicated by squares for the computation of the numerical ux F∗
Mbetween adjacent el-
ements. For the ux computation, the surface node distribution u−
Nis transformed to the
representation of the higher order element u−
M.
interpolating the solution polynomial at the new node positions of degree M.
In the case of N > M , a conservative transformation is obtained by projecting
the given polynomial of degree Nto a polynomial of degree M. We achieve
this projection through a modal cut-o ltering and subsequent interpolation.
Therefore the solution representation uNof degree Nis rst transformed to
a modal Legendre basis representation uN
Leg with the Vandermonde matrix
V dmN
Leg:
V dmN
LeguN=uN
Leg,uN,uN
Leg ∈RN+1.(9)
Next, a modal cuto is performed to reduce the number of modes to M:
uM
Leg =
uN
Leg(0)
.
.
.
uN
Leg(M)
,uM
Leg ∈RM+1.(10)
The transformation is completed by transforming the modal solution back to
the initial nodal Lagrange basis:
(V dmM
Leg)−1uM
Leg =uM,uM∈RM+1.(11)
The transformation can be expressed as one matrix vector operation:
uM= (V dmM
Leg)−1
1. . . 0. . . 0
.
.
.....
.
..
.
.
0. . . 1. . . 0
MxN
V dmN
LeguN,
written in short as
uM=V dmM2NuN.(12)
The numerical ux between two elements that share a common side is eval-
uated using a polynomial solution representation of the surface data of both
elements. Since the the ux is computed for every node of the polynomial
A p-adaptive discontinuous Galerkin method with hp-shock capturing 7
surface data, the number and position of the nodes has to match between
neighboring sides. In case adjacent elements do not share a common poly-
nomial degree, depicted in Fig. 1, the node distribution of the element with
the higher degree Mis used. To that purpose, the surface data with the lower
degree u+
Nis transformed to degree Mof the neighboring side, using the afore-
mentioned transformation rule. The numerical ux is then evaluated for all M
nodes u+
Mand u−
Mat the element side. The resulting ux F∗
Mcan be applied
to the element of degree Mdirectly. For the element of degree N, the ux
has to be transformed to a representation of degree N, using the introduced
projection. In pseudo code, the ux computation reads as follows
N6=M, N < M (Adjacent elements have dierent degrees)
u+
N7→ u+
M(Transform side data of degree Nto degree M)
F∗
M:= Riemann solver(u+
M,u−
M,n)(Calculate numerical ux for M
nodes)
F∗
M7→ F∗
N(Transform ux representation of degree Mto degree
N).
Altogether, the formula, presented in this section, provide all basic ingredients
for a p-adaptive discontinuous Galerkin discretization. Coupling of elements
with dierent degrees through a numerical ux computation on a common
polynomial representation was also addressed. For a more detailed derivation
of the treatment of non conforming interfaces, so called mortars [15], the reader
is referred to [4]. It should be noted, that the presented scheme does not
impose any restrictions to the degree of neighboring elements, so that every
arbitrary distribution of polynomial degrees among the elements, imposed by
an indicator is possible. In this work, we use an explicit 4 stage Runge-Kutta
scheme for numerical integration in time to obtain a fully discrete scheme.
4 An h-adaptive nite volume sub-cell discretization
In section 3, a p-adaptive DGSEM discretization for the compressible Euler
equations was outlined. This adaptive high order scheme provides good sta-
bility and accuracy in smooth regions. However, in the presence of shocks or
strong gradients within an element, the solution generates oscillations due to
the Gibbs phenomenon. To circumvent this issue, we employ a shock capturing
with nite volume sub-cells. Here, a d-dimensional DG element is subdivided
into (NF V )dsub-cells to apply the time evolution by a stable second order
FV scheme. A typical choice for the sub-cell resolution is NF V = 2N+ 1,
since this is the highest resolution that does not impose a stricter time step
restriction as the corresponding DG element of degree N. Thus we obtain a lo-
cal reduction in approximation order, but combined with an increased spatial
localization of strong gradients. In the following, we use a FV sub-cell shock
capturing scheme on a predened sub-cell mesh to achieve the favorable local
8 Pascal Mossier et al.
mesh renement properties of the hp- and rp-renement strategies, without
the need to perform remeshing or changing the number of elements in the
mesh. For a detailed derivation of the FV sub-cell scheme and its implementa-
tion in FLEXI for NF V =N+ 1 the reader is referred to the work of Sonntag
and Munz in [25,26] and Krais et al. in [11]. In the following, we derive the
spatial FV sub-cell discretization and its coupling to adjacent DG elements
for arbitrary combinations of Nand NF V .
4.1 Spatial nite volume discretization
We derive the spatial nite volume sub-cell discretization for the reference
element E, following the mapping x7→ ξintroduced in section 3. The reference
element of a local DG solution, in which shock capturing becomes necessary,
is subdivided into NF V equidistant pieces in every space dimension d. This
results in a subdivision of the reference element and is then called FV element
in this paper. Thus, the FV representation of such a troubled DG element
contains (NF V )dsub-cells. The FV sub-cell approximation on a sub-cell eijk
in reference space is given for the Euler equations (1) by
Zeijk
(JF V ∂tuF V )φdΩ +I∂ eijk
(F·nF V )φdSeijk =0(13)
with the integral mean JF V of the Jacobi determinant Jinside the sub-cell.
The term F·nF V represents the ux at the sub-cell boundaries and is ap-
proximated by a numerical ux F∗:
(F·nF V )≈F∗(uF V
L,uF V
R,nF V ).(14)
It depends on the normal vector nF V at the sub-cell interface and the sub-
cell data right and left of the interface. A piecewise linear reconstruction with
limiting is applied to get a second order total variation diminishing nite
volume scheme on these sub-cell data. In all our simulations later we used
simply the MinMod limiter [23].
4.2 Coupling of DG and FV sub-cell elements
Switching between DG and FV sub-cells as well as the ux computation at
mixed DG/FV element interfaces requires a transformation between the poly-
nomial solution representation of a DG element and a piecewise constant FV
sub-cell representation. Therefore, we seek a transformation V dmDG2F V be-
tween a DG solution representation uDG of a degree Nand a FV sub-cell
solution representation uF V with NF V sub-cells:
V dmDG2F V uDG =uF V .(15)
A p-adaptive discontinuous Galerkin method with hp-shock capturing 9
A FV sub-cell representation uF V can be obtained from the polynomial DG
solution representation uDG by piecewise projection of uDG on the NF V sub-
cells. With the piecewise constant FV sub-cell solution representation the pro-
jection can be written as the computation of the integral mean of uDG inside
each sub-cell:
ZE
udξ =
NF V
X
k=1 Z−1+kw
−1+(k−1)w
uDGdξ =
NF V
X
k=1 Z−1+kw
−1+(k−1)w
N
X
l=0
ˆ
uDG
lψl(ξ)dξ !
=
NF V
X
k=1
wˆ
uF V
k.
(16)
For NF V sub-cells, the width of a cell in reference space is given here as
w=2
NF V . Replacing the integral in equation (16) by a numerical quadrature
with quadrature weights ωmand quadrature nodes ξk
minside the sub-interval
kyields
NF V
X
k=1
N
X
m=0
N
X
l=0
ˆ
uDG
lψl(ξk
m)ωm
!
=
NF V
X
k=1
wˆ
uF V
k.(17)
For the numerical quadrature, the same nodes and weights are used as for
the spatial DGSEM discretization. Equation (17) can be rewritten in matrix
vector notation with the matrix V dmDG2F V dened as
V dmDG2F V := 1
2
N
X
m=0
ψl(ξk
m)ωm∀l= 0, .., N, ∀k= 1, .., NF V .(18)
To recover the polynomial DG representation uDG from piecewise constant
sub-cell data uF V , an inverse transformation V dmF V 2DG is required. For
NF V +1 > N, this leads to an over determined system. This can be solved with
a constrained least square approach as proposed by Dumbser and Zanotti in
[6]. Integral conservation over the DG element serves herein as the constraint.
The least square approach is equivalent to a discrete projection and is solved
by nding the pseudo inverse of V dmDG2F V . Therefore both transformations
fulll the property
V dmF V 2D G ◦V dmDG2F V =I . (19)
For two adjacent FV elements, the ux computation is straight forward and
is performed on the piecewise constant sub-cell representation. If a mixed
DG/FV interface is present, like in Fig. 2, we evaluate the ux on the sub-
cell representation. Therefore, the solution on the surface of the DG element is
transformed to a FV sub-cell representation via the matrix V dmDG2F V . Subse-
quently, the numerical ux is computed. Finally, the ux is transformed back to
the DG representation using the inverse transformation matrix V dmF V 2D G.
5 Modal decay indicator for shock detection and error estimation
An essential building block for the proposed p-adaptive DG/h-rened FV sub-
cell scheme is a suitable smoothness indicator and an error estimator. In the
10 Pascal Mossier et al.
u−
DG
u−
DG 7→ u−
F V
F∗
F V 7→ F∗
DG
0
ξ1
ξ2
u−
F V u+
F V
0
ξ1
ξ2
Fig. 2 DG reference element with degree N= 3 (left) and an adjacent DG element that is
splitted into N2
F V FV sub-cells (right). DG volume nodes respectively FV sub-cell centers
are indicated by dots. Surface nodes for the ux computation are indicated by squares. For
the ux computation, the surface node distribution u−
DG is transformed to u−
F V to match
the equidistant distribution of the FV sub-cells.
current framework, we use an a priori indicator based on the decay rate of the
modal polynomial solution representation inside an element, as proposed by
Mavriplis in [14]. In the following, the indicator is derived for an element eof
degree N. A suciently regular function u(ξ)can be represented in terms of
an innite series with the polynomial basis functions ζi(ξ)and the coecients
ˆui:
u(ξ) =
∞
X
i=0
ˆuiζi(ξ) =
N
X
i=0
ˆuiζi(ξ) +
∞
X
i=N+1
ˆuiζi(ξ).(20)
If we approximate u(ξ)with a nite series expansion up to a polynomial degree
of N, we introduce an truncation error that corresponds to the rightmost term
in equation (20). If a modal polynomial basis is used, the coecients can be
interpreted as the amplitude of the solution modes. For a suciently smooth
solution, this amplitude decays exponentially. In case of a non smooth solution,
a slower decay occurs. That way, the decay rate can be regarded as both a
measure of the truncation error as well as the smoothness of the solution.
To determine the modal decay, the nodal polynomial approximation unod is
rst transformed to a modal representation umod via the Vandermonde matrix
V dmLeg:
ˆ
umod =V dmLeg ˆ
unod.(21)
The polynomial approximation in terms of the modal coecients ˆ
umod,ijk and
the product of the one-dimensional Legendre basis functions ζ(ξ)i,j,k can we
written as
u(ξ)≈
N
X
i,j,k=0
ˆ
umod,ijk ζijk (ξ), ζijk (ξ) = λi(ξ1)λj(ξ2)λk(ξ3).(22)
We now determine the relative contribution wmof the m-th mode in ξ1direc-
tion to the solution as follows
wm=(PN
j,k=0 ˆ
umod,ijk )i=m
PN
i,j,k=0 ˆ
umod,ijk 2
.(23)
A p-adaptive discontinuous Galerkin method with hp-shock capturing 11
As a nal step, the relative modal contributions wmare tted to the expo-
nential function wm=ae−σm. This yields the modal decay rate σ1in the ξ1
direction. The decay rate is evaluated for every direction and the nal indicator
is given as the minimum of the absolute values
ind =min(|σ1|,|σ2|,|σ3|)(24)
Since the indicator is based on the assumption that the magnitude of the
modes, representing a smooth solution, decays exponentially, the decay rate
in smooth regions correlates to the approximation error. A large decay rate
indicates that the error due to the truncation of the higher modes is small
and the polynomial degree could be decreased. A small decay rate indicates
a high approximation error due to the truncation of the higher modes and
motivates to increase the local polynomial degree. In the presence of shocks or
sharp gradients, the solution tends to develop oscillations that cause a large
magnitude of the highest modest, which manifests as a very low decay rate. To
distinguish between the described scenarios, thresholds are required that are
discussed in section 7.3. The indicator can also be evaluated for FV elements,
following a transformation of the FV sub-cell solution representation to a DG
polynomial.
6 Ecient implementation of the adaptive scheme
The presented adaptive DG scheme with FV sub-cell shock capturing is imple-
mented as an extension to the FLEXI framework. FLEXIs DGSEM implemen-
tation is based on static arrays, which store the polynomial solution represen-
tation for elements, faces and uxes. An array based implementation allows for
ecient tensor operations and is well suited for a non-adaptive scheme, with a
constant global polynomial degree Nand a FV sub-cell shock capturing with
NF V =N+ 1 sub-cells, as suggested in [26]. Such a scheme prots from a
constant number of DOFs for both DG and FV elements. Therefore both the
polynomial DG solutions representation and the FV sub-cell representation
can be stored in a common array. On the other hand, a p-adaptive DG scheme
with an arbitrary FV sub-cell resolution, requires a data structure that allows
for a variable number of DOFs per element. With elements switching between
a DG or FV representation and changing their polynomial degree, the storage
requirement per element changes over time. A DG element with a local poly-
nomial degree Nrequires (N+ 1)dDOFs, a FV element with NF V sub-cells
requires NF V dDOFs.
Data of changing size are usually stored in dynamic data structures like linked
lists. However, to maintain FLEXIs static data structure, we chose an ar-
ray based approach. For every polynomial degree of a predened range N∈
[Nmin, Nmax ], arrays are allocated to store the polynomial solution represen-
tation. Following a domain decomposition, every proc is assigned a subset of
12 Pascal Mossier et al.
nElems elements with nSides sides. For an equation system with nV ar com-
ponents, volume data, like the element local solution, is stored in arrays of
size nV ar ×nElems ×(N+ 1)d. Surface data, like the solution at element
faces and the uxes are stored in arrays of size nV ar ×nSides ×(N+ 1)d−1.
The FV sub-cell solution representation is stored in a separate array of size
nV ar ×nElems ×Nd
F V for volume data and nV ar ×nSides ×Nd−1
F V for sur-
face data respectively. By providing storage space for a range of polynomial
degrees simultaneously, the memory demand for the solution representation is
increased. On the other hand, this trade o in memory eciency facilitates a
straight forward extension of FLEXI towards an adaptive extension. Indepen-
dent of the chosen data structure, a signicant increase in memory is caused
by the metric terms that have to be precomputed and stored for the range of
allowed degrees and the FV sub-cell discretization. Therefore, the increased
memory demand due to the proposed static data structure is largely shadowed
by the memory requirement of the metric terms. In practical applications, an
increased memory demand might lead to limitiations. Since the original mem-
ory footprint of the DGSEM is quite small, this limitation is not too severe
on the current architectures. An advantage of the chosen data structure is the
good single core performance, when compared to the non-adaptive open source
FLEXI, which is analyzed in more detail in subsection 8.2.
7 The hp-adaptive DGSEM scheme
For simplicity we abbreviate the scheme, which consists of a p-adaptive DG
scheme in smooth parts of the solution and a shock-capturing by a h-rened
FV scheme on sub-cells, as hp-adaptive. In this section, we explain how the
presented building blocks are assembled and discuss the free parameter of the
algorithm and how they may be chosen.
7.1 Setup of the adaptive spatial approximation
For the adaptive spatial approximation, a range of possible polynomial de-
grees N∈[Nmin, Nmax ], the degree at the start of the computation Nini and
the FV sub-cell resolution NF V are to be chosen for a simulation. Depending
on the minimum and maximum allowed polynomial degrees Nmin and Nmax,
arrays for the volume and surface solution are allocated. The volume and sur-
face solution of the FV sub-cell discretization are stored in separate arrays,
allocated for the resolution NF V . This static data structure allows for an e-
cient implementation without the need to reallocate memory during runtime.
A drawback is the increased memory consumption compared to dynamic data
structures, where only the memory needed for the element local polynomial
degree is allocated. At the start of the simulation, precomputable building
blocks like metric terms, node distributions, transformation matrices and in-
terpolation matrices are precomputed and stored for polynomial degrees inside
A p-adaptive discontinuous Galerkin method with hp-shock capturing 13
the allowed range. Thus, the overhead due to switching of the element local
polynomial degree is reduced.
7.2 Interaction of adaption and time stepping
Switching between the DG and FV sub-cell schemes and the adaption of the
local polynomial degree is integrated in the explicit Runge-Kutta time inte-
gration. At the beginning of a time step, the indicator is computed for each
element. The resulting indicator values are used to set the local polynomial
degree for every DG element. After the p-adaption, the indicator has to be
recomputed, since the computation of the indicator value depends on the lo-
cal polynomial degree. Subsequently, the updated indicator value is used to
switch elements between a DG and FV sub-cell discretization. DG elements
containing shocks or discontinuities are detected and switched to a FV sub-cell
representation. FV elements, where the indicator determines that the solution
has suciently smoothed out are switched back to a DG representation. Af-
ter each Runge-Kutta stage, the indicator is evaluated again to switch DG
elements to FV elements to ensure a stable solution. The p-adaption is only
performed at the beginning of a time step to reduce the overhead. Switching of
FV elements to a DG representation is also omitted during the Runge-Kutta
stages, since this could violate the time step restriction.
7.3 Parameter for the shock and renement indicator
The modal decay indicator has to fulll two purposes. First, it has to deter-
mined which elements contain a smooth solution and which elements contain
sharp gradients or shocks and ag them accordingly as DG or FV elements.
Secondly, the polynomial degree is to be adjusted for each element based on
an error estimate provided by the indicator in smooth regions. To choose
the appropriate action depending on the indicator value, thresholds have to
be dened. In the proposed framework, four thresholds exist for every al-
lowed polynomial degree N∈[Nmin, Nmax],F V N
lower ,F V N
upper,DGN
ref ine and
DGN
coasre. For a DG element of degree N, four scenarios can be distinguished
as illustrated in the following Fig. 3:
–ind > DGN
coarse : An indicator value above this threshold corresponds
to a fast decay of the modes so that the highest modes have only a small
contribution to the solution. In this case, given that the local polynomial
degree is larger than the minimal allowed degree N > Nmin , the local de-
gree is reduced by one.
–DGN
ref ine < ind < DGN
coarse : For an indicator value between these
thresholds the current polynomial degree is maintained.
14 Pascal Mossier et al.
0F V N
lower F V N
upper DGN
ref ine DGN
coarse ind
switch to FV increase N maintain N decrease N
highly underresolved
smooth solution or dis-
continuity
underresolved smooth so-
lution
suciently re-
solved smooth so-
lution
overresolved
smooth solu-
tion
Fig. 3 For a DG element, four scenarios can be distinguished depending on the indicator
value that corresponds to the modal decay rate: switch to FV for ind < FV N
lower , increase N
for F V N
lower < ind < DGN
ref ine, maintain N for DGN
ref ine < ind < DGN
coarse and decrease
N for ind > DGN
coarse
–F V N
lower < ind < DGN
ref ine : An indicator value below DGN
ref ine repre-
sents a large magnitude of the highest solution modes. This indicates an
underresolved but smooth solution, since the indicator value is still above
F V N
lower . In case the element local degree is smaller than the maximum
allowed degree N < Nmax , the polynomial degree is increased by one.
–ind < F V N
lower : In case of an oscillating solution polynomial, the highest
modes have a large contribution to the solution and thus the modal decay
rate is very small. An indicator value below the threshold F V N
lower indicates
an oscillating solution. This represents a non-smooth or severely underre-
solved underlying solution and therefore the DG element is switched to a
FV sub-cell representation.
For elements already discretized with the FV sub-cell scheme, two actions are
possible, depending on the indicator value as shown in Fig. 4:
0F Vlower F Vupper ind
maintain FV switch to DG
highly underresolved smooth
solution or discontinuity
suciently resolved smooth solution
Fig. 4 For a FV element with an indicator value below FV N
upper, the FV representation is
maintained. An indicator value above F V N
upper causes the element to switch back to a DG
representation.
–ind < F V N
upper : An indicator value below this threshold indicates that
the FV sub-cell solution should not be switched back to a DG representa-
tion since the corresponding solution polynomials exhibit oscillations.
A p-adaptive discontinuous Galerkin method with hp-shock capturing 15
–ind > F V N
lower : An indicator value above this threshold indicates that
the DG polynomial that corresponds to the current FV sub-cell solution is
suciently smooth and the element can be switched back to a DG repre-
sentation.
We use an upper and lower threshold with a margin for the DG/FV switch
to avoid excessive switching that could occur for indicator values near the
switching point. Since the indicator value depends on the current polynomial
degree of the solution, thresholds for FV sub-cell limiting and p-renement
have to be dened for each degree. To reduce the number of free parameters,
we assumed a linear dependency between the thresholds and the polynomial
degree N. That way, only thresholds for the minimum and maximum allowed
polynomial degrees Nmin and Nmax have to be dened. All remaining thresh-
olds are then obtained by the following relation, here formulated for the FV
thresholds:
F V N
lower =F V Nmin
lower +NF V Nmax
lower −F V Nmin
lower
Nmax −Nmin
.(25)
A linear dependency is also assumed between the upper and lower thresholds.
That way, the upper thresholds can be obtained by
F V N
upper =F V Nmin
lower + (N+ 1) F V Nmax
lower −F V Nmin
lower
Nmax −Nmin
.(26)
Through these practical relations, the number of free parameters is reduced
to four: F V Nmin
lower ,F V Nmax
lower ,DGNmin
ref ine and DGNmax
ref ine. These parameters were
tuned empirically for the computations presented in section 8.
8 Numerical results and discussion
In this section, we apply our hp-adaptive hybrid DG/FV sub-cell scheme to a
succession of 1D, 2D, and 3D test cases to show its applicability and eciency.
Our investigation is focused on supersonic and transsonic ows that exhibit
discontinuous ow features, like shocks as well as smooth areas and regions
with intricate ow features, like shear layers with vortical structures. Compu-
tations are performed with three dierent setups that can be distinguished as
follows:
–Flexi-static: A non-adaptive computation with a polynomial degree N
and a FV sub-cell resolution of NF V =N+1, leading to a constant number
of DOFs per element. This corresponds to the baseline FLEXI code without
the improvements discussed herein.
–Flexi-p-adaptive: A p-adaptive computation with variable polynomial
degree N∈[Nmin, Nmax ]and a FV sub-cell resolution of NF V =NM ax +1.
–Flexi-hp-adaptive: A p-adaptive computation with variable polynomial
degree N∈[Nmin, Nmax ]and a rened FV sub-cell resolution of NF V =
2NMax + 1.
16 Pascal Mossier et al.
A central aspect of this section is to compare and discuss the quality of the
results, the employed number of DOFs and the computation time for the listed
setups. Additionally, a convergence test is performed to validate the coupling
of DG cells with variable polynomial degree and the single core performance
is analyzed. All computations were performed on a single core of a Xeon Gold
6140 processor if not stated otherwise.
8.1 Experimenal order of convergence
In this subsection, we validate our p-adaptive DGSEM implementation by
investigating the error convergence experimentally. For the non-adaptive case,
the order of convergence of the applied DGSEM and FV sub-cell scheme was
already studied in [26]. Therefore, we restrict our analysis to the p-adaptive
case. The convergence measurement is performed with a simple test case of a
periodic diagonal density sine wave, which is advected in the direction (1,1,1)T
through a Cartesian box Ω= [−1,1]3. Since the problem is perfectly smooth,
no FV sub-cells are necessary and we can compare the results against the
expected order of convergence p=N+1, given by the truncation error e≈khp.
All tests are performed with two dierent element local polynomial degrees
that are distributed inside the cube in a checkerboard like pattern. The higher
of the two employed degrees is chosen to be NMax = 6, the lower one varied
between NMin = [2,5]. To avoid overwhelming of the spatial discretization
error by the error of the time integration, a small CFL number of 0.05 is
used. The resulting L2and L∞errors of the density and the order of L2and
L∞convergence are listed in table 1. As expected, the theoretical order of
convergence of the lowest present polynomial degree is matched perfectly.
8.2 Single core performance
The motivation for a hp-adaptive approach is to reduce the overall number of
DOFs and thus the cost of a given computation. Therefore, it is imperative to
keep the overhead, caused by the more complex algorithm and data structure,
to a minimum. Since our adaptive code is based on the non-adaptive fast open
source code FLEXI, the goal is to retain its original performance as closely as
possible. The variable number of DOFs per element causes a signicant load
imbalance, in case of parallel computations. The implementation of an eective
load balancing is a challenging task, and is work in progress. Therefore, we
restrict ourselves in this paper to analyzing singe core performance. To quantify
the performance of the adaptive code compared to the static open source code,
we measure the performance index (PID) of both codes for dierent setups.
The PID is dened as the mean compute time required to update one DOF
for one time step and computed as follows:
PID =wall-clock-time ·cores
DOF ·time steps
A p-adaptive discontinuous Galerkin method with hp-shock capturing 17
poly. deg. cells L2error L2order L∞error L∞order theor. order
N=2
4 6.41e-03 2.04e-02
3
8 7.43e-04 3.11 8.24e-03 1.31
16 9.46e-05 2.97 1.19e-03 2.79
32 1.18e-05 3.00 1.49e-04 2.99
64 1.48e-06 3.00 1.84e-05 3.02
N=3
4 5.34e-04 4.23e-03
4
8 3.51e-05 3.93 6.22e-04 2.76
16 2.25e-06 3.96 4.51e-05 3.78
32 1.42e-07 3.98 2.88e-06 3.97
64 8.95e-09 3.99 1.83e-07 3.98
N=4
4 4.35e-05 4.04e-04
5
8 1.21e-06 5.17 1.74e-05 4.54
16 3.84e-08 4.97 5.59e-07 4.96
32 1.21e-09 4.99 1.74e-08 5.01
64 3.81e-11 4.99 5.31e-10 5.03
N=5
4 3.27e-06 3.23e-05
6
8 5.29e-08 5.95 5.83e-07 5.79
16 8.28e-10 6.00 9.73e-09 5.90
32 1.29e-11 5.99 1.54e-10 5.98
64 2.06e-13 5.98 2.67e-12 5.96
Table 1 Errors and convergence rates of the density for a diagonally advected sinus for a p-
adaptive DG method. Polynomial degrees are tested in pairs for the following combinations
(N= [2,5], N = 6).
PID measurements are performed with the computational setup, previously
used in the convergence test in subsection 8.1, where a sinus wave was di-
agonally convected through cube. In a rst step, we measure the PID of the
adaptive (hp-FLEXI) and non-adaptive (os-FLEXI) code for the same con-
stant polynomial degrees in a range between N= 2,7. We want to emphasize
that even for the test with constant polynomial degree, the hp-FLEXI is ini-
tialized with a data structure that allows for computations up to a polynomial
degree NMax = 7. From the measured results, visualized in Figure 5, we con-
clude that the PID of the adaptive code is only slightly larger than the PID
of the original, non-adaptive implementation. Particularly for degrees above
3, almost the same performance is observed. The largest dierence is present
for degree N= 2, where the adaptive code is about 15% slower. In case of
a varying local polynomial degree among adjacent elements, transformation
operations, described in subsection 3.2, are necessary to compute the uxes.
This introduces additional operations per DOF and an increased PID has to
be expected. To measure the inuence of the transformations, computations
were performed with two dierent distributions of polynomial degrees. First
the domain is split into two halves and for a second test a checkerboard like
pattern was used. In both cases, computations were performed with two dif-
ferent polynomial degrees. The larger one was xed to N= 7 and the smaller
varied between N= [2,7]. The inuence of the transformations is clearly vis-
ible in Figure 5. For a half-half distribution, an almost constant PID can be
observed that matches the PID of the open source code well. In contrast, the
checkerboard distribution causes a signicant increase of the PID up to 80%.
18 Pascal Mossier et al.
Fig. 5 Performance index for computations with polynomial degrees between N= 2 and
N= 7 with the open source FLEXI and our p-adaptive FLEXI extension. Dierent distri-
butions of the element local degree are applied for p-adaptive computations.
The data point at N= 7 matches the open source code since here all elements
are of degree 7. We can conclude from the measured data that the overhead
of the adaptive code is minor, as long as the number of interfaces between
cells of dierent ansatz degree is small. We note that for this comparison, the
checkerboard distribution constitutes the worst case scenario, as each element
has neighbors with a dierent operator, while the half and half distribution is
the least severe case. In practise, we thus expect the true performance to lie
between these two extremes. It is also clear that this single metric is not suf-
cient to judge the overall performance of the hp-adaptive version, as we will
show later on. In the following, we employ our framework to a range of test
cases of increasing complexity and compare it against the os-Flexi in terms of
accuracy and eciency.
8.3 Sod’s shock tube problem
The initial conditions of the well known shock tube problem of Sod consist
of two constant states, separated by a discontinuity in the middle of the do-
main. The initial conditions are ρ= 1,u= 0,p= 1 on the left side and
ρ= 0.125,u= 0,p= 0.1on the right side. The one-dimensional computa-
tional domain Ω= [0,1] is discretized with 100 elements. At the boundaries,
Dirichlet boundary conditions are applied. For both shock detection and p-
renement, the modal decay indicator from section 5 is applied to the den-
sity and tuned with thresholds set to [DGNmin
ref ine, DGNmax
ref ine] = [6.0,7.5] and
[F V Nmin
lower , F V Nmax
lower ] = [2.7,3.6]. As a Riemann solver, the approximate Roe
solver with an entropy x is used [18]. Two computations with dierent setups
are performed and compared against the exact solution, which is e.g. given
A p-adaptive discontinuous Galerkin method with hp-shock capturing 19
Fig. 6 Density distribution of the Sod shock tube problem at t=0.2, computed on a mesh
with 100 grid cells. A computation with constant polynomial degree and a p-adaptive com-
putation with a ner FV sub-cell resolution are compared against the exact solution.
in [28]. First a global polynomial degree N = 5 and a FV sub-cell resolution
of NF V =N+ 1 = 6 are applied. A second, p-adaptive computation is per-
formed with a polynomial degree N∈[2,5] and a FV sub-cell resolution of
NF V = 2N+ 1 = 11. The resulting density distributions are visualized in
Figure 6. Both computations show good agreement with the exact solution
and only apply FV sub-cells at the shock, which is successfully detected. The
p-adaptive computation resolves the shock more sharply, due to the higher
sub-cell resolution, which can be observed in Figure 7. A high polynomial de-
gree is applied around the kinks at the beginning and end of the rarefaction
wave, as well as the contact discontinuity and the vicinity of the shock. This
is clearly a desired feature, and shows the usefulness of our indicator strategy
discussed in sec 7.3. A good agreement between the p-adaptive and globally
rened computations can be observed, apart from the shock, which is better re-
solved in case of the adaptive computation. With an average of 63.3 DOFs per
element, the adaptive computation required about three times less DOFs per
element when compared to the globally rened computation with 216.0 DOFs
per element. Therefore the adaptive computation achieved a better result with
far less DOFs.
8.4 Shu-Osher density uctuations shock wave interaction problem
With the density uctuation shock wave interaction problem proposed by Shu
and Osher in [24], we investigate the shock capturing and p-renement abil-
ities of the adaptive code for a more demanding one-dimensional test case.
The setup features a domain Ω∈[−5,5], discretized with 100 elements that
contains a shock at x=−4. States left and right of the shock are given as
20 Pascal Mossier et al.
Fig. 7 Close up view of the Sod shock tube problem at t=0.2 and a mesh resolution of 100
elements. When compared to the non-adaptive computation with N+ 1 sub-cells, the adap-
tive computation with an increased sub-cell resolution of 2N+ 1 provides a less dissipative
solution at the shock.
initial conditions
(ρ, u, p) = ((3.857143,2.629369,10.33333) x≤ −4
(1.0+0.2·sin(5x),0.0,1.0) x≥ −4
and the boundary values are dened through Dirichlet boundary conditions.
The resulting ow phenomena can be described as a Mach 3 shock front, trav-
eling into a density eld with a sinusoidal distribution. As a reference solution
we performed a second order FV computation on a very ne mesh. The results
for a nal time of t= 1.8are visualized in Figure 8. In the wake of the shock,
high frequency density uctuations are present, as well as weak secondary
shocks further downstream. We compare a computation with a uniformly high
polynomial degree N= 5 and a FV sub-cell resolution of NF V =N+ 1 = 6
with a p-rened computation with N∈[2,5] and a rened FV sub-cell res-
olution of NF V = 2N+ 1 = 11. The approximate Roe solver is used as a
Riemann solver for all setups. Again, the modal decay indicator from section
5 is applied on the density for both shock capturing and p-renement. To
tune the indicator, we dene the thresholds [DGNmin
ref ine, DGNmax
ref ine] = [4.5,6.0]
and [F V Nmin
lower , F V Nmax
lower ] = [3.6,4.5]. The shock indicator behaves equivalently
for both computations and successfully detects the primary shock, as well
as the three weak shocks that form downstream. A perfect behavior of the
p-renement can be observed, since only the high frequency waves and the
vicinity of the weak shocks are computed with the maximal polynomial de-
gree. In regions with constant density or with low frequency sinus waves the
minimal polynomial degree is chosen. As a result of the well distributed ele-
ment local polynomial degree of the adaptive computation, a good agreement
A p-adaptive discontinuous Galerkin method with hp-shock capturing 21
Fig. 8 Shu-Osher problem at t=1.8, computed on a mesh of 100 grid cells. A p-adaptive
computation with a rened sub-cell mesh is compared to a non-adaptive computation with
a constant number of DOFs per element.
Fig. 9 Close up view of the high frequency density uctuations of the Shu Osher problem
that form after the shock at t=1.8. A better agreement of the adaptive computation with
the reference solution can be observed due to a higher FV sub-cell resolution.
with the uniform computation is achieved. Through the high FV sub-cell reso-
lution, the primary and secondary shocks are resolved more sharply and with
less dissipation. Therefore, the adaptive computation matches the exact so-
lution better, especially at the high frequency waves immediately after the
shock, visible in Figure 9. The more accurate result, provided by the adaptive
computation was achieved with a mean of 94.7 DOFs per element, whereas
the non-adaptive computation used 216 DOFs per element.
22 Pascal Mossier et al.
8.5 Double Mach reection
The double Mach reection (DMR) problem was proposed by Woodward and
Colella in [29] and has become a standard benchmark. It can be interpreted as
a horizontally traveling Mach 10 shock wave that encounters a ramp with an
inclination of 30°. By the Rankine-Hugoniot conditions the initial conditions
are obtained as
(ρ, v1, v2, v3, p) =
(8.0,8.25 ·cos(30),−8.25 ·sin(30),0.0,116.5) x≤x0+q1
3y
(1.4,0.0,0.0,0.0,1.0) x≥x0+q1
3y
with x0=1
6and the heat capacity ratio γ= 1.4. The computational domain
Ω= [0,4] ×[0,1] is discretized with 192×48×1 elements corresponding to a
characteristic mesh size of h= 1
48 . In x-direction, inow and outow conditions
are imposed. In y-direction, the bottom boundary is modelled as a reecting
wall and the upper boundary is given by the exact solution of an oblique shock
traveling at Mach 10. Since we compute the 2D problem with a 3D code, the
z-direction is discretized with one element layer and periodic boundary condi-
tions are imposed. The problem is advanced in time until the nal time t= 0.28
is reached. As a Riemann solver, we used a HLLE solver and perform shock
capturing with the modal decay indicator from section 5 that is applied on the
pressure. The same indicator is also used to determine the polynomial degree
for p-adaptive computations. The indicator is tuned with thresholds dened
as [DGNmin
ref ine, DGNmax
ref ine] = [5.6,6.5] and [F V Nmin
lower , F V Nmax
lower ] = [3.2,4.1]. Three
computations with the numerical setups, listed in table 2, are performed. First
the non-adaptive setup Flexi-static is applied, to obtain a reference solution. It
is compared against results, obtained by the p-adaptive setups Flexi-p-adaptive
and Flexi-hp-adaptive. The comparison between Flexi-p-adaptive and Flexi-hp-
adaptive demonstrates the eect of an increased FV sub-cell resolution on the
solution. In Figure 10, the density distribution with equidistant contour lines
Setup Resolution DOFs per element Computation time [s]
Flexi-static N= 5,NF V = 6 216 15578
Flexi-p-adaptive N∈[2,5],NFV = 6 35 3856
Flexi-hp-adaptive N∈[2,5],NFV = 11 54 6569
Table 2 Comparison of computation time and number of DOFs per element between the
non-adaptive and p-adaptive computations.
is visualized for the three cases at the nal time. To highlight shocks, strong
gradients and shear layers, schlieren images are provided in Figure 11. The
distribution of FV elements and the local polynomial degree can be seen in
Figure 12. Our code successfully detects the shock fronts and resolves them
with FV sub-cells. Equal behavior of the indicator can be observed for all three
cases. As expected, shocks are resolved more sharply for a higher FV sub-cell
resolution, best visible in Figure 11. To resolve the vortical structures at the
A p-adaptive discontinuous Galerkin method with hp-shock capturing 23
Fig. 10 Results for the double Mach reection problem computed with a DG method and
limited by FV sub-cells on 192x48x1 elements. The density with equidistant contour lines is
displayed for the three dierent computational settings Flexi-static (top), Flexi-p-adaptive
(middle) and Flexi-hp-adaptive (bottom).
primary slip line, a high resolution is necessary. This is successfully detected by
the modal decay indicator, and the local polynomial degree is increased along
the primary slip line. In a narrow band around the shocks, p-renement is per-
formed as well. For the remaining domain, a local polynomial degree of N= 2
is used. This is in line with our indicator strategy in sec 7.3. Since the areas
where a high polynomial degree is necessary are detected well, the results of the
p-adaptive computation matches the non-adaptive, globally rened simulation
well. The vortical structures at the slip line are very similar and only slightly
better resolved for the non-adaptive case. As already discussed, the third com-
putation resolves shocks more sharply, due to the higher sub-cell resolution.
This results in a minor deviation of the position of shocks and triple points.
Vortical structures on the primary slip stream, near the primary triple point
are resolved even better for this setup, when compared to the non-adaptive
result. We note that an FV/DG interface can trigger acoustic waves. This is an
expression of the dierent resolution capabilities and numerical transfer func-
tions of the DG and FV operator. This is most pronounced for the cases with
NF V =N+ 1, as the dierence in resolution between FV and DG is largest.
Interestingly, the thus generated disturbances are damped by the reduction in
polynomial degree away from the shock in the p-adaptive FLEXI version. This
is best observed ”inside” the DMR region in 11. Increasing the FV resolution
to NF V = 2N+ 1 almost completely avoids the generation of these artefacts.
Therefore the third setup, provides the solution with the least noise. The pri-
24 Pascal Mossier et al.
Fig. 11 Resulting schlieren images, computed as log10 (|∇ρ|+1), for the double Mach reec-
tion problem and three dierent computational setting Flexi-static (top), Flexi-p-adaptive
(middle) and Flexi-hp-adaptive (bottom).
Fig. 12 FV sub-cell distribution (left) and element local polynomial degree (right) used
for the DMR computation with the setups Flexi-static (top), Flexi-p-adaptive (middle) and
Flexi-hp-adaptive (bottom).
mary advantage of the adaptive computations is the reduced computational
eort. Table 2 lists the mean number of DOFs per element and the computa-
tion time for the dierent setups. The computation Flexi-p-adaptive achieved a
speedup of a factor 4 and the computation Flexi-hp-adaptive with an increased
FV sub-cell resolution still achieved a speedup of almost a factor 2.5. We note
that although the reduction in DOF alone might suggest a larger reduction in
A p-adaptive discontinuous Galerkin method with hp-shock capturing 25
computing time, the loss in operator eciency, investigated in 8.2, balances
this to some degree. However, in all practical applications investigated by us,
a signicant overall gain in wall time remained.
8.6 Forward facing step
With the forward facing step (FFS) we consider a second test problem by
Woodward and Colella ([29]) that models a Mach 3 wind tunnel with a step.
The computational domain Ω= [0,3] ×[0,1]\[0.6,3.0] ×[0,0.2] is initialized
with freestream conditions dened as
(ρ, v1, v2, v3, p) = (1.4,3.0,0.0,0.0,1.0)
and the heat capacity ratio γ= 1.4. Inow and outow conditions are imposed
in x-direction and reective walls are used to describe the channel walls in y-
direction. Since the two-dimensional test case is again computed with a three-
dimensional setup, periodic boundary conditions are applied in z-direction.
We discretize the domain with 180 ×60 ×1−144 ×12 ×1elements, cor-
Setup Resolution DOFs per element Computation time [s]
Flexi-static N= 5,NF V = 6 216 65782
Flexi-p-adaptive N∈[2,5],NFV = 6 44 19774
Flexi-hp-adaptive N∈[2,5],NFV = 11 82 40217
Table 3 Comparison of computation time and number of DOFs per element between the
non-adaptive and p-adaptive computations.
responding to a characteristic length h=1
60 . As an approximate Riemann
solver, the HLLE is used. Shock capturing, as well as p-renement is con-
trolled by the modal decay indicator from section 5, operating on the density.
The corresponding thresholds are given as [DGNmin
ref ine, DGNmax
ref ine] = [4.5,6.0]
and [F V Nmin
lower , F V Nmax
lower ] = [3.0,4.2]. To demonstrate and assess the perfor-
mance of our adaptive code, compared to the non-adaptive version, we use
the setups from subsection 8.5 again. In table 3, the polynomial degrees and
FV sub-cell resolutions for the three cases are given. The density distributions
with equidistant contour lines are visualized in Figure 13. Shocks, sharp gra-
dients and shear layers are highlighted in the schlieren images in Figure 14.
FV sub-cells and the distribution of the local polynomial degree are depicted
in Figure 15. The shock fronts, interacting with the channel boundaries are
successfully detected and resolved with FV sub-cells, as can be seen in Figure
15. Only very few FV elements are placed at the Kelvin-Helmholtz instabil-
ities, that develop along the shear layer after the primary triple point. This
demonstrates a very good behavior of the modal decay indicator for shock
capturing. The schlieren images in Figure 14 showcase the inuence of the in-
creased FV sub-cell resolution in the third computational setup. Here, shocks
are resolved much sharper and the interface between FV and DG elements
26 Pascal Mossier et al.
Fig. 13 Forward facing step problem computed with a DG method and limited by FV sub-
cells. The density with equidistant contour lines is given for the three computational setups
Flexi-static (top), Flexi-p-adaptive (middle) and Flexi-hp-adaptive (bottom).
produced less artefacts and less noise. For the p-renement, the indicator has
to detect areas where a high resolution is required. The resulting distribution
of element local polynomial degrees shows that a high order is applied at the
sharp edge of the step, in the direct vicinity of shocks, in the sheer layer near
the channel oor and especially at the Kelvin-Helmholtz instabilities of the
upper shear layer. The density distribution at the nal computation time and
the corresponding schlieren images show, that the adaptive setup Flexi-hp-
adaptive reproduces the solution of the non-adaptive Flexi-static setup very
well. Results obtained with Flexi-p-adaptive are only slightly more dissipative
and the vortical structures at the Kelvin-Helmholtz instability are very similar.
Like already observed in the DMR test case, a ner FV sub-cell grid resolves
shocks better, which in turn results in a minor deviation of the positioning of
shock fronts and triple points. Therefore, a slightly dierent pattern of vortices
is generated at the Kelvin-Helmholtz instability. Structures near the primary
triple point appear even richer than in the non-adaptive, globally rened case.
Acoustic waves, that are generated by the vortical structures, are present at
the upper shear layer and the shear layer near the channel bottom and are
A p-adaptive discontinuous Galerkin method with hp-shock capturing 27
Fig. 14 Resulting schlieren images, computed as log10 (|∇ρ|+1), for the forward facing step
problem and the three computational setups Flexi-static (top), Flexi-p-adaptive (middle)
and Flexi-hp-adaptive (bottom).
mostly ignored by the p-renement indicator and damped. This can be seen
best at the density contour lines and in the schlieren images. While provid-
ing comparable and in parts even better results, the adaptive computations
required in average far less DOFs per element and therefore less computation
time. From table 3, we can deduce a speed up of almost a factor 3 for the setup
Flexi-p-adaptive and still a factor of about 1.6 for the setup Flexi-hp-adaptive,
where an increased FV sub-cell resolution was applied additionally.
8.7 Airfoil at transsonic conditions
In this subsection, we simulate the ow around an airfoil at transsonic condi-
tions to validate our framework against a more realistic setup. The airfoil is
placed in the computational domain Ω, that is discretized with 8156 hexahe-
dral elements. The simulation is initialized with Mach 0.73 freestream condi-
tions, dened as
(ρ, v1, v2, v3, p) = (1.0,0.998,0.061,0.0,1.340)
28 Pascal Mossier et al.
Fig. 15 FV sub-cell distribution (left) and element local polynomial degree (right) used
for the forward facing step computation with the setups Flexi-static (top), Flexi-p-adaptive
(middle) and Flexi-hp-adaptive (bottom).
and the heat capacity ratio γ= 1.4. The airfoils surface is modeled as a re-
ecting wall boundary and inow and outow conditions are imposed. Again,
we perform a 3D computation for a 2D problem and apply periodic boundary
conditions in the z-direction. Shock capturing and p-renement is performed
with the modal decay indicator applied on the density with the thresholds
[DGNmin
ref ine, DGNmax
ref ine] = [5.5,6.05] and [F V Nmin
lower , F V Nmax
lower ] = [3.0,4.0]. As a
Riemann solver, the approximate Roe solver is used. We compute the test
case with the three dierent numerical setups Flexi-static,Flexi-p-adaptive
and Flexi-hp-adaptive and compare the results. The exact setups are provided
in table 4. Results at the nal time t= 10 are provided in Figure 16. Both the
Setup Resolution DOFs per element Computation time∗[s]
Flexi-static N= 4,NF V = 5 125 10160
Flexi-p-adaptive N∈[2,4],NFV = 5 30.5 24692
Flexi-hp-adaptive N∈[2,4],NFV = 9 32.5 27149
Table 4 Comparison of computation time and number of DOFs per element between the
non-adaptive and p-adaptive computations.
density distribution with equidistant contour lines and corresponding schlieren
images are on display. A region with supersonic ow conditions and a shock
are visible above the airfoil. Vortex shedding can be observed at the trailing
edge and in the wake. The underlying distribution of FV sub-cells and the el-
ement local polynomial degree is visualized in Figure 17. For all three setups,
FV sub-cells are positioned exclusively at the shock and directly at the trailing
A p-adaptive discontinuous Galerkin method with hp-shock capturing 29
Fig. 16 Density distribution with equidistant contour lines (left) and schlieren images
(right), computed as log10(|∇ρ|+ 1), for an airfoil at transsonic conditions. We compare
the three computational setup Flexi-static (top), Flexi-p-adaptive (middle) and Flexi-hp-
adaptive (bottom).
edge. The inuence of the increased FV sub-cell resolution in the case of the
third computational setup is highlighted in the schlieren image. The shock is
resolved signicantly sharper and vortical structures in the wake are richer and
less damped. We want to empathize that only about 3 elements are limited
with FV sub-cells in the wake. Nontheless, the rened sub-cell resolution has a
substantial impact on the quality of the computation. As visible in Figure 17,
the p-renement indicator successfully detects the nose area, the vicinity of the
shock and the airfoils wake as regions, where a high resolution is required. Here,
the maximum allowed polynomial degree is applied. The rest of the computa-
tional domain is computed with the lowest allowed polynomial degree. When
compared to the globally rened computation, the p-adaptive computations
30 Pascal Mossier et al.
Fig. 17 FV sub-cell distribution (left) and element local polynomial degree (right) for the
setups Flexi-static (top), Flexi-p-adaptive (middle) and Flexi-hp-adaptive (bottom).
show good agreement and recover intricate features like the vortex sheet in the
wake of the airfoil very well. The results of the adaptive computation with a
rened sub-cell grid even surpass the globally rened computation when con-
sidering the vortical structures in the wake. This is especially signicant, since
only an average of 32.5 DOFs per element where required in this setup. With
only 30.5 DOFs per element, the p-adaptive computation without increased
sub-cell resolution was even cheaper, while reproducing the non-adaptive re-
sult very well. ∗Since the globally rened computation was too expensive to
run on a single core, it was performed on 36 cores in parallel. This makes
a direct comparison of the computation time dicult. On a single core, the
adaptive computations required about 3 times more time than the globally
rened computation on 36 cores. Since good parallel scaling of the FLEXI
A p-adaptive discontinuous Galerkin method with hp-shock capturing 31
was demonstrated in [26], we can conclude from these measurements, that the
adaptive computations where signicantly cheaper and would outperform the
non-adaptive code on a single core by a large factor.
8.8 A three-dimensional explosion problem
Finally, to validate our adaptive scheme for three-dimensional computations,
we consider a spherically symmetric problem by extending the one-dimensional
shock tube problem from section 8.3 to a three- dimensional spherical problem.
The resulting setup on the computational domain Ω= [−1,1]3is dened by
the initial conditions
(ρ, u, p) = ((1,0,0,0,1) r≤0.5,
(0.125,0,0,0,0.1) r≥0.5,
where rdenotes the radial coordinate r=px2+y2+z2. The computational
domain is still Cartesian and discretized by 50 ×50 ×50 elements with Dirich-
let boundary conditions. As an approximate Riemann solver, we use here
for this focusing wave problem the robust local Lax-Friedrichs solver. The
modal decay indicator is evaluated for the density and thresholds are set as
[DGNmin
ref ine, DGNmax
ref ine] = [4.5,6.0] and [F V Nmin
lower , F V Nmax
lower ] = [2.5,4.0]. The de-
scribed setup is of particular interest since it features the propagation of waves
that are not aligned to the grid. Due to the problem being spherically symmet-
ric, an equivalent reference solution can be computed in one dimension using
spherical coordinates and a geometric source term [27]. Three computations
with the numerical setups Flexi-static,Flexi-p-adaptive and Flexi-hp-adaptive
are performed and compared against the reference solution. Table 5 contains
a detailed denition of the setups. To evaluate the schemes ability to propa-
Setup Resolution DOFs per element Computation time [s]
Flexi-static N= 5,NF V = 6, 216 10839
Flexi-p-adaptive N∈[2,5],NFV = 6 56 3557
Flexi-hp-adaptive N∈[2,5],NFV = 11 141 8601
Table 5 Comparison of computation time and number of DOFs per element between the
non-adaptive and p-adaptive computations.
gate waves diagonally through the Cartesian grid cells, Figure 18 shows the
density distribution over a line from the origin to the corner (1,1,1) at the
nal time t= 0.2. It is to be noted that in this direction, the interval of inter-
est [0,1] is only discretized by 15 elements. The density is visualized for the
three computational setups. In Figure 19, the contour of the density from the
z= 0 plane is plotted - together with the FV sub-cell distribution and the
distribution of the local polynomial degree for setup Flexi-hp-adaptive. The
shock is successfully detected and limited with FV sub-cells. In contrast to
32 Pascal Mossier et al.
Fig. 18 Density distribution of the 3D explosion problem along a line from the origin to
the corner (1,1,1) at the nal time t= 0.2. The reference solution is compared against a
non-adaptive and two adaptive setups.
the one-dimensional Sod shock tube computation of subsection 8.3, the con-
tact discontinuity is also limited with FV sub-cells. This is necessary due to
the signicantly coarser mesh of the three-dimensional setup. A high polyno-
mial degree is applied in the vicinity of the shock and the contact discontinuity
as well as at the rarefaction fan. The density distributions in Figure 18 show
that the adaptive setups match the non-adaptive, globally rened solution
quite well. A slightly better resolution of the shock can be observed in the
case of the rened FV sub-cell resolution. In Table 5, the average number of
DOFs per element and the computation time is compared for the three setups.
For the test case at hand, computations were performed on a single core of an
AMD EPYC 7302 processor. With an average of 56 DOFs per element, the
adaptive computation Flexi-p-adaptive was three times faster than the non-
adaptive computation Flexi-static. Since an average of almost 8 percent of all
elements are limited with FV sub-cells, the number of DOFs and therefore
the computation time increased signicantly for the setup Flexi-hp-adaptive,
where an increased sub-cell resolution is applied. Therefore, only a speedup
of 25 percent was achieved. Since both adaptive computations produce very
similar results, the setup Flexi-p-adaptive is the more ecient one for this test
case. We can conclude that our adaptive framework is able to provide compara-
ble results for a three-dimensional test case while reducing the computational
eort signicantly.
A p-adaptive discontinuous Galerkin method with hp-shock capturing 33
Fig. 19 Contour of the density from the z= 0 plane of the 3D explosion problem at the
nal time t= 0.2, computed with an adaptive setup with N= [2,5] and a FV sub-cell
resolution of NF V = 2N+ 1 = 11. On the left, FV elements are highlighted in yellow and
on the right, the distribution of the local polynomial degree is visualized.
9 Conclusion
In this paper, we combined a p-adaptive discontinuous Galerkin scheme with
a nite volume shock capturing strategy with variable h-renement. This hy-
brid approach prots from the high convergence rate of p-adaptive high order
methods in smooth areas as well as from the stable and accurate shock cap-
turing abilities by a second order total variation diminishing nite volume
scheme. In the troubled cells with oscillations, the nite volume scheme acts
on a h-rened sub-cell grid. The renement causes a better localisation of the
strong gradients within the troubled DG grid cell. Hence, the advantages of the
discontinuous Galerkin scheme and the nite volume scheme are successfully
combined. An indicator based on the modal decay of the solution polynomials
managed the switching between both schemes and controlled the adaptation
of the local polynomial degree during run time. To obtain an implementa-
tion with a minimal overhead, we introduced an ecient, static, array based
data structure that recovers the single core performance of non-adaptive ref-
erence computations. With a variety of numerical test cases, we compared
non-adaptive setups with dierent adaptive setups and achieved signicant
speedups, while producing comparable or even more accurate results. In the
future, we introduce dynamic load balancing, to extend the application of our
adaptive scheme to large scale simulations on massively parallel systems.
References
1. Abbà, A., Recanati, A., Tugnoli, M., Bonaventura, L.: Dynamical p−adaptivity for les of
compressible ows in a high order dg framework. Journal of Computational Physics 420,
109720 (2020). DOI https://doi.org/10.1016/j.jcp.2020.109720. URL https://www.sci-
encedirect.com/science/article/pii/S0021999120304940
34 Pascal Mossier et al.
2. Beck, A.D., Zeifang, J., Schwarz, A., Flad, D.G.: A neural network based shock detec-
tion and localization approach for discontinuous Galerkin methods. Journal of Compu-
tational Physics 423, 109824 (2020). DOI https://doi.org/10.1016/j.jcp.2020.109824
3. Chalmers, N., Agbaglah, G., Chrust, M., Mavriplis, C.: A parallel hp-adaptive
high order discontinuous galerkin method for the incompressible navier-stokes
equations. Journal of Computational Physics: X 2, 100023 (2019). DOI
https://doi.org/10.1016/j.jcpx.2019.100023. URL https://www.sciencedirect.com/sci-
ence/article/pii/S2590055219300393
4. Duerrwaechter, J., Kurz, M., Kopper, P., Kempf, D., Munz, C.D., Beck, A.: An ef-
cient sliding mesh interface method for high-order discontinuous Galerkin schemes.
Computers and Fluids 217, 104825 (2020). DOI 10.1016/j.compuid.2020.104825
5. Dumbser, M., Zanotti, O., Loubère, R., Diot, S.: A posteriori subcell limiting of the
discontinuous Galerkin nite element method for hyperbolic conservation laws. Journal
of Computational Physics 278, 47 – 75 (2014)
6. Dumbser, M., Zanotti, O., Loubère, R., Diot, S.: A posteriori subcell limiting of the
discontinuous Galerkin nite element method for hyperbolic conservation laws. Journal
of Computational Physics (2014). DOI 10.1016/j.jcp.2014.08.009
7. Giri, P., Qiu, J.: A high order Runge-Kutta discontinuous Galerkin method with a sub-
cell limiter on adaptive unstructured grids for two-dimensional compressible inviscid
ows: RKDG with a sub-cell limiter on adaptive unstructured grids. International
Journal for Numerical Methods in Fluids 91 (2019). DOI 10.1002/d.4757
8. Huerta, A., Casoni, E., Peraire, J.: A simple shock‐capturing technique for high‐order
discontinuous Galerkin methods. International Journal for Numerical Methods in Fluids
69, 1614 – 1632 (2012)
9. Kopera, M.A., Giraldo, F.X.: Analysis of adaptive mesh renement for imex discontin-
uous galerkin solutions of the compressible euler equations with application to atmo-
spheric simulations. Journal of Computational Physics 275, 92–117 (2014). DOI
https://doi.org/10.1016/j.jcp.2014.06.026. URL https://www.sciencedirect.com/sci-
ence/article/pii/S0021999114004331
10. Kopriva, D.: Implementing Spectral Methods for Partial Dierential Equations: Al-
gorithms for Scientists and Engineers. Scientic Computation. Springer Netherlands
(2009)
11. Krais, N., Beck, A., Bolemann, T., Frank, H., Flad, D., Gassner, G., Hindenlang, F.,
Homann, M., Kuhn, T., Sonntag, M., Munz, C.D.: Flexi: A high order discontinuous
Galerkin framework for hyperbolic–parabolic conservation laws. Computers & Mathe-
matics with Applications (2020)
12. Li, Y., Premasuthan, S., Jameson, A.: Comparison of h- and p- adaptations for spectral
dierence methods. In: AIAA-201010 of 11 American Institute of Aeronautics and
Astronautics, pp. 10–1007 (2010)
13. Marcon, J., Castiglioni, G., Moxey, D., Sherwin, S., Peiro, J.: rp‐adaptation for com-
pressible ows. International Journal for Numerical Methods in Engineering 121,
5405–5425 (2020)
14. Mavriplis, C.: A posteriori error estimators for adaptive spectral element techniques. In:
P. Wesseling (ed.) Proceedings of the Eighth GAMM-Conference on Numerical Methods
in Fluid Mechanics, pp. 333–342. Vieweg+Teubner Verlag, Wiesbaden (1990)
15. Mavriplis, C.: Nonconforming discretizations and a posteriori error estimators for adap-
tive spectral element techniques (2005)
16. Moxey, D., Cantwell, C., Mengaldo, G., Serson, D., Ekelschot, D., Peiro, J., Sherwin, S.,
Kirby, R.: Towards p-Adaptive Spectral/hp Element Methods for Modelling Industrial
Flows, pp. 63–79 (2017). DOI 10.1007/978-3-319-65870-4_4
17. von Neumann, J., Richtmyer, R.: A method for the numerical calculation of hydrody-
namic shocks. J.Appl. Phys 21, 232–237 (1950)
18. Pelanti, M., Quartapelle, L., Vigevano, L.: A review of entropy xes as applied to roe’s
linearization (2021)
19. Persson, P., Stamm, B.: A discontinuous Galerkin method for shock capturing using a
mixed high-order and sub-grid low-order approximation space. ArXiv abs/1911.01095
(2019)
20. Persson, P.O.: Shock capturing for high-order discontinuous Galerkin simulation of tran-
sient ow problems. 21st AIAA Computational Fluid Dynamics Conference (2013)
A p-adaptive discontinuous Galerkin method with hp-shock capturing 35
21. Qiu, J., Shu, C.W.: Hermite WENO schemes and their application as limiters for
Runge–Kutta discontinuous Galerkin method: one-dimensional case. Journal of Com-
putational Physics 193(1), 115 – 135 (2004)
22. Remacle, J.F., Flaherty, J., Shephard, M.: An adaptive discontinuous Galerkin technique
with an orthogonal basis applied to compressible ow problems. SIAM review 45, 53–72
(2003). DOI 10.1137/S00361445023830
23. Roe, P.L.: Characteristic-based schemes for the Euler equations. Annual Review of
Fluid Mechanics 18, 337–365 (1986)
24. Shu, C.W., Osher, S.: Ecient implementation of essentially non-oscillatory shock-
capturing schemes, II. J. Comput. Phys. 83(1), 32–78 (1989)
25. Sonntag, M., Munz, C.D.: Shock capturing for discontinuous Galerkin methods using
nite volume subcells. Finite Volumes for Complex Applications VII 78, 945–953 (2014)
26. Sonntag, M., Munz, C.D.: Ecient parallelization of a shock capturing for discontinuous
Galerkin methods using nite volume sub-cells. Journal of Scientic Computing 70
(2016)
27. Toro, E.F.: Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical
Introduction. Springer Science & Business Media (1999)
28. Toro, E.F., Clarke, J.F.: Numerical Methods for Wave Propagation. Springer Publishing
Company, Incorporated (2011)
29. Woodward, P., Colella, P.: The numerical simulation of two-dimensional uid ow with
strong shocks. Journal of Computational Physics 54(1), 115–173 (1984)
30. Zeifang, J., Beck, A.: A data-driven high order sub-cell articial viscosity for the discon-
tinuous Galerkin spectral element method (2021). DOI 10.13140/RG.2.2.26934.32322/1
31. Zhu, J., Zhong, X., Shu, C.W., Qiu, J.: Runge–Kutta discontinuous Galerkin method
using a new type of WENO limiters on unstructured meshes. Journal of Computational
Physics 248, 200–220 (2013). DOI https://doi.org/10.1016/j.jcp.2013.04.012