Euler Module Unit Tests¶
Tests for the compressible Navier-Stokes solver module (src/Euler/).
All C++ tests use doctest.
Building and Running¶
# Build all Euler C++ test executables
cmake --build build -t euler_unit_tests -j8
# Run every Euler CTest (serial + MPI np=1,2,4)
ctest --test-dir build -R euler_ --output-on-failure
# Run a single test
ctest --test-dir build -R euler_gas_thermo --output-on-failure
Target Summary¶
CMake target |
CTest names |
Source file |
Type |
|---|---|---|---|
|
|
test_GasThermo.cpp |
Serial |
|
|
test_RiemannSolvers.cpp |
Serial |
|
|
test_RANS.cpp |
Serial |
|
|
test_EulerEvaluator.cpp |
MPI (600 s) |
Gas Thermodynamics and Eigenvectors (test_GasThermo.cpp)¶
See also: test_GasThermo.cpp
Serial tests for ideal-gas thermodynamics and Euler eigenvector routines
in Gas.hpp. 22 test cases, 93 assertions. No MPI or mesh; all
functions are pure.
IdealGasThermal¶
Test case |
Description |
|---|---|
|
rho=1, p=1/gamma: checks a=1, H=gamma/(gamma-1), internal energy. |
|
Supersonic state: verifies p, a, H, total energy. |
Conservative / Primitive Round-Trip¶
Test case |
Description |
|---|---|
|
5-component state round-trips to 1e-14. |
|
4-component state round-trips to 1e-14. |
|
Manually computed state matches exactly. |
Stagnation Quantities¶
Test case |
Description |
|---|---|
|
At rest: p0 = p, T0 = T. |
|
Stagnation pressure exceeds static pressure. |
Eigenvectors¶
Verifies L * R = I (orthogonality) for the Euler flux Jacobian eigenvectors.
Test case |
Description |
|---|---|
|
Quiescent state, x-normal. |
|
Moving flow, oblique normal. |
|
Same check via |
Inviscid Flux¶
Test case |
Description |
|---|---|
|
F = [0, p, 0, 0, 0] at rest. |
|
Full flux against hand-computed values. |
|
Rotated-normal variant matches direct formula. |
Conservative Increments¶
Test case |
Description |
|---|---|
|
delta_U = 0 produces delta_{u,p} = 0. |
|
Increment matches prim(U+dU) - prim(U) to O(dU^2). |
Roe Average¶
Test case |
Description |
|---|---|
|
Roe(U,U) = U. |
|
rho_Roe = sqrt(rhoL * rhoR). |
Gradient Transformation¶
Test case |
Description |
|---|---|
|
Pure sanity check. |
|
Transformed gradient matches numerical differentiation. |
Compression Ratio and Viscous Flux¶
Test case |
Description |
|---|---|
|
No compression needed for zero perturbation. |
|
Output is bounded for random perturbations. |
|
Sanity check for viscous flux routine. |
Riemann Solvers (test_RiemannSolvers.cpp)¶
See also: test_RiemannSolvers.cpp
Serial tests for Roe, HLLC, and HLLEP Riemann solvers in Gas.hpp.
11 test cases, 147 assertions.
Consistency (F(U,U) = exact flux)¶
Test case |
Description |
|---|---|
|
F_Roe(U,U,n) == F_exact(U,n). |
|
Same check for HLLC. |
|
Same check for HLLEP. |
|
Oblique normal n = (1,1,1)/sqrt(3). |
Variant Consistency¶
Test case |
Description |
|---|---|
|
eigScheme 1,3,4,5,6,7,8 pass consistency; 2 and 9 are unimplemented. |
Symmetry (F(UL,UR,n) = -F(UR,UL,-n))¶
Test case |
Description |
|---|---|
|
Verified for 3 state pairs. |
|
Same check with 3 pairs. |
Sod Shock Tube¶
Test case |
Description |
|---|---|
|
UL=(1,0,0,0,2.5), UR=(0.125,0,0,0,0.25): flux has finite components. |
Golden Values¶
Test case |
Description |
|---|---|
|
Roe, HLLC, HLLEP flux components against captured golden values (tolerance 1e-8). |
Additional Checks¶
Test case |
Description |
|---|---|
|
Roe, HLLC, HLLEP agree on a zero-velocity state. |
|
Wave speed ordering: u-a < u < u+a. |
RANS Turbulence Models (test_RANS.cpp)¶
See also: test_RANS.cpp
Serial tests for k-omega Wilcox 2006, k-omega SST, and Realizable k-epsilon
model functions in RANS_ke.hpp. 26 test cases, 48 assertions.
The SA model is excluded because GetSource_SA references
EulerEvaluator::settings (evaluator context) and cannot be tested
standalone. SA coverage is provided through the EulerEvaluator pipeline
test on the NACA0012 case.
Turbulent Viscosity (GetMut)¶
Test case |
Description |
|---|---|
|
mut >= 0. |
|
CFL3D limiting. |
|
Regression against captured value. |
|
mut >= 0. |
|
CFL3D limiting. |
|
Regression against captured value. |
|
mut >= 0. |
|
CFL3D limiting. |
|
Regression against captured value. |
Mut Sensitivity¶
Test case |
Description |
|---|---|
|
Higher k produces higher mut. |
|
Same check for SST. |
|
Robustness near zero. |
|
Robustness near zero. |
|
Robustness near zero. |
Source Terms (GetSource, mode=0: full)¶
Test case |
Description |
|---|---|
|
Zero velocity gradient: production=0, destruction from omega. |
|
Same check for SST. |
|
Same check for Realizable k-epsilon. |
|
Non-zero dU/dx: golden source vector regression. |
|
Same check for SST. |
|
Same check for Realizable k-epsilon. |
Source Terms (mode=1: implicit Jacobian diagonal)¶
Test case |
Description |
|---|---|
|
Diagonal terms are >= 0 (stabilizing). |
|
Same check for SST. |
Viscous Flux (GetVisFlux)¶
Test case |
Description |
|---|---|
|
No gradient, no transport. |
|
Same for SST. |
|
Same for Realizable k-epsilon. |
|
Non-zero dk/dx generates flux in the k-equation. |
EulerEvaluator Pipeline (test_EulerEvaluator.cpp)¶
See also: test_EulerEvaluator.cpp
MPI integration test (np=1,2,4, 600 s timeout) exercising the full evaluator pipeline: config → mesh → initialize DOF → EvaluateDt → EvaluateRHS → Jacobi solve (Forward + Backward).
For each case the test measures:
RHS L1 norm (golden regression)
Jacobi increment L1 norm (golden regression)
Jacobi update (not LU-SGS) is used for MPI-deterministic increment norms.
Test Cases¶
Test case |
Config |
Physics |
Mesh |
Notes |
|---|---|---|---|---|
|
euler_config_IV.json |
Inviscid, isentropic vortex |
IV10_10 (100 quads, periodic) |
2D Euler |
|
eulerSA_config.json |
Viscous + SA turbulence |
NACA0012_H2 (external, wall) |
Tests SA model in-situ |
|
euler3D_config_Box.json |
Inviscid, 3D periodic |
Uniform32_3D_Periodic (32768 hexes) |
3D Euler |
Pipeline Steps¶
For each case:
Write default config with
ConfigureFromJson(path, false), then merge-patch with the case JSON and test overrides (Jacobi update, P1, absolute mesh paths).ReadMeshAndInitialize— reads mesh, builds VR.eval.InitializeUDOF(u)— sets initial condition.EvaluateDt— computes local time steps.EvaluateRHS— computes the spatial residual.LUSGSMatrixInit + Forward + Backward— one Jacobi-style iteration (despite the LU-SGS name, the code path uses Jacobi when configured).Check RHS and increment norms against golden values (tolerance 1e-6).