DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::EulerP::PhysicsDeviceView< B > Struct Template Reference

Device-callable view of physics parameters providing thermodynamic operations. More...

#include <EulerP_Physics.hpp>

Collaboration diagram for DNDS::EulerP::PhysicsDeviceView< B >:
[legend]

Public Member Functions

template<class tUPrim , class tDiffUPrim >
DNDS_DEVICE_CALLABLE real getMuTot (tUPrim &&UPrim, tDiffUPrim &&DiffUPrim, int nVars, real p, real T) const
 Computes the total dynamic viscosity.
 
template<class tUPrim , class tU >
DNDS_DEVICE_CALLABLE void Cons2Prim (tU &&U, tUPrim &&UPrim, int nVars) const
 Converts conservative state to primitive state.
 
template<class tU , class tUPrim , class tDiffU , class tDiffUPrim >
DNDS_DEVICE_CALLABLE void Cons2PrimDiff (tU &&U, tUPrim &&UPrim, tDiffU &&DiffU, tDiffUPrim &&DiffUPrim, int nVars) const
 Converts conservative variable gradients to primitive variable gradients.
 
template<class tUPrim , class tU >
DNDS_DEVICE_CALLABLE void Prim2Cons (tUPrim &&UPrim, tU &&U, int nVars) const
 Converts primitive state to conservative state.
 
template<class tU >
DNDS_DEVICE_CALLABLE real Cons2EInternal (tU &&U, int nVars) const
 Extracts internal energy from a conservative state vector.
 
template<class tUPrim >
DNDS_DEVICE_CALLABLE real Prim2Pressure (tUPrim &&UPrim, int nVars, real T) const
 Computes pressure from the primitive state using the ideal gas law.
 
template<class tUPrim >
DNDS_DEVICE_CALLABLE auto Prim2GammaAcousticSpeed (tUPrim &&UPrim, int nVars, real p) const
 Computes the ratio of specific heats and the acoustic speed of sound.
 
template<class tUPrim >
DNDS_DEVICE_CALLABLE real Prim2Temperature (tUPrim &&UPrim, int nVars) const
 Computes temperature from the primitive state.
 
template<class tU >
DNDS_DEVICE_CALLABLE real Pressure2Enthalpy (tU &&U, int nVars, real p) const
 Computes specific total enthalpy from conservative state and pressure.
 
template<class tU >
DNDS_DEVICE_CALLABLE real Enthalpy2Pressure (tU &&U, int nVars, real H) const
 Recovers pressure from specific total enthalpy and conservative state.
 

Public Attributes

vector_DeviceView< B, real, int32_t > reference_values
 Device-resident reference values (e.g., freestream quantities).
 
PhysicsParams params
 Gas physical parameters (copied to device).
 

Detailed Description

template<DeviceBackend B>
struct DNDS::EulerP::PhysicsDeviceView< B >

Device-callable view of physics parameters providing thermodynamic operations.

Wraps a device-resident view of reference values and a copy of PhysicsParams. All methods are DNDS_DEVICE_CALLABLE for use in both Host and CUDA kernels.

Note
Primitive state convention: prim[0] = rho, prim[1..3] = velocity, prim[I4] = internal energy (rho*e). This differs from the Euler module where prim[I4] stores pressure.
Template Parameters
BDevice backend (Host or CUDA).

Definition at line 63 of file EulerP_Physics.hpp.

Member Function Documentation

◆ Cons2EInternal()

template<DeviceBackend B>
template<class tU >
DNDS_DEVICE_CALLABLE real DNDS::EulerP::PhysicsDeviceView< B >::Cons2EInternal ( tU &&  U,
int  nVars 
) const
inline

Extracts internal energy from a conservative state vector.

Computes e = E - 0.5 * (rhoU^2 + rhoV^2 + rhoW^2) / rho.

Template Parameters
tUConservative state vector type (deduced).
Parameters
UConservative state vector.
nVarsTotal number of variables (flow + turbulence).
Returns
Internal energy e = rho * cv * T for an ideal gas.

Definition at line 222 of file EulerP_Physics.hpp.

Here is the call graph for this function:

◆ Cons2Prim()

