9.0
general documentation
Loading...
Searching...
No Matches
cs_cf_thermo.h File Reference
Include dependency graph for cs_cf_thermo.h:

Go to the source code of this file.

Data Structures

struct  cs_stiffened_gas_t

Functions

static cs_real_t cs_cf_thermo_entropy_sg_ve (cs_real_t vol, cs_real_t energ, cs_stiffened_gas_t sg)
 Computation of entropy in plane (v,e) with a stiffened gas law.
static cs_real_t cs_cf_thermo_temperature_sg_ve (cs_real_t vol, cs_real_t energ, cs_stiffened_gas_t sg)
 Computation of the temperature.
static cs_real_t cs_cf_thermo_pressure_sg_ve (cs_real_t vol, cs_real_t energ, cs_stiffened_gas_t sg)
 Computation of the pressure.
static cs_real_t cs_cf_thermo_internal_energy_sg_tp (cs_real_t T, cs_real_t P, cs_stiffened_gas_t sg)
 Computation of internal energy in plane (T,P).
static cs_real_t cs_cf_thermo_specific_volume_sg_tp (cs_real_t T, cs_real_t P, cs_stiffened_gas_t sg)
 Computation of specific volume in plane (T,P).
static cs_real_t cs_cf_thermo_entropy_sg_tp (cs_real_t T, cs_real_t P, cs_stiffened_gas_t sg)
 Computation of entropy in plane (T,P).
static cs_real_t cs_cf_thermo_internal_energy_sg_sv (cs_real_t s, cs_real_t v, cs_stiffened_gas_t sg)
 Computation of internal energy in plane (s,v).
static void cs_cf_thermo_gamma (cs_real_t *cp, cs_real_t *cv, cs_real_t *gamma, cs_lnum_t l_size)
 Compute $\gamma$.
void cs_cf_set_thermo_options (void)
 Set variability of isobaric specific heat and isochoric specific heat according to the chosen thermodynamic law.
void cs_cf_thermo_default_init (void)
 Initialize density, total energy and isochoric specific heat according to the chosen thermodynamic law using the default parameters.
void cs_cf_check_pressure (cs_real_t *pres, cs_lnum_t l_size)
 Check the positivity of the pressure.
void cs_cf_check_internal_energy (cs_real_t *ener, cs_lnum_t l_size, cs_real_3_t *vel)
 Check the positivity of the internal energy.
void cs_cf_check_density (cs_real_t *dens, cs_lnum_t l_size)
 Check the positivity of the density given by the user.
void cs_cf_check_temperature (cs_real_t *temp, cs_lnum_t l_size)
 Check strict positivity of temperature (Celsius) given by the user.
void cs_cf_thermo_te_from_dp (cs_real_t *cp, cs_real_t *cv, cs_real_t *pres, cs_real_t *dens, cs_real_t *temp, cs_real_t *ener, cs_real_3_t *vel, cs_lnum_t l_size)
 Compute temperature and total energy from density and pressure.
void cs_cf_thermo_de_from_pt (cs_real_t *cp, cs_real_t *cv, cs_real_t *pres, cs_real_t *temp, cs_real_t *dens, cs_real_t *ener, cs_real_3_t *vel, cs_lnum_t l_size)
 Compute density and total energy from pressure and temperature.
void cs_cf_thermo_dt_from_pe (cs_real_t *cp, cs_real_t *cv, cs_real_t *pres, cs_real_t *ener, cs_real_t *dens, cs_real_t *temp, cs_real_3_t *vel, cs_lnum_t l_size)
 Compute density and temperature from pressure and total energy;.
void cs_cf_thermo_pe_from_dt (cs_real_t *cp, cs_real_t *cv, cs_real_t *dens, cs_real_t *temp, cs_real_t *pres, cs_real_t *ener, cs_real_3_t *vel, cs_lnum_t l_size)
 Compute pressure and total energy from density and temperature.
void cs_cf_thermo_pt_from_de (cs_real_t *cp, cs_real_t *cv, cs_real_t *dens, cs_real_t *ener, cs_real_t *pres, cs_real_t *temp, cs_real_3_t *vel, cs_real_t *fracv, cs_real_t *fracm, cs_real_t *frace, cs_lnum_t l_size)
 Compute pressure and temperature from density and total energy.
