Discontinuous Galerkin Method (DGM): High-Precision Discretization for Unstructured Grid Compressible Flow Analysis
Step-by-step summary from DGM weak form derivation to Gauss quadrature and unstructured grid implementation.
The Discontinuous Galerkin Method (DGM) is a numerical method that combines the advantages of the Finite Element Method (FEM) and the Finite Volume Method (FVM). It uses high-order polynomial basis functions within each cell and exchanges information at cell boundaries using numerical fluxes. It is a powerful option for high-precision analysis of compressible flows on unstructured grids.
Governing Equation and Flux Splitting#
Conservation equation for compressible flow:
Where:
- : Vector of conservative variables
- : Convective flux
- : Viscous flux
- : Source term
Basis Function Expansion and Weak Form Derivation#
The solution within the cell is approximated as a linear combination of basis functions:
is the number of degrees of freedom within the cell, determined by the approximation polynomial degree ( in 3D).
Multiplying by a test function and integrating over :
Applying Green's formula (integration by parts) splits it into volume and boundary integrals:
on the boundary is the numerical flux using information from adjacent cells (e.g., Roe, HLLC).
Mass Matrix and Time Integration#
Arranging as an ODE for the -th basis function coefficient:
Where the mass matrix is:
Using orthogonal basis functions (such as Taylor basis or Legendre polynomials) makes diagonal, eliminating the cost of calculating the inverse matrix. The residual vector is the sum of the volume integral term and the surface flux term:
Application of Gauss Quadrature#
Volume and surface integrals are calculated numerically using Gauss-Legendre quadrature. To integrate a polynomial of degree exactly, an integration of at least order is required.
Number of Gauss points by cell type (by representative degree):
| Cell Type | 1st Order | 2nd Order | 3rd Order |
|---|---|---|---|
| Tetrahedron | 1 | 4 | 10 |
| Hexahedron | 1 | 8 | 27 |
| Prism | 3 | 9 | 18 |
| Pyramid | 1 | 5 | 15 |
For face types, three times the cell points (3D projection) are used.
Algorithm Implementation Sequence#
In actual implementation, proceed in the following order:
- Cell/Face Classification: Tetra/Hexa/Prism/Pyramid/Polyhedron
- Basis Function Preparation: Calculate , for each cell type × approximation degree
- Gauss Point Cache: Store reference element coordinates and weights in memory
- Variable Initialization: Set (e.g., free-stream conditions)
- Loop (Time Stepping):
- Volume Integral: — Calculate and sum fluxes at each Gauss point
- Surface Flux: — Calculate numerical flux
- RK Update: Explicit time integration such as SSP-RK3
import numpy as np
def compute_volume_residual(U_hat, phi, dphi, gauss_w, flux_func):
"""Compute volume residual (single cell)"""
Np, Ng = phi.shape # (Number of basis functions, Number of Gauss points)
R = np.zeros_like(U_hat)
for g in range(Ng):
# Restore physical quantities at Gauss point
U_g = phi[:, g] @ U_hat # shape: (nvar,)
F_g = flux_func(U_g) # (nvar, ndim)
# Contribution to volume residual
for k in range(Np):
R[k] += gauss_w[g] * (dphi[k, :, g] @ F_g.T)
return RNumerical Flux Selection — Practical Considerations#
Numerical flux in DGM is directly related to stability and accuracy.
- Roe Flux: Captures contact discontinuities well, but can cause expansion shocks without entropy correction.
- HLLC: More stable than Roe, but excessive dissipation may occur in rare cases.
- LxF (Lax-Friedrichs): Simple to implement, but large dissipation reduces high-order gains.
Common mistakes:
- Insufficient Gauss points — Aliasing errors where the order decreases in non-linear fluxes.
- Ignoring Mass Matrix diagonalization — When using general FEM basis functions, a linear system must be solved at every step, which is inefficient.
- Face normal direction mismatch — Always check that the sign of the normal of the adjacent cell is opposite on the shared face.
Accuracy Verification — Taylor-Green Vortex#
When comparing the incompressible analytical solution with DGM results, -th order DGM should theoretically show convergence. In practice, if the error does not decrease by times when the grid is refined by 2x, check the quadrature order or boundary treatment.
References#
- Luo, H. et al., "A discontinuous Galerkin method based on a Taylor basis for the compressible flows on arbitrary grids," J. Comput. Phys. 227 (2008).
- Luo, H. et al., "Hybrid discontinuous Galerkin–finite volume techniques for compressible flows on unstructured meshes," AIAA Paper (2012).
Change p and element count below to see DG's per-element jumps and convergence.
DG는 각 요소 안에서만 다항식 — 요소 경계에 점프가 보인다. p=3까지 올리면 부드러운 함수는 거의 일치, step은 Gibbs 진동이 나타난다.
Share if you found it helpful.