template<DeviceBackend B>
template<class tUPrim , class tU >
DNDS_DEVICE_CALLABLE void DNDS::EulerP::PhysicsDeviceView< B >::Cons2Prim ( tU &&  U,
tUPrim &&  UPrim,
int  nVars 
) const
inline

Converts conservative state to primitive state.

Computes primitive variables from conservative variables:

  • prim[0] = rho (density, copied directly)
  • prim[1..3] = velocity components (U_i / rho)
  • prim[I4] = internal energy e = E - 0.5 * rho * v^2
  • prim[i >= nVarsFlow] = U_i / rho (specific turbulence quantities)
Note
prim[I4] stores internal energy (rho*e), NOT pressure.
Template Parameters
tUPrimPrimitive state vector type (deduced).
tUConservative state vector type (deduced).
Parameters
UInput conservative state vector.
[out]UPrimOutput primitive state vector.
nVarsTotal number of variables (flow + turbulence).

Definition at line 112 of file EulerP_Physics.hpp.

Here is the call graph for this function:

◆ Cons2PrimDiff()

template<DeviceBackend B>
template<class tU , class tUPrim , class tDiffU , class tDiffUPrim >
DNDS_DEVICE_CALLABLE void DNDS::EulerP::PhysicsDeviceView< B >::Cons2PrimDiff ( tU &&  U,
tUPrim &&  UPrim,
tDiffU &&  DiffU,
tDiffUPrim &&  DiffUPrim,
int  nVars 
) const
inline

Converts conservative variable gradients to primitive variable gradients.

Given conservative state U, primitive state UPrim, and conservative gradient DiffU, computes the corresponding primitive gradient DiffUPrim using the chain rule:

  • nabla(v_i) = (nabla(rho*v_i) - nabla(rho) * v_i) / rho
  • nabla(e) = nabla(E) - 0.5 * nabla(rho) * v^2 - rho * dot(nabla(v), v)
Template Parameters
tUConservative state type (deduced).
tUPrimPrimitive state type (deduced).
tDiffUConservative gradient type (deduced), 3 x nVars.
tDiffUPrimPrimitive gradient type (deduced), 3 x nVars.
Parameters
UConservative state vector.
UPrimPrimitive state vector (must be pre-computed via Cons2Prim).
DiffUConservative variable spatial gradients (3 rows = x,y,z directions).
[out]DiffUPrimOutput primitive variable spatial gradients.
nVarsTotal number of variables (flow + turbulence).

Definition at line 149 of file EulerP_Physics.hpp.

Here is the call graph for this function:

◆ Enthalpy2Pressure()

template<DeviceBackend B>
template<class tU >
DNDS_DEVICE_CALLABLE real DNDS::EulerP::PhysicsDeviceView< B >::Enthalpy2Pressure ( tU &&  U,
int  nVars,
real  H 
) const
inline

Recovers pressure from specific total enthalpy and conservative state.

p = H * rho - E (inverse of Pressure2Enthalpy).

Template Parameters
tUConservative state vector type (deduced).
Parameters
UConservative state vector.
nVarsTotal number of variables.
HSpecific total enthalpy.
Returns
Pressure p.

perfect gas here

Definition at line 324 of file EulerP_Physics.hpp.

◆ getMuTot()

template<DeviceBackend B>
template<class tUPrim , class tDiffUPrim >
DNDS_DEVICE_CALLABLE real DNDS::EulerP::PhysicsDeviceView< B >::getMuTot ( tUPrim &&  UPrim,
tDiffUPrim &&  DiffUPrim,
int  nVars,
real  p,
real  T 
) const
inline

Computes the total dynamic viscosity.

Currently returns only the physical viscosity (no RANS turbulence model contribution).

Template Parameters
tUPrimPrimitive state vector type (deduced).
tDiffUPrimPrimitive state gradient type (deduced).
Parameters
UPrimPrimitive state vector (unused in current constant-viscosity model).
DiffUPrimPrimitive gradient (unused in current constant-viscosity model).
nVarsTotal number of variables (flow + turbulence).
pPressure (unused in current model).
TTemperature (unused in current model).
Returns
Total dynamic viscosity mu_total = mu_physical.

Definition at line 85 of file EulerP_Physics.hpp.

◆ Pressure2Enthalpy()

