My Project
programmer's documentation
Functions
cs_cf_thermo.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_field.h"
#include "cs_field_pointer.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_mesh_quantities.h"
#include "cs_parall.h"
#include "cs_parameters.h"
#include "cs_thermal_model.h"
#include "cs_cf_model.h"
#include "cs_hgn_thermo.h"
#include "cs_cf_thermo.h"
Include dependency graph for cs_cf_thermo.c:

Functions

void cs_cf_set_thermo_options (void)
 Set variability of isobaric specific heat and isochoric specific heat according to the chosen thermodynamic law. More...
 
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. More...
 
void cs_cf_check_pressure (cs_real_t *pres, cs_lnum_t l_size)
 Check the positivity of the pressure. More...
 
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. More...
 
void cs_cf_check_density (cs_real_t *dens, cs_lnum_t l_size)
 Check the positivity of the density given by the user. More...
 
void cs_cf_check_temperature (cs_real_t *temp, cs_lnum_t l_size)
 Check strict positivity of temperature (Celsius) given by the user. More...
 
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. More...
 
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. More...
 
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;. More...
 
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. More...
 
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. More...
 
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: More...
 
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: More...
 
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: More...
 
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: More...
 
void cs_cf_thermo_wall_bc (cs_real_t *wbfa, cs_real_t *wbfb, cs_lnum_t face_id)
 Compute wall boundary condition values. More...
 
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. More...
 
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. More...
 
void cs_cf_thermo_eps_sup (cs_real_t *dens, cs_real_t *eps_sup, cs_lnum_t l_size)
 Compute epsilon sup: More...
 
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, cs_real_t *bc_fracv, cs_real_t *bc_fracm, cs_real_t *bc_frace)
 This subroutine 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. More...
 

Detailed Description

Define thermodynamic laws for the compressible flow module. Only the perfect gas law is available for now. The molar mass has to be provided either in the GUI or in cs_user_parameters.f90.

Function Documentation

◆ cs_cf_check_density()

void cs_cf_check_density ( cs_real_t dens,
cs_lnum_t  l_size 
)

Check the positivity of the density given by the user.

Parameters
[in]densarray of density values
[in]l_sizel_size of the array

◆ cs_cf_check_internal_energy()

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.

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

◆ cs_cf_check_pressure()

void cs_cf_check_pressure ( cs_real_t pres,
cs_lnum_t  l_size 
)

Check the positivity of the pressure.

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

◆ cs_cf_check_temperature()

void cs_cf_check_temperature ( cs_real_t temp,
cs_lnum_t  l_size 
)

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

Parameters
[in]temparray of temperature values
[in]l_sizel_size 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,
cs_real_t bc_fracv,
cs_real_t bc_fracm,
cs_real_t bc_frace 
)

This subroutine 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
[in,out]bc_fracvvolume fraction values at boundary faces
[in,out]bc_fracmmass fraction values at boundary faces
[in,out]bc_fraceenergy fraction values at boundary faces

◆ cs_cf_thermo_beta()

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:

\[ \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]densarray of density values
[out]betaarray of beta values
[in]l_sizel_size 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 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:

\[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]densarray 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]l_sizel_size 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  l_size 
)

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]l_sizel_size 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 dens,
cs_real_t ener,
cs_real_3_t vel,
cs_lnum_t  l_size 
)

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]densarray of density values
[out]enerarray of total energy values
[in]velarray of velocity component values
[in]l_sizel_size 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 dens,
cs_real_t temp,
cs_real_3_t vel,
cs_lnum_t  l_size 
)

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]densarray of density values
[out]temparray of temperature values
[in]velarray of velocity component values
[in]l_sizel_size of the array

◆ cs_cf_thermo_eps_sup()

void cs_cf_thermo_eps_sup ( cs_real_t dens,
cs_real_t eps_sup,
cs_lnum_t  l_size 
)

Compute epsilon sup:

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

for perfect gas:

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

Parameters
[in]densarray of density values
[out]eps_supepsilon sup array
[in]l_sizel_size of the array

◆ cs_cf_thermo_pe_from_dt()

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.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]densarray 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]l_sizel_size 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_pt_from_de()

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.

Parameters
[in]cparray of isobaric specific heat values
[in]cvarray of isochoric specific heat values
[in]densarray 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]l_sizel_size 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 dens,
cs_real_t pres,
cs_real_t entr,
cs_lnum_t  l_size 
)

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]densarray of density values
[in]presarray of pressure values
[out]entrarray of total energy values
[in]l_sizel_size of the array

◆ 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 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.

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

◆ 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