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

Ideal-gas Riemann solvers, flux functions, and thermodynamic utilities for the compressible Euler / Navier-Stokes equations. More...

#include "DNDS/Defines.hpp"
#include "DNDS/IdealGasPhysics.hpp"
#include "DNDS/JsonUtil.hpp"
#include "DNDS/ConfigEnum.hpp"
#include <fmt/core.h>
Include dependency graph for Gas.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DNDS::Euler::Gas::RoePreamble< dim >
 Pre-computed Roe-averaged quantities shared by all Riemann solvers. More...
 

Namespaces

namespace  DNDS
 the host side operators are provided as implemented
 
namespace  DNDS::Euler
 
namespace  DNDS::Euler::Gas
 

Macros

#define DNDS_GAS_CALL_ROE(type)
 
#define DNDS_GAS_CALL_ROE(type)
 

Typedefs

using DNDS::Euler::Gas::tVec = Eigen::Vector3d
 Convenience alias for 3-D real vector.
 
using DNDS::Euler::Gas::tVec2 = Eigen::Vector2d
 Convenience alias for 2-D real vector.
 

Enumerations

enum  DNDS::Euler::Gas::RiemannSolverType {
  DNDS::Euler::Gas::UnknownRS = 0 , DNDS::Euler::Gas::Roe = 1 , DNDS::Euler::Gas::HLLC = 2 , DNDS::Euler::Gas::HLLEP = 3 ,
  DNDS::Euler::Gas::HLLEP_V1 = 21 , DNDS::Euler::Gas::Roe_M1 = 11 , DNDS::Euler::Gas::Roe_M2 = 12 , DNDS::Euler::Gas::Roe_M3 = 13 ,
  DNDS::Euler::Gas::Roe_M4 = 14 , DNDS::Euler::Gas::Roe_M5 = 15 , DNDS::Euler::Gas::Roe_M6 = 16 , DNDS::Euler::Gas::Roe_M7 = 17 ,
  DNDS::Euler::Gas::Roe_M8 = 18 , DNDS::Euler::Gas::Roe_M9 = 19
}
 Selects the approximate Riemann solver and its entropy-fix variant. More...
 

Functions

 DNDS::Euler::Gas::DNDS_DEFINE_ENUM_JSON (RiemannSolverType, { {UnknownRS, "UnknownRS"}, {Roe, "Roe"}, {HLLC, "HLLC"}, {HLLEP, "HLLEP"}, {HLLEP_V1, "HLLEP_V1"}, {Roe_M1, "Roe_M1"}, {Roe_M2, "Roe_M2"}, {Roe_M3, "Roe_M3"}, {Roe_M4, "Roe_M4"}, {Roe_M5, "Roe_M5"}, {Roe_M6, "Roe_M6"}, {Roe_M7, "Roe_M7"}, {Roe_M8, "Roe_M8"}, {Roe_M9, "Roe_M9"}, }) template< int dim
 Fills the right eigenvector matrix for the 1-D Euler system in the x-direction.
 
class TeV inline void DNDS::Euler::Gas::EulerGasRightEigenVector (const TVec &velo, real Vsqr, real H, real a, TeV &ReV)
 
template<int dim = 3, class TVec , class TeV >
void DNDS::Euler::Gas::EulerGasLeftEigenVector (const TVec &velo, real Vsqr, real H, real a, real gamma, TeV &LeV)
 Fills the left eigenvector matrix (inverse of the right eigenvector matrix) for the 1-D Euler system in the x-direction.
 
void DNDS::Euler::Gas::IdealGasThermal (real E, real rho, real vSqr, real gamma, real &p, real &asqr, real &H)
 Thin wrapper delegating to IdealGas::IdealGasThermal.
 
template<int dim = 3, typename TULm , typename TURm , typename TFdumpInfo >
RoePreamble< dim > DNDS::Euler::Gas::ComputeRoePreamble (const TULm &ULm, const TURm &URm, real gamma, const TFdumpInfo &dumpInfo)
 Compute Roe-averaged quantities from mean-state L/R vectors.
 