template<DeviceBackend B>
template<class tU >
DNDS_DEVICE_CALLABLE real DNDS::EulerP::PhysicsDeviceView< B >::Pressure2Enthalpy ( tU &&  U,
int  nVars,
real  p 
) const
inline

Computes specific total enthalpy from conservative state and pressure.

H = (E + p) / rho, using IdealGas::Enthalpy.

Template Parameters
tUConservative state vector type (deduced).
Parameters
UConservative state vector.
nVarsTotal number of variables.
pPressure.
Returns
Specific total enthalpy H.

perfect gas here

Definition at line 305 of file EulerP_Physics.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prim2Cons()

template<DeviceBackend B>
template<class tUPrim , class tU >
DNDS_DEVICE_CALLABLE void DNDS::EulerP::PhysicsDeviceView< B >::Prim2Cons ( tUPrim &&  UPrim,
tU &&  U,
int  nVars 
) const
inline

Converts primitive state to conservative state.

Inverse of Cons2Prim:

  • cons[0] = rho
  • cons[1..3] = rho * v_i
  • cons[I4] = E = e + 0.5 * rho * v^2 (total energy)
  • cons[i >= nVarsFlow] = rho * prim_i
Template Parameters
tUPrimPrimitive state vector type (deduced).
tUConservative state vector type (deduced).
Parameters
UPrimInput primitive state vector.
[out]UOutput conservative state vector.
nVarsTotal number of variables (flow + turbulence).

Definition at line 193 of file EulerP_Physics.hpp.

Here is the call graph for this function:

◆ Prim2GammaAcousticSpeed()

template<DeviceBackend B>
template<class tUPrim >
DNDS_DEVICE_CALLABLE auto DNDS::EulerP::PhysicsDeviceView< B >::Prim2GammaAcousticSpeed ( tUPrim &&  UPrim,
int  nVars,
real  p 
) const
inline

Computes the ratio of specific heats and the acoustic speed of sound.

Template Parameters
tUPrimPrimitive state vector type (deduced).
Parameters
UPrimPrimitive state vector.
nVarsTotal number of variables.
pPressure.
Returns
A std::tuple of (gamma, speed_of_sound) where a = sqrt(gamma * p / rho).

Definition at line 268 of file EulerP_Physics.hpp.

Here is the call graph for this function:

◆ Prim2Pressure()

template<DeviceBackend B>
template<class tUPrim >
DNDS_DEVICE_CALLABLE real DNDS::EulerP::PhysicsDeviceView< B >::Prim2Pressure ( tUPrim &&  UPrim,
int  nVars,
real  T 
) const
inline

Computes pressure from the primitive state using the ideal gas law.

Delegates to IdealGas::Pressure_From_InternalEnergy using prim[I4] (internal energy) and the ratio of specific heats gamma.

Template Parameters
tUPrimPrimitive state vector type (deduced).
Parameters
UPrimPrimitive state vector (prim[I4] = internal energy).
nVarsTotal number of variables.
TTemperature (unused; pressure is computed from internal energy directly).
Returns
Pressure p = (gamma - 1) * e.

perfect gas here — prim[I4] stores internal energy e

Definition at line 251 of file EulerP_Physics.hpp.

Here is the call graph for this function:

◆ Prim2Temperature()

template<DeviceBackend B>
template<class tUPrim >
DNDS_DEVICE_CALLABLE real DNDS::EulerP::PhysicsDeviceView< B >::Prim2Temperature ( tUPrim &&  UPrim,
int  nVars 
) const
inline

Computes temperature from the primitive state.

For a perfect gas: T = e / (rho * cp), where e = prim[I4] is internal energy.

Template Parameters
tUPrimPrimitive state vector type (deduced).
Parameters
UPrimPrimitive state vector.
nVarsTotal number of variables.
Returns
Temperature T.

perfect gas here

Definition at line 286 of file EulerP_Physics.hpp.

Member Data Documentation

◆ params

Gas physical parameters (copied to device).

Definition at line 66 of file EulerP_Physics.hpp.

◆ reference_values

template<DeviceBackend B>
vector_DeviceView<B, real, int32_t> DNDS::EulerP::PhysicsDeviceView< B >::reference_values

Device-resident reference values (e.g., freestream quantities).

Definition at line 65 of file EulerP_Physics.hpp.


The documentation for this struct was generated from the following file: