Cholla 3.0.1-dev
Cholla - Massively parallel hydro on GPUs
Loading...
Searching...
No Matches
Classes | Functions
hydro_utilities Namespace Reference

Classes

struct  Conserved
 A data only struct for the conserved variables. More...
 
struct  Primitive
 A data only struct for the primitive variables. More...
 
struct  VectorXYZ
 A data only struct that acts as a simple 3 element vector. More...
 

Functions

__host__ __device__ Real Calc_Pressure_Primitive (Real const &E, Real const &d, Real const &vx, Real const &vy, Real const &vz, Real const &gamma, Real const &magnetic_x=0.0, Real const &magnetic_y=0.0, Real const &magnetic_z=0.0)
 
__host__ __device__ Real Calc_Pressure_Conserved (Real const &E, Real const &d, Real const &mx, Real const &my, Real const &mz, Real const &gamma, Real const &magnetic_x=0.0, Real const &magnetic_y=0.0, Real const &magnetic_z=0.0)
 
__host__ __device__ Real Calc_Temp (Real const &P, Real const &n)
 
__host__ __device__ Real Calc_Temp_Conserved (Real const E, Real const d, Real const mx, Real const my, Real const mz, Real const gamma, Real const n, Real const magnetic_x=0.0, Real const magnetic_y=0.0, Real const magnetic_z=0.0)
 Compute the temperature from the conserved variables.
 
__host__ __device__ Real Calc_Energy_Primitive (Real const &P, Real const &d, Real const &vx, Real const &vy, Real const &vz, Real const &gamma, Real const &magnetic_x=0.0, Real const &magnetic_y=0.0, Real const &magnetic_z=0.0)
 
__host__ __device__ Real Calc_Energy_Conserved (Real const &P, Real const &d, Real const &momentum_x, Real const &momentum_y, Real const &momentum_z, Real const &gamma, Real const &magnetic_x=0.0, Real const &magnetic_y=0.0, Real const &magnetic_z=0.0)
 
__host__ __device__ Real Get_Pressure_From_DE (Real const &E, Real const &U_total, Real const &U_advected, Real const &gamma)
 
__host__ __device__ Real Calc_Kinetic_Energy_From_Velocity (Real const &d, Real const &vx, Real const &vy, Real const &vz)
 Compute the kinetic energy from the density and velocities.
 
__host__ __device__ Real Calc_Kinetic_Energy_From_Momentum (Real const &d, Real const &mx, Real const &my, Real const &mz)
 Compute the kinetic energy from the density and momenta.
 
__host__ __device__ Real Calc_Sound_Speed (Real const &E, Real const &d, Real const &mx, Real const &my, Real const &mz, Real const &gamma)
 Compute the sound speed in the cell from conserved variables.
 
__host__ __device__ Real Calc_Sound_Speed (Real const &P, Real const &d, Real const &gamma)
 Compute the sound in the cell from primitive variables.
 
template<uint dir = 0>
__host__ __device__ Conserved Load_Cell_Conserved (Real const *dev_conserved, size_t const xid, size_t const yid, size_t const zid, size_t const nx, size_t const ny, size_t const n_cells)
 Load the conserved variables from a single cell. Note that with MHD this returns cell-centered magnetic fields, not face centered fields.
 
__host__ __device__ Primitive Conserved_2_Primitive (Conserved const &conserved_in, Real const gamma)
 Convert Conserved cell centered variables to primitive variables.
 
__host__ __device__ Conserved Primitive_2_Conserved (Primitive const &primitive_in, Real const gamma)
 Convert primitive cell centered variables to conserved variables.
 
template<uint dir = 0>
__host__ __device__ Primitive Load_Cell_Primitive (Real const *dev_conserved, size_t const xid, size_t const yid, size_t const zid, size_t const nx, size_t const ny, size_t const n_cells, Real const gamma)
 Load the primitive variables from a single cell. Note that with MHD this returns cell-centered magnetic fields, not face centered fields.
 

Detailed Description

INDEX OF VARIABLES P : pressure vx, vy, vz : x, y, and z velocity d : density E : energy T : temperature mx, my, mz : x, y, and z momentum n : number density

Function Documentation

◆ Calc_Kinetic_Energy_From_Momentum()

__host__ __device__ Real hydro_utilities::Calc_Kinetic_Energy_From_Momentum ( Real const &  d,
Real const &  mx,
Real const &  my,
Real const &  mz 
)
inline

Compute the kinetic energy from the density and momenta.

Parameters
[in]dThe density
[in]mxThe x momentum
[in]myThe y momentum
[in]mzThe z momentum
Returns
Real The kinetic energy

◆ Calc_Kinetic_Energy_From_Velocity()

__host__ __device__ Real hydro_utilities::Calc_Kinetic_Energy_From_Velocity ( Real const &  d,
Real const &  vx,
Real const &  vy,
Real const &  vz 
)
inline

Compute the kinetic energy from the density and velocities.