template<int dim = 3, class TCons , class TPrim >
void DNDS::Euler::Gas::IdealGasThermalConservative2Primitive (const TCons &U, TPrim &prim, real gamma)
 Converts conservative variables to primitive variables for an ideal gas.
 
template<int dim = 3, class TCons , class TPrim >
void DNDS::Euler::Gas::IdealGasThermalPrimitive2Conservative (const TPrim &prim, TCons &U, real gamma)
 Converts primitive variables to conservative variables for an ideal gas.
 
template<int dim = 3, class TPrim >
std::tuple< real, realDNDS::Euler::Gas::IdealGasThermalPrimitiveGetP0T0 (const TPrim &prim, real gamma, real rg)
 Computes total (stagnation) pressure p0 and temperature T0 from a primitive state using isentropic relations.
 
template<int dim = 3, typename TU , typename TF , class TVec , class TVecVG >
void DNDS::Euler::Gas::GasInviscidFlux (const TU &U, const TVec &velo, const TVecVG &vg, real p, TF &F)
 Computes the inviscid (Euler) flux in the x-direction for a moving grid.
 
template<int dim = 3, typename TU , typename TF , class TVec , class TVecN , class TVecVG >
void DNDS::Euler::Gas::GasInviscidFlux_XY (const TU &U, const TVec &velo, const TVecVG &vg, const TVecN &n, real p, TF &F)
 Computes the inviscid flux projected onto an arbitrary face normal n, accounting for grid motion vg.
 
template<int dim = 3, typename TU , typename TF , class TVec , class TVecVG , class TP >
void DNDS::Euler::Gas::GasInviscidFlux_Batch (const TU &U, const TVec &velo, const TVecVG &vg, TP &&p, TF &F)
 Batched x-direction inviscid flux for column-major state matrices.
 
template<int dim = 3, typename TU , typename TF , class TVec , class TVecVG , class TVecN , class TP >
void DNDS::Euler::Gas::GasInviscidFlux_XY_Batch (const TU &U, const TVec &velo, const TVecVG &vg, const TVecN &n, TP &&p, TF &F)
 Batched face-normal inviscid flux for column-major state matrices.
 
template<int dim = 3, typename TU , class TVec >
void DNDS::Euler::Gas::IdealGasUIncrement (const TU &U, const TU &dU, const TVec &velo, real gamma, TVec &dVelo, real &dp)
 Computes velocity and pressure increments from a conservative-state increment, used for the Lax-flux Jacobian computation.
 
template<int dim = 3, typename TU , typename TF , class TVec , class TVecVG >
void DNDS::Euler::Gas::GasInviscidFluxFacialIncrement (const TU &U, const TU &dU, const TVec &unitNorm, const TVecVG &velo, const TVec &dVelo, const TVec &vg, real dp, real p, TF &F)
 Computes the increment of the facial inviscid flux from state, velocity, and pressure increments.
 
template<int dim = 3, typename TU >
auto DNDS::Euler::Gas::IdealGas_EulerGasRightEigenVector (const TU &U, real gamma)
 Convenience wrapper that computes the right eigenvector matrix directly from a conservative state vector U.
 
template<int dim = 3, typename TU >
auto DNDS::Euler::Gas::IdealGas_EulerGasLeftEigenVector (const TU &U, real gamma)
 Convenience wrapper that computes the left eigenvector matrix directly from a conservative state vector U.
 
template<int dim = 3, int type = 0, typename TUL , typename TUR , typename TULm , typename TURm , typename TVecVG , typename TVecN , typename TF , typename TFdumpInfo >
void DNDS::Euler::Gas::HLLEPFlux_IdealGas (const TUL &UL, const TUR &UR, const TULm &ULm, const TURm &URm, const TVecVG &vg, const TVecN &n, real gamma, TF &F, real dLambda, real fixScale, const TFdumpInfo &dumpInfo, real &lam0, real &lam123, real &lam4)
 HLLEP (HLL with Enhanced Pressure) approximate Riemann solver for an ideal gas on a moving grid.
 
template<int dim = 3, typename TUL , typename TUR , typename TULm , typename TURm , typename TVecVG , typename TVecN , typename TF , typename TFdumpInfo >
void DNDS::Euler::Gas::HLLCFlux_IdealGas_HartenYee (const TUL &UL, const TUR &UR, const TULm &ULm, const TURm &URm, const TVecVG &vg, const TVecN &n, real gamma, TF &F, real dLambda, real fixScale, const TFdumpInfo &dumpInfo, real &lam0, real &lam123, real &lam4)
 HLLC (Harten-Lax-van Leer-Contact) approximate Riemann solver for an ideal gas on a moving grid.
 
template<int eigScheme>
void DNDS::Euler::Gas::Roe_EntropyFixer (const real aL, const real aR, const real aAve, const real uL, const real uR, const real uAve, const real VL, const real VR, const real VAve, real dLambda, real fixScale, real incFScale, real &lam0, real &lam123, real &lam4)
 Template-dispatched entropy-fix for Roe-type Riemann solvers.
 
template<int dim = 3, int eigScheme = 0, typename TUL , typename TUR , typename TULm , typename TURm , typename TVecVG , typename TVecN , typename TF , typename TFdumpInfo >
void DNDS::Euler::Gas::RoeFlux_IdealGas_HartenYee (const TUL &UL, const TUR &UR, const TULm &ULm, const TURm &URm, const TVecVG &vg, const TVecN &n, real gamma, TF &F, real dLambda, real fixScale, real incFScale, const TFdumpInfo &dumpInfo, real &lam0, real &lam123, real &lam4)
 Core Roe approximate Riemann solver with a selectable entropy-fix scheme for an ideal gas on a moving grid.
 
template<int dim = 3, typename TUL , typename TUR , typename TVecV , typename TUOut >
void DNDS::Euler::Gas::GetRoeAverage (const TUL &UL, const TUR &UR, real gamma, TVecV &veloRoe, real &vsqrRoe, real &aRoe, real &asqrRoe, real &HRoe, TUOut &UOut)
 Computes the Roe-averaged state vector including passive scalars (e.g. RANS turbulence variables).
 
template<int dim = 3, typename TDU , typename TDF , typename TVecV , typename TVecN >
void DNDS::Euler::Gas::RoeFluxIncFDiff (const TDU &incU, const TVecN &n, const TVecV &veloRoe, real vsqrRoe, real aRoe, real asqrRoe, real HRoe, real lam0, real lam123, real lam4, real gamma, TDF &incF)
 Computes the dissipation part of the Roe flux |A|·dU, given pre-computed Roe averages and entropy-fixed eigenvalues.
 
template<int dim = 3, int eigScheme = 0, typename TUL , typename TUR , typename TULm , typename TURm , typename TVecVG , typename TVecVGm , typename TVecN , typename TVecNm , typename TF , typename TFdumpInfo >
void DNDS::Euler::Gas::RoeFlux_IdealGas_HartenYee_Batch (const TUL &UL, const TUR &UR, const TULm &ULm, const TURm &URm, const TVecVG &vg, const TVecVGm &vgm, const TVecN &n, const TVecNm &nm, real gamma, TF &F, real dLambda, real fixScale, real incFScale, const TFdumpInfo &dumpInfo, real &lam0, real &lam123, real &lam4)
 Batched Roe flux with selectable entropy fix for column-major state matrices.
 
template<int dim = 3, typename TUL , typename TUR , typename TULm , typename TURm , typename TVecVG , typename TVecN , typename TF , typename TFdumpInfo >
void DNDS::Euler::Gas::InviscidFlux_IdealGas_Dispatcher (RiemannSolverType type, TUL &&UL, TUR &&UR, TULm &&ULm, TURm &&URm, TVecVG &&vg, TVecN &&n, real gamma, TF &&F, real dLambda, real fixScale, real incFScale, TFdumpInfo &&dumpInfo, real &lam0, real &lam123, real &lam4)
 Runtime dispatcher from RiemannSolverType to the correct Roe / HLLC / HLLEP template instantiation.
 
template<int dim = 3, typename TUL , typename TUR , typename TULm , typename TURm , typename TVecVG , typename TVecVGm , typename TVecN , typename TVecNm , typename TF , typename TFdumpInfo >
void DNDS::Euler::Gas::InviscidFlux_IdealGas_Batch_Dispatcher (RiemannSolverType type, TUL &&UL, TUR &&UR, TULm &&ULm, TURm &&URm, TVecVG &&vg, TVecVGm &&vgm, TVecN &&n, TVecNm &&nm, real gamma, TF &&F, real dLambda, real fixScale, real incFScale, TFdumpInfo &dumpInfo, real &lam0, real &lam123, real &lam4)
 Runtime dispatcher for batched Roe flux from RiemannSolverType to the correct RoeFlux_IdealGas_HartenYee_Batch template instantiation.
 
template<int dim = 3, typename TU , typename TGradU , typename TFlux , typename TNorm >
void DNDS::Euler::Gas::ViscousFlux_IdealGas (const TU &U, const TGradU &GradUPrim, TNorm norm, bool adiabatic, real gamma, real mu, real mutRatio, bool mutQCRFix, real k, real Cp, TFlux &Flux)
 Computes the viscous (Navier-Stokes) flux projected onto a face normal for an ideal gas.
 
template<int dim = 3, typename TU , typename TGradU , typename TGradUPrim >
void DNDS::Euler::Gas::GradientCons2Prim_IdealGas (const TU &U, const TGradU &GradU, TGradUPrim &GradUPrim, real gamma)
 Converts the gradient of conservative variables to the gradient of primitive variables for an ideal gas.
 
template<int dim, typename TU , typename TGradU >
auto DNDS::Euler::Gas::GetGradVelo (const TU &U, const TGradU &GradU)
 Extracts the velocity gradient tensor from the conservative-variable gradient using the quotient rule.
 
template<int dim = 3, int scheme = 0, int nVarsFixed, typename TU , typename TUInc >
real DNDS::Euler::Gas::IdealGasGetCompressionRatioPressure (const TU &u, const TUInc &uInc, real newrhoEinteralNew)
 Computes the maximum safe compression ratio (scaling factor α ∈ [0,1]) for a conservative-variable increment that keeps internal energy above a prescribed positive floor.
 

Detailed Description

Ideal-gas Riemann solvers, flux functions, and thermodynamic utilities for the compressible Euler / Navier-Stokes equations.

Provides:

  • Right / left eigenvector matrices for the 1-D Euler system.
  • Conservative ↔ primitive variable conversions for an ideal gas.
  • Inviscid flux evaluation in Cartesian and face-normal directions (single and batched variants).
  • Roe, HLLC, and HLLEP approximate Riemann solvers with multiple entropy fix strategies selectable at compile time via the eigScheme template parameter, and at run time through RiemannSolverType dispatch.
  • Viscous (Navier-Stokes) flux with Sutherland viscosity, optional QCR correction, and adiabatic wall treatment.

All functions are templated on the spatial dimension dim (2 or 3) and accept Eigen expression types so that fixed-size and dynamic vectors / matrices are handled without copies.

Definition in file Gas.hpp.

Macro Definition Documentation

◆ DNDS_GAS_CALL_ROE [1/2]

#define DNDS_GAS_CALL_ROE (   type)
Value:
RoeFlux_IdealGas_HartenYee<dim, type>( \
UL, UR, ULm, URm, vg, n, gamma, F, dLambda, fixScale, incFScale, \
dumpInfo, lam0, lam123, lam4)
Eigen::Vector3d vg(0, 0, 0)
Eigen::Vector3d n(1.0, 0.0, 0.0)

◆ DNDS_GAS_CALL_ROE [2/2]

#define DNDS_GAS_CALL_ROE (   type)
Value:
RoeFlux_IdealGas_HartenYee_Batch<dim, type>( \
UL, UR, ULm, URm, vg, vgm, n, nm, gamma, F, dLambda, fixScale, incFScale, \
dumpInfo, lam0, lam123, lam4)