void cs_cf_thermo_c_square (cs_real_t *cp, cs_real_t *cv, cs_real_t *pres, cs_real_t *dens, cs_real_t *fracv, cs_real_t *fracm, cs_real_t *frace, cs_real_t *c2, cs_lnum_t l_size)
 Compute square of sound velocity:
void cs_cf_thermo_beta (cs_real_t *cp, cs_real_t *cv, cs_real_t *dens, cs_real_t *beta, cs_lnum_t l_size)
 Compute the thermal expansion coefficient:
void cs_cf_thermo_cv (cs_real_t *cp, cs_real_t *xmasml, cs_real_t *cv, cs_lnum_t l_size)
 Compute the isochoric specific heat:
void cs_cf_thermo_s_from_dp (cs_real_t *cp, cs_real_t *cv, cs_real_t *dens, cs_real_t *pres, cs_real_t *entr, cs_lnum_t l_size)
 Compute entropy from pressure and density:
void cs_cf_thermo_wall_bc (cs_real_t *wbfa, cs_real_t *wbfb, cs_lnum_t face_id)
 Compute wall boundary condition values.
void cs_cf_thermo_subsonic_outlet_bc (cs_real_t *bc_en, cs_real_t *bc_pr, cs_real_3_t *bc_vel, cs_lnum_t face_id)
 Compute subsonic outlet boundary conditions values.
void cs_cf_thermo_ph_inlet_bc (cs_real_t *bc_en, cs_real_t *bc_pr, cs_real_3_t *bc_vel, cs_lnum_t face_id)
 Compute inlet boundary condition with total pressure and total enthalpy imposed.
void cs_cf_thermo_eps_sup (const cs_real_t *dens, cs_real_t *eps_sup, cs_lnum_t l_size)
 Compute epsilon sup:
void cs_cf_thermo (const int iccfth, cs_lnum_t face_id, cs_real_t *bc_en, cs_real_t *bc_pr, cs_real_t *bc_tk, cs_real_3_t *bc_vel)
 This function is a driver allowing to call the appropriate thermodynamical functions depending on the quantities provided by the user. Hence it is only used during the initialization step and at the boundaries of type supersonic inlet. It is described in the following how to select the quantity to be returned.
cs_real_t cs_cf_thermo_b_rho_from_pt (cs_lnum_t face_id, cs_real_t bc_pr, cs_real_t bc_tk)
 Compute density at boundary based on pressure and temperature.

Function Documentation

◆ cs_cf_check_density()

void cs_cf_check_density ( cs_real_t * rho,
cs_lnum_t n_elts )

Check the positivity of the density given by the user.

Parameters
[in]rhoarray of density values
[in]n_eltssize of the array

◆ cs_cf_check_internal_energy()

void cs_cf_check_internal_energy ( cs_real_t * ener,
cs_lnum_t n_elts,
cs_real_3_t * vel )

Check the positivity of the internal energy.

Parameters
[in]enerarray of total energy values
[in]n_eltssize of the array
[in]velarray of velocity values

◆ cs_cf_check_pressure()

void cs_cf_check_pressure ( cs_real_t * pres,
cs_lnum_t n_elts )

Check the positivity of the pressure.

Parameters
[in]presarray of pressure values
[in]n_eltssize of the array

◆ cs_cf_check_temperature()

void cs_cf_check_temperature ( cs_real_t * temp,
cs_lnum_t n_elts )

Check strict positivity of temperature (Celsius) given by the user.

Parameters
[in]temparray of temperature values
[in]n_eltssize of the array

◆ cs_cf_set_thermo_options()

void cs_cf_set_thermo_options ( void )

Set variability of isobaric specific heat and isochoric specific heat according to the chosen thermodynamic law.

◆ cs_cf_thermo()

void cs_cf_thermo ( const int iccfth,
cs_lnum_t face_id,
cs_real_t * bc_en,
cs_real_t * bc_pr,
cs_real_t * bc_tk,
cs_real_3_t * bc_vel )

This function is a driver allowing to call the appropriate thermodynamical functions depending on the quantities provided by the user. Hence it is only used during the initialization step and at the boundaries of type supersonic inlet. It is described in the following how to select the quantity to be returned.

When calling the user subroutine, the integer 'iccfth' specifies which calculation has to be performed (and which quantity has to be returned). The values for 'iccfth' for each case are provided below.

The variables are referred to using a different index i:

  • pressure: 2
  • density: 3
  • temperature: 5
  • internal energy: 7
  • entropy: 13

iccfth is as follows, depending on which quantity needs to be computed:

  • variables at cell centers from variable i and variable j (i<j): iccfth = i*j*10000
  • variables at boundary faces from variable i and variable j (i<j): iccfth = i*j*10000+900

Detailed values of iccfth and corresponding computations:

Values at the cell centers:

  • temperature and energy from pressure and density: iccfth = 60000
  • density and energy from pressure and temperature: iccfth = 100000
  • density and temperature from pressure and energy: iccfth = 140000
  • pressure and energy from density and temperature: iccfth = 150000
  • pressure and temperature from density and energy: iccfth = 210000

Values at the faces for boundary conditions:

  • temperature and energy from pressure and density: iccfth = 60900
  • density and energy from pressure and temperature: iccfth = 100900
  • density and temperature from pressure and energy: iccfth = 140900
  • pressure and energy from density and temperature: iccfth = 150900
  • pressure and temperature from density and energy: iccfth = 210900
Parameters
[in]iccfthid of computation
[in]face_idface index if the computation is for a B.C. -1 if the computation is located on cells
[in,out]bc_entotal energy values at boundary faces
[in,out]bc_prpressure values at boundary faces
[in,out]bc_tktemperature values at boundary faces
[in,out]bc_velvelocity values at boundary faces

◆ cs_cf_thermo_b_rho_from_pt()

cs_real_t cs_cf_thermo_b_rho_from_pt ( cs_lnum_t face_id,
cs_real_t bc_pr,
cs_real_t bc_tk )

Compute density at boundary based on pressure and temperature.

This is needed when imposing a mass flow rate on a given inlet.

Parameters
[in]face_idface id
[in]bc_prpressure value at boundary face
[in]bc_tktemperature value at boundary face
Returns
density at boundary face

◆ cs_cf_thermo_beta()

void cs_cf_thermo_beta ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * rho,
cs_real_t * beta,
cs_lnum_t n_elts )

Compute the thermal expansion coefficient:

\[ \beta = \left(\frac{\partial p}{\partial s}\right)_\rho \]

for a perfect gas, the explicit formula is:

\[ \beta = \rho^\gamma \]

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]rhoarray of density values
[out]betaarray of beta values
[in]n_eltssize of the array

◆ cs_cf_thermo_c_square()

void cs_cf_thermo_c_square ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * pres,
cs_real_t * rho,
cs_real_t * fracv,
cs_real_t * fracm,
cs_real_t * frace,
cs_real_t * c2,
cs_lnum_t n_elts )

Compute square of sound velocity:

\[c^2  = \left(\frac{\partial p}{\partial \rho}\right)_s\]

;

for perfect gas, this expression simply writes:

\[c^2  = \gamma \frac{p}{\rho}\]

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]presarray of pressure values
[in]rhoarray of density values
[in,out]fracvarray of volume fraction values
[in,out]fracmarray of mass fraction values
[in,out]fracearray of energy fraction values
[out]c2array of the values of the square of sound velocity
[in]n_eltssize of the array

◆ cs_cf_thermo_cv()

void cs_cf_thermo_cv ( cs_real_t * cp,
cs_real_t * xmasml,
cs_real_t * cv,
cs_lnum_t n_elts )

Compute the isochoric specific heat:

\[C_v = \left(\frac{\partial e}{\partial T}\right)_\rho\]

Parameters
[in]cparray of isobaric specific heat values
[in]xmasmlarray of molar mass values
[out]cvarray of isochoric specific heat values
[in]n_eltssize of the array

◆ cs_cf_thermo_de_from_pt()

void cs_cf_thermo_de_from_pt ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * pres,
cs_real_t * temp,
cs_real_t * rho,
cs_real_t * ener,
cs_real_3_t * vel,
cs_lnum_t n_elts )

Compute density and total energy from pressure and temperature.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]presarray of pressure values
[in]temparray of temperature values
[out]rhoarray of density values
[out]enerarray of total energy values
[in]velarray of velocity component values
[in]n_eltssize of the array