Parameters
[in]dThe density
[in]vxThe x velocity
[in]vyThe y velocity
[in]vzThe z velocity
Returns
Real The kinetic energy

◆ Calc_Sound_Speed() [1/2]

__host__ __device__ Real hydro_utilities::Calc_Sound_Speed ( Real const &  E,
Real const &  d,
Real const &  mx,
Real const &  my,
Real const &  mz,
Real const &  gamma 
)
inline

Compute the sound speed in the cell from conserved variables.

Parameters
EEnergy
ddensidy
mxx momentum
myy momentum
mzz momentum
gammaadiabatic index
Returns
Real The sound speed

◆ Calc_Sound_Speed() [2/2]

__host__ __device__ Real hydro_utilities::Calc_Sound_Speed ( Real const &  P,
Real const &  d,
Real const &  gamma 
)
inline

Compute the sound in the cell from primitive variables.

Parameters
P
d
gamma
Returns
host

◆ Calc_Temp_Conserved()

__host__ __device__ Real hydro_utilities::Calc_Temp_Conserved ( Real const  E,
Real const  d,
Real const  mx,
Real const  my,
Real const  mz,
Real const  gamma,
Real const  n,
Real const  magnetic_x = 0.0,
Real const  magnetic_y = 0.0,
Real const  magnetic_z = 0.0 
)
inline

Compute the temperature from the conserved variables.

Parameters
[in]EThe energy
[in]dThe density
[in]mxThe momentum in the X-direction
[in]myThe momentum in the Y-direction
[in]mzThe momentum in the Z-direction
[in]gammaThe adiabatic index
[in]nThe number density
[in]magnetic_xThe cell centered magnetic field in the X-direction
[in]magnetic_yThe cell centered magnetic field in the Y-direction
[in]magnetic_zThe cell centered magnetic field in the Z-direction
Returns
Real The temperature of the gas in a cell

◆ Conserved_2_Primitive()

__host__ __device__ Primitive hydro_utilities::Conserved_2_Primitive ( Conserved const &  conserved_in,
Real const  gamma 
)
inline

Convert Conserved cell centered variables to primitive variables.

Parameters
conserved_inThe conserved variables to convert
gammaThe adiabatic index
Returns
Primitive The cell centered primitive variables

◆ Load_Cell_Conserved()

template<uint dir = 0>
__host__ __device__ Conserved hydro_utilities::Load_Cell_Conserved ( Real const *  dev_conserved,
size_t const  xid,
size_t const  yid,
size_t const  zid,
size_t const  nx,
size_t const  ny,
size_t const  n_cells 
)
inline

Load the conserved variables from a single cell. Note that with MHD this returns cell-centered magnetic fields, not face centered fields.

Template Parameters
dirThe direction to load the data in. i.e. which direction is the cell x, y, and z. If dir = 0 then local xyz is the same as the true xyz. If dir = 1 then local xyz is true yzx, for dir = 2 then local xyz is true zxy. This option is so that the reconstructors, and any other split kernels, can load data that is in the appropriated direction for that kernel.
Parameters
[in]dev_conservedThe pointer to the conserved variable array
[in]xidThe index for the x location
[in]yidThe index for the y location
[in]zidThe index for the z location
[in]nxThe total number of cells in the x direction
[in]nyThe total number of cells in the y direction
[in]n_cellsThe total number of cells
Returns
Conserved The cell centered conserved variables in the cell at location xid, yid, zid.

◆ Load_Cell_Primitive()

template<uint dir = 0>
__host__ __device__ Primitive hydro_utilities::Load_Cell_Primitive ( Real const *  dev_conserved,
size_t const  xid,
size_t const  yid,
size_t const  zid,
size_t const  nx,
size_t const  ny,
size_t const  n_cells,
Real const  gamma 
)
inline

Load the primitive variables from a single cell. Note that with MHD this returns cell-centered magnetic fields, not face centered fields.

Template Parameters
dirThe direction to load the data in. i.e. which direction is the cell x, y, and z. If dir = 0 then local xyz is the same as the true xyz. If dir = 1 then local xyz is true yzx, for dir = 2 then local xyz is true zxy. This option is so that the reconstructors, and any other split kernels, can load data that is in the appropriated direction for that kernel.
Parameters
[in]dev_conservedThe pointer to the conserved variable array
[in]xidThe index for the x location
[in]yidThe index for the y location
[in]zidThe index for the z location
[in]nxThe total number of cells in the x direction
[in]nyThe total number of cells in the y direction
[in]n_cellsThe total number of cells
[in]gammaThe adiabatic index
Returns
Primitive The cell centered conserved variables in the cell at location xid, yid, zid.

◆ Primitive_2_Conserved()

__host__ __device__ Conserved hydro_utilities::Primitive_2_Conserved ( Primitive const &  primitive_in,
Real const  gamma 
)
inline

Convert primitive cell centered variables to conserved variables.

Parameters
primitive_inThe primitive variables to convert
gammaThe adiabatic index
Returns
Conserved The cell centered conserved variables