The Advection-Diffusion Equation¶
We consider the steady-state advection-diffusion equation for a scalar quantity , in this case in m:
where is a prescribed advective velocity field in ms, is the diffusion coefficient in ms, is a source term in ms, and is the computational domain.
The relative importance of the two transport mechanisms is captured by the cell Péclet number:
where is a local mesh size. When diffusion dominates and the problem is essentially elliptic; when advection dominates and the solution can develop sharp internal layers and boundary layers.
Numerical Challenges and the Case for DG¶
Standard continuous Galerkin (CG) finite element methods work well for the pure diffusion limit, but suffer from spurious non-physical oscillations as grows. These oscillations arise because CG lacks any intrinsic upwinding mechanism, as the scheme treats upwind and downwind information symmetrically, even though advection is inherently directional.
Several stabilisation strategies have been developed to address this within the CG framework:
Isotropic artificial diffusion adds a scalar diffusion term uniformly in all directions, where is a dimensionless tuning parameter and is the local mesh size. It is simple to implement but inconsistent, as the added diffusion modifies the original problem, introducing cross-stream smearing and reducing accuracy, particularly near sharp layers (COMSOL, 2020).
Streamline-upwind Petrov–Galerkin (SUPG) and Galerkin least-squares (GLS) are consistent stabilisations: they add residual-weighted terms that introduce numerical diffusion strictly along the streamline direction. Because the added terms vanish when the exact solution is substituted, the convergence order is preserved. These are generally preferred over isotropic diffusion.
These methods can be effective, but all require tuning parameters, add complexity to the formulation, and are fundamentally workarounds for a framework not designed with advection-dominated transport in mind.
Discontinuous Galerkin (DG) methods address the root cause rather than patching the symptom. Because the approximation space allows inter-element discontinuities, information can be passed between elements through numerical fluxes, and the choice of flux naturally encodes upwinding for the advection term. This gives DG several structural advantages:
Natural upwinding: the upwind flux for advection is a direct consequence of the DG framework, not an add-on stabilisation.
Local conservation: the flux balance is satisfied element-wise, which matters for transport quantities.
Flexibility in boundary conditions: all conditions are imposed weakly through face integrals, giving a uniform treatment.
High-order accuracy: high-degree polynomial spaces can be used on unstructured meshes without additional complications.
The trade-off is a larger global system (DG has more degrees of freedom than CG for the same mesh) and the need to select a penalty parameter for the diffusion term carefully. Both are manageable in practice.
Derivation of the DG Weak Form¶
Notation¶
Let be a triangulation of , and let and denote the sets of interior and boundary faces. The DG trial and test space is:
For an interior face shared by elements and , let be the outward unit normal from . We define the average and jump operators for a scalar and vector as:
Note that is the scalar normal jump of a vector, while is the scalar jump of oriented with . On a boundary face there is a single element, so and .
Element-wise Integration by Parts¶
Multiply the strong form by and integrate over a single element :
Applying the divergence theorem to each term separately:
Summing over all elements and assembling the integrals across shared faces using the average and jump operators yields the global weak form.
Diffusion Term: SIPG¶
The assembly identity for the diffusion boundary integrals gives:
In the continuous setting the normal flux of a smooth solution is single-valued, so and the second interior face term can be dropped from the bilinear form without compromising consistency, since it vanishes exactly when the true solution is substituted. In the discrete setting is genuinely discontinuous and is not zero in general, so omitting this term does modify the discrete system; stability is recovered through the penalty contribution introduced below, rather than by any smoothness of . Subtracting the remaining single-valued flux term from the element-wise bulk integrals gives a consistent but non-symmetric form. SIPG adds two further face contributions to restore symmetry and coercivity:
Symmetry: , which is zero for the exact solution (consistency preserved) and symmetrises the bilinear form.
Penalty: , which penalises inter-element jumps and restores coercivity.
The interior SIPG bilinear form is therefore:
The penalty parameter (with and the polynomial degree) must exceed a threshold that depends on the element geometry.
Advection Term: Upwind Flux¶
After summing over elements, the advection face integrals over an interior face (with normal ) yield:
Since is multi-valued on , we replace it with the upwind value:
which can be written compactly as:
The face integral then becomes , where is the oriented scalar jump of the test function.
The compact identity above assumes that is single-valued on , i.e. . This holds whenever is prescribed analytically or is represented in a continuous finite element space, but it fails in general for a velocity field interpolated from an external solver into a DG space. The practical consequences, and how to handle them, are discussed in the section on coupling with an external velocity field.
The interior advection contribution is:
Boundary contributions depend on the flow direction and are treated in the next section.
Boundary Conditions¶
Each boundary condition modifies the face integrals that arise during integration by parts on .
Diffusion¶
Dirichlet ( on ):
Imposed weakly by treating faces as one-sided SIPG faces, mirroring the interior treatment:
Neumann ( on ):
The boundary flux integral is replaced directly by the prescribed value. No penalty is needed:
The homogeneous case is the natural condition and requires no modification.
Robin ( on , ):
Substituting the Robin condition into the boundary face integral:
The term enters the bilinear form; moves to the right-hand side.
Advection¶
Inflow ( on , ):
The upwind value is the prescribed inflow data; information enters from outside the domain:
Since on , this contributes positively for positive inflow data.
Outflow ( on ):
The upwind value is the interior trace ; no data needs to be prescribed:
This is the natural outflow condition for DG upwinding.
Wall / Symmetry ( on ):
No advective flux crosses the boundary. The face integral vanishes, so no term is added for either walls or symmetry planes.
The Complete Weak Formulation¶
Find such that for all , where:
Bilinear form:
Linear form:
Coupling with an External Velocity Field¶
The formulation above assumes a velocity field that is either prescribed analytically or represented continuously, divergence-free in the discrete sense, and exactly tangential on walls. When is instead supplied by an external solver such as OpenFOAM, each of these assumptions relaxes, and the face integrals need care. The issues divide into three groups.
Single-valued face flux¶
OpenFOAM stores its velocity as cell-centred values together with a set of face-normal mass fluxes that are, by construction, single-valued per face and conservative at the discrete level. Interpolating the cell-centred velocity into a DG space on the transport mesh and reconstructing from it loses both properties: the two sides of an interior face disagree, and .
The compact identity used for the interior advection integral then no longer collapses to an upwind flux. Two equivalent fixes are available:
Replace the compact form by an explicit upwind flux that does not rely on single-valuedness of : $$ \hat{f}_\text{adv} = \tfrac{1}{2} \bigl( \mathbf{w}_0\cdot\mathbf{n}, u_0 + \mathbf{w}_1\cdot\mathbf{n}, u_1 \bigr)
\tfrac{1}{2} \bigl| \langle \mathbf{w}\rangle\cdot\mathbf{n} \bigr|, \llbracket u \rrbracket. $$
Transfer the face-flux field directly from OpenFOAM and use it as the advective transport coefficient on each face, replacing by (or by if a volumetric flux is used). The upwind branch is then selected on the sign of . This is the option that preserves OpenFOAM’s flux conservation and is generally preferred.
In either case the boundary face integrals must use the same face flux, not the reconstructed , so that the inflow and outflow splits remain consistent.
Discrete divergence¶
The physical field is divergence-free, but the interpolant on the transport mesh is not, in general. The two forms
differ by , which is zero at the continuum level but acts as a spurious source when . Two options are available:
Use the skew-symmetric or non-conservative form when deriving the weak form. This trades local conservation for reduced sensitivity to interpolation error in and is the pragmatic choice when the velocity is known only approximately.
Project onto a divergence-conforming space such as Raviart-Thomas or BDM, which preserves at the discrete level. This keeps the conservative form valid but adds a projection step and couples the transport mesh more tightly to the flow discretisation.
When the face-flux form (option 2 above) is used, conservation is enforced through directly and this divergence mismatch does not arise in the same way.
Wall boundary flux¶
On no-slip or symmetry walls the physical condition is , and the corresponding face integral vanishes. An interpolated velocity field rarely satisfies this exactly: a small residual normal component acts as a spurious inflow or outflow, with the sign and magnitude depending on the interpolation. The safest treatment is to enforce explicitly on wall facets, either by masking the integrand or by using the face-flux field , which is identically zero on OpenFOAM wall patches and therefore introduces no leak.
Mesh transfer¶
All of the above assumes that values defined on the OpenFOAM mesh have been transferred to the transport mesh. Mesh-to-mesh interpolation is itself a source of error, particularly at boundaries and in regions with large velocity gradients, and its treatment is outside the scope of this note. For the purposes of this formulation, we assume that either a face-flux field or a cell-centred velocity has been made available on the transport mesh by a method appropriate to the coupling.
Further Reading¶
Arnold et al. (2002), Unified analysis of discontinuous Galerkin methods for elliptic problems, SIAM J. Numer. Anal.
Di Pietro & Ern (2012), Mathematical Aspects of Discontinuous Galerkin Methods, Springer