# LaxCG

This page describes the numerical method in `LaxCG`

at a high level, for more details, see Papers.

The numerical method in LaxCG is an edge-based finite element method for unstructured meshes, composed of tetrahedral cells, intended for the mathematical modelling of flows at all Mach numbers. The implementation borrows elements of RieCG, which is not efficient at low Mach numbers, and thus LaxCG applies a preconditioning technique to enable computation of flows at all Mach numbers. The preconditioner is detailed by Luo, Baum, and Lohner, Extension of Harten-Lax-van Leer Scheme for Flows at All Speeds, AIAA Journal, 2005. The implementation uses the asynchronous-by-default, distributed-memory, task-parallel programming paradigm using the Charm++ runtime system. The super-edge-based implementation of the finite element operators help reduce indirect addressing and increases performance.

## The equations of compressible flow

The equations solved are the 3D unsteady Euler equations, governing inviscid compressible flow,

where the summation convention on repeated indices has been applied, is the density, is the velocity vector, is the pressure. and the specific total energy, , is related to the internal energy, , as

The system is closed with the ideal gas law equation of state

where is the ratio of specific heats. Although the ideal gas law is used most frequently, any arbitrary (i.e. analytic or tabulated) equation of state can be used to relate density and internal energy to pressure.

## Time-derivative preconditioning for all Mach numbers

Because of the large ratio of acoustic and convective timescales density-based solvers, such as RieCG, are not efficient, frequently fail to converge, or may converge to the wrong solution in low-Mach-number or constant-density flows at low-speed flow regimes. One way to remedy this stiffness and associated convergence problems is to apply a preconditioner to the governing equations. The idea is to write the system as

which is solved for the *Q* vector of primitive variables of pressure, velocity, and temperature, *T*,

The preconditioner is given by

where the total enthalpy, *H*, is related to the total energy as

and

where the reference velocity is specified as

where *c* is the local speed of sound, is a fixed reference velocity, and *K* is a constant.

## The numerical method

In LaxCG the preconditioned system

is discretized with an edge-based finite-element method for linear tetrahedra. The unknown solution quantities are the primitive variables *Q* and are located at the nodes of the mesh. The solution at any point within the computational domain is represented as

where is the tetrahedron containing the point , is the solution of primitive variables at vertex , and is a linear basis function associated with vertex and element . Applying a Galerkin, lumped-mass approximation to the preconditioned system gives the following semi-discrete form of the governing equations for a vertex *v*:

where *vw* represents all edges connected to *v*, is the volume surrounding *v*, is the numerical flux between *v* and *w*. The first term on the right-hand-side above is evaluated for all vertices within the domain. The last two terms are evaluated only at the domain boundary. denotes the boundary flux. The term is effectively the area-weighted normal to the dual face separating *v* and *w* and calculated as

where represents all elements attached to edge *vw*. This numerical scheme is guaranteed to be conservative since is antisymmetric. The boundary terms and are defined as

where **n** is the outward-pointing surface normal.

Note that the above algorithm can be viewed as either an edge-based finite element method on tetrahedron meshes or a node-centered finite volume method (on the dual mesh, consisting of arbitrary polyhedra). For the derivation of the above and other details, see Papers.

## Numerical flux

The numerical flux is evaluated at the midpoint between *v* and *w*. One option is to use Rusanov's flux which approximates the flux between *v* and *w* as

where the wave speed of the preconditioned system for edge *vw* is computed as

from the wave speeds at node *v* (and analogously at node *w*) as

with all quantities evaluated in vertex *v*.

Another option is to use the Harten-Lax-van Leer-Contact (HLLC) flux using the modified signal velocities, described by Luo, Baum, and Lohner, Extension of Harten-Lax-van Leer Scheme for Flows at All Speeds, AIAA Journal, 2005, which in LaxCG is implemented as given in Waltz, et al, A three-dimensional finite element arbitrary Lagrangian–Eulerian method for shock hydrodynamics on unstructured grids, Computers & Fluids, 92: 172-187, 2014.

## Solution reconstruction

The inputs to the flux function above are approximated using a piecewise limited solution reconstruction of the variables, *q*, denoting the scalar components of the primitive variables, *Q*. The reconstruction is performed component-wise for each edge as follows:

with

This scheme corresponds to a piecewise linear reconstruction for *k = -1* and a piecewise parabolic reconstruction for *k = 1/3*. The function can be any total variation diminishing limiter function, e.g., that of van Leer. The gradients of the primitive variables are computed in all mesh points based on the edge-based formulation as

where *q* are scalar components of the primitive variables, *Q*. The above summations are over all edges that contribute to point v.

## Time integration

The solution is advanced using a multi-stage explicit scheme of the form:

where *r* is the right hand side of the discretized governing equations, *k* is the current stage, *m* is the number of stages, is the time step size, and

The explicit Euler time marching scheme is obtained for *m = 1* and the classical 2nd-order Runge-Kutta method is obtained with *m = 2*. The time step size is adaptive and obtained by finding the minimum value for all mesh points at every time step as

where is the Courant number.