◆ cs_cf_thermo_default_init()

void cs_cf_thermo_default_init ( void )

Initialize density, total energy and isochoric specific heat according to the chosen thermodynamic law using the default parameters.

◆ cs_cf_thermo_dt_from_pe()

void cs_cf_thermo_dt_from_pe ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * pres,
cs_real_t * ener,
cs_real_t * rho,
cs_real_t * temp,
cs_real_3_t * vel,
cs_lnum_t n_elts )

Compute density and temperature from pressure and total energy;.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]presarray of pressure values
[in]enerarray of total energy values
[out]rhoarray of density values
[out]temparray of temperature values
[in]velarray of velocity component values
[in]n_eltssize of the array

◆ cs_cf_thermo_entropy_sg_tp()

cs_real_t cs_cf_thermo_entropy_sg_tp ( cs_real_t T,
cs_real_t P,
cs_stiffened_gas_t sg )
inlinestatic

Computation of entropy in plane (T,P).

Parameters
[in]Ttemperature
[in]Ppressure
[in]sgstiffened gas parameters structure

◆ cs_cf_thermo_entropy_sg_ve()

cs_real_t cs_cf_thermo_entropy_sg_ve ( cs_real_t vol,
cs_real_t energ,
cs_stiffened_gas_t sg )
inlinestatic

Computation of entropy in plane (v,e) with a stiffened gas law.

\[s = Q^{\prime} + C_v * log(e-v P_{\infty})
           + C_v * (\gamma-1) log(v)
\]

where $Q^{\prime}$, $C_v$, $P_{\infty}$ and $\gamma$ are constants.

Parameters
[in]volspecific volume
[in]energspecific energy
[in]sgstiffened gas parameters structure
Returns
entropy

◆ cs_cf_thermo_eps_sup()

void cs_cf_thermo_eps_sup ( const cs_real_t * rho,
cs_real_t * eps_sup,
cs_lnum_t n_elts )

Compute epsilon sup:

\[\epsilon_{\textrm{sup}} = e - C_v T\]

for perfect gas:

\[\epsilon_{\textrm{sup}} = 0\]

Parameters
[in]rhoarray of density values
[out]eps_supepsilon sup array
[in]n_eltssize of the array

◆ cs_cf_thermo_gamma()

void cs_cf_thermo_gamma ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * gamma,
cs_lnum_t l_size )
inlinestatic

Compute $\gamma$.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[out]gammaarray of values of ratio of specific heat
[in]l_sizesize of the array

◆ cs_cf_thermo_internal_energy_sg_sv()

cs_real_t cs_cf_thermo_internal_energy_sg_sv ( cs_real_t s,
cs_real_t v,
cs_stiffened_gas_t sg )
inlinestatic

Computation of internal energy in plane (s,v).

Parameters
[in]sentropy
[in]vspecific volume
[in]sgstiffened gas parameters structure

◆ cs_cf_thermo_internal_energy_sg_tp()

cs_real_t cs_cf_thermo_internal_energy_sg_tp ( cs_real_t T,
cs_real_t P,
cs_stiffened_gas_t sg )
inlinestatic

Computation of internal energy in plane (T,P).

Parameters
[in]Ttemperature
[in]Ppressure
[in]sgstiffened gas parameters structure

◆ cs_cf_thermo_pe_from_dt()

void cs_cf_thermo_pe_from_dt ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * rho,
cs_real_t * temp,
cs_real_t * pres,
cs_real_t * ener,
cs_real_3_t * vel,
cs_lnum_t n_elts )

Compute pressure and total energy from density and temperature.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]rhoarray of density values
[in]temparray of temperature values
[out]presarray of pressure values
[out]enerarray of total energy values
[in]velarray of velocity component values
[in]n_eltssize of the array

◆ cs_cf_thermo_ph_inlet_bc()

void cs_cf_thermo_ph_inlet_bc ( cs_real_t * bc_en,
cs_real_t * bc_pr,
cs_real_3_t * bc_vel,
cs_lnum_t face_id )

Compute inlet boundary condition with total pressure and total enthalpy imposed.

Parameters
[in,out]bc_entotal energy values at boundary faces
[in,out]bc_prpressure values at boundary faces
[in,out]bc_velvelocity values at boundary faces
[in]face_idboundary face index

