DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
test_GasThermo.cpp File Reference

Unit tests for ideal-gas thermodynamics and eigenvector routines in Gas.hpp. More...

#include "doctest.h"
#include "Euler/Gas.hpp"
#include <Eigen/Dense>
#include <cmath>
#include <iostream>
Include dependency graph for test_GasThermo.cpp:

Go to the source code of this file.

Macros

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
 

Functions

 TEST_CASE ("IdealGasThermal: standard quiescent air")
 
 TEST_CASE ("IdealGasThermal: Mach 2 flow")
 
 TEST_CASE ("Cons2Prim and Prim2Cons round-trip: 3D")
 
 TEST_CASE ("Cons2Prim and Prim2Cons round-trip: 2D")
 
 TEST_CASE ("Prim2Cons: known state verification")
 
 TEST_CASE ("PrimitiveGetP0T0: quiescent gas")
 
 TEST_CASE ("PrimitiveGetP0T0: p0 > p for moving gas")
 
 TEST_CASE ("EulerGas eigenvectors: L*R = I for 3D")
 
 TEST_CASE ("GasInviscidFlux: x-direction, quiescent gas")
 
 TEST_CASE ("GasInviscidFlux: x-direction, moving gas")
 
Eigen::Vector3d vg (0, 0, 0)
 
 IdealGasThermal (U(4), U(0), velo.squaredNorm(), g_gamma, p_val, asqr, H)
 
 GasInviscidFlux< 3 > (U, velo, vg, p_val, Fx)
 
Eigen::Vector3d nx (1, 0, 0)
 
 GasInviscidFlux_XY< 3 > (U, velo, vg, nx, p_val, Fn)
 
 for (int i=0;i< 5;i++)
 
 TEST_CASE ("IdealGasUIncrement: zero increment gives zero output")
 
 TEST_CASE ("IdealGasUIncrement: finite-difference verification")
 
 TEST_CASE ("GetRoeAverage: identical states give same state")
 
 TEST_CASE ("GetRoeAverage: density is geometric mean")
 
 TEST_CASE ("GradientCons2Prim: zero gradient produces zero")
 
 TEST_CASE ("GradientCons2Prim: finite-difference verification")
 
 CHECK (alpha==doctest::Approx(0.0).epsilon(1e-14))
 
 TEST_CASE ("CompressionRatio: alpha in [0,1]")
 
 TEST_CASE ("ViscousFlux: zero gradient produces zero flux")
 

Variables

Eigen::Vector3d velo = U.segment<3>(1) / U(0)
 
real p_val
 
Eigen::Vector< real, 5 > Fx
 
Eigen::Vector< real, 5 > Fn
 
Eigen::Vector< real, 5 > dU = Eigen::Vector<real, 5>::Zero()
 
real alpha = IdealGasGetCompressionRatioPressure<3, 0, 5>(U, dU, 0.0)
 

Detailed Description

Unit tests for ideal-gas thermodynamics and eigenvector routines in Gas.hpp.

Tests cover:

  • IdealGasThermal: pressure, speed-of-sound, enthalpy from conservative
  • Conservative2Primitive / Primitive2Conservative round-trip (2D and 3D)
  • PrimitiveGetP0T0: stagnation quantities
  • EulerGasRightEigenVector / LeftEigenVector: L*R = I orthogonality (3D)
  • IdealGas_EulerGas{Right,Left}EigenVector convenience wrappers
  • IdealGasUIncrement: velocity/pressure increments from conservative increments
  • GasInviscidFlux / GasInviscidFlux_XY: inviscid flux computation
  • GradientCons2Prim_IdealGas: gradient transformation
  • GetRoeAverage: Roe-averaged state properties
  • IdealGasGetCompressionRatioPressure: positivity limiter

All functions are pure (no MPI, no mesh). Serial doctest.

Definition in file test_GasThermo.cpp.

Macro Definition Documentation

◆ DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN

Definition at line 20 of file test_GasThermo.cpp.

Function Documentation

◆ CHECK()