◆ cs_cf_thermo_pressure_sg_ve()

cs_real_t cs_cf_thermo_pressure_sg_ve ( cs_real_t vol,
cs_real_t energ,
cs_stiffened_gas_t sg )
inlinestatic

Computation of the pressure.

  The routine concerns the stiffened gas law :
  \f$P_1=(\gamma_1-1.0)*e_1/v_1-P_{\infty,1}*\gamma_1\f$,
  where \f$P_{\infty,1}\f$ and \f$\gamma_1\f$ are constants.
Parameters
[in]volthe specific volume of phase iph
[in]energthe specific energy of phase iph
[in]sgstiffened gas parameters structure

◆ cs_cf_thermo_pt_from_de()

void cs_cf_thermo_pt_from_de ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * rho,
cs_real_t * ener,
cs_real_t * pres,
cs_real_t * temp,
cs_real_3_t * vel,
cs_real_t * fracv,
cs_real_t * fracm,
cs_real_t * frace,
cs_lnum_t n_elts )

Compute pressure and temperature from density and total energy.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]rhoarray of density values
[in]enerarray of total energy values
[out]presarray of pressure values
[out]temparray of temperature values
[in]velarray of velocity component values
[in,out]fracvarray of volume fraction values
[in,out]fracmarray of mass fraction values
[in,out]fracearray of energy fraction values
[in]n_eltssize of the array

◆ cs_cf_thermo_s_from_dp()

void cs_cf_thermo_s_from_dp ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * rho,
cs_real_t * pres,
cs_real_t * entr,
cs_lnum_t n_elts )

Compute entropy from pressure and density:

\[s = \frac{p}{\rho^\gamma}\]

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]rhoarray of density values
[in]presarray of pressure values
[out]entrarray of total energy values
[in]n_eltssize of the array

◆ cs_cf_thermo_specific_volume_sg_tp()

cs_real_t cs_cf_thermo_specific_volume_sg_tp ( cs_real_t T,
cs_real_t P,
cs_stiffened_gas_t sg )
inlinestatic

Computation of specific volume in plane (T,P).

Parameters
[in]Ttemperature
[in]Ppressure
[in]sgstiffened gas parameters structure

◆ cs_cf_thermo_subsonic_outlet_bc()

void cs_cf_thermo_subsonic_outlet_bc ( cs_real_t * bc_en,
cs_real_t * bc_pr,
cs_real_3_t * bc_vel,
cs_lnum_t face_id )

Compute subsonic outlet boundary conditions values.

Parameters
[in,out]bc_entotal energy values at boundary faces
[in,out]bc_prpressure values at boundary faces
[in,out]bc_velvelocity values at boundary faces
[in]face_idboundary face index

◆ cs_cf_thermo_te_from_dp()

void cs_cf_thermo_te_from_dp ( cs_real_t * cp,
cs_real_t * cv,
cs_real_t * pres,
cs_real_t * rho,
cs_real_t * temp,
cs_real_t * ener,
cs_real_3_t * vel,
cs_lnum_t n_elts )

Compute temperature and total energy from density and pressure.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]presarray of pressure values
[in]rhoarray of density values
[out]temparray of temperature values
[out]enerarray of total energy values
[in]velarray of velocity component values
[in]n_eltssize of the array

◆ cs_cf_thermo_temperature_sg_ve()

cs_real_t cs_cf_thermo_temperature_sg_ve ( cs_real_t vol,
cs_real_t energ,
cs_stiffened_gas_t sg )
inlinestatic

Computation of the temperature.

  The routine concerns the stiffened gas law :
  \f$T_1=(e_1-P_{\infty,1}*v_1)/CV_1\f$,
  where \f$CV_1\f$ and \f$P_{\infty,1}\f$ are constants.
Parameters
[in]volthe specific volume of phase iph
[in]energthe specific energy of phase iph
[in]sgstiffened gas parameters structure

◆ cs_cf_thermo_wall_bc()

void cs_cf_thermo_wall_bc ( cs_real_t * wbfa,
cs_real_t * wbfb,
cs_lnum_t face_id )

Compute wall boundary condition values.

Parameters
[in,out]wbfaoutput work array
[in,out]wbfboutput work array
[in]face_idboundary face index