CHECK ( alpha  = =doctest::Approx(0.0).epsilon(1e-14))
Here is the caller graph for this function:

◆ for()

for ( )

Definition at line 295 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ GasInviscidFlux< 3 >()

GasInviscidFlux< 3 > ( ,
velo  ,
vg  ,
p_val  ,
Fx   
)
Here is the caller graph for this function:

◆ GasInviscidFlux_XY< 3 >()

GasInviscidFlux_XY< 3 > ( ,
velo  ,
vg  ,
nx  ,
p_val  ,
Fn   
)

◆ IdealGasThermal()

IdealGasThermal ( U(4)  ,
U(0)  ,
velo.  squaredNorm(),
g_gamma  ,
p_val  ,
asqr  ,
 
)

◆ nx()

Eigen::Vector3d nx ( ,
,
 
)

◆ TEST_CASE() [1/18]

TEST_CASE ( "CompressionRatio: alpha in "  [0, 1])

Definition at line 458 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [2/18]

TEST_CASE ( "Cons2Prim and Prim2Cons round-trip: 2D"  )

Definition at line 107 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [3/18]

TEST_CASE ( "Cons2Prim and Prim2Cons round-trip: 3D"  )

Definition at line 91 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [4/18]

TEST_CASE ( )

Definition at line 174 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [5/18]

TEST_CASE ( "GasInviscidFlux: x direction,
moving gas"   
)

Definition at line 257 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [6/18]

TEST_CASE ( "GasInviscidFlux: x direction,
quiescent gas"   
)

Definition at line 240 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [7/18]

TEST_CASE ( "GetRoeAverage: density is geometric mean"  )

Definition at line 381 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [8/18]

TEST_CASE ( "GetRoeAverage: identical states give same state"  )

Definition at line 358 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [9/18]

TEST_CASE ( "GradientCons2Prim: finite-difference verification"  )

Definition at line 411 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [10/18]

TEST_CASE ( "GradientCons2Prim: zero gradient produces zero"  )

Definition at line 400 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [11/18]

TEST_CASE ( "IdealGasThermal: Mach 2 flow"  )

Definition at line 72 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [12/18]

TEST_CASE ( "IdealGasThermal: standard quiescent air"  )

Definition at line 57 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [13/18]

TEST_CASE ( "IdealGasUIncrement: finite-difference verification"  )

Definition at line 320 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [14/18]

TEST_CASE ( "IdealGasUIncrement: zero increment gives zero output"  )

Definition at line 306 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [15/18]

TEST_CASE ( "Prim2Cons: known state verification"  )

Definition at line 123 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [16/18]

TEST_CASE ( "PrimitiveGetP0T0:  p0,
p for moving gas"   
)

Definition at line 157 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [17/18]

TEST_CASE ( "PrimitiveGetP0T0: quiescent gas"  )

Definition at line 143 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ TEST_CASE() [18/18]

TEST_CASE ( "ViscousFlux: zero gradient produces zero flux"  )

Definition at line 479 of file test_GasThermo.cpp.

Here is the call graph for this function:

◆ vg()

Eigen::Vector3d vg ( ,
,
 
)
Here is the caller graph for this function:

Variable Documentation

◆ alpha

real alpha = IdealGasGetCompressionRatioPressure<3, 0, 5>(U, dU, 0.0)

Definition at line 454 of file test_GasThermo.cpp.

◆ dU

Eigen::Vector<real, 5> dU = Eigen::Vector<real, 5>::Zero()

Definition at line 452 of file test_GasThermo.cpp.

◆ Fn

Eigen::Vector<real, 5> Fn

Definition at line 290 of file test_GasThermo.cpp.

◆ Fx

Eigen::Vector<real, 5> Fx

Definition at line 290 of file test_GasThermo.cpp.

◆ p_val

real p_val

Definition at line 284 of file test_GasThermo.cpp.

◆ velo

Eigen::Vector3d velo = U.segment<3>(1) / U(0)

Definition at line 282 of file test_GasThermo.cpp.