programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions/Subroutines
cfther.f90 File Reference

Define thermodynamic laws (especially for the compressible flow scheme). More...

Functions/Subroutines

subroutine cfther (nvar, iccfth, imodif, rtp, output1, output2, bval)
 This subroutine is a driver allowing to call the appropriate thermodynamicalfunctions 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...
 
subroutine cf_set_thermo_options
 Set variability of isobaric specific heat and isochoric specific heat according to the chosen thermodynamic law. More...
 
subroutine cf_get_molar_mass (xmasml)
 Retrieve molar mass. More...
 
subroutine cf_thermo_gamma (gamma)
 Compute $\gamma$. More...
 
subroutine cf_thermo_default_init (ncel, ncelet, rtp)
 Initialize density, total energy and isochoric specific heat according to the chosen thermodynamic law using the default parameters. More...
 
subroutine cf_check_pressure (pres, l_size)
 Check positivity of the pressure. More...
 
subroutine cf_check_internal_energy (ener, l_size, vel)
 Check strict positivity of the internal energy. More...
 
subroutine cf_check_density (dens, l_size)
 Check strict positivity of the density given by the user. More...
 
subroutine cf_check_temperature (temp, l_size)
 Check strict positivity of the temperature (Celsius) given by the user. More...
 
subroutine cf_thermo_te_from_dp_ni (pres, dens, temp, ener, velx, vely, velz, l_size)
 Compute temperature and total energy from density and pressure. More...
 
subroutine cf_thermo_te_from_dp (pres, dens, temp, ener, vel, l_size)
 Compute temperature and total energy from density and pressure. More...
 
subroutine cf_thermo_de_from_pt_ni (pres, temp, dens, ener, velx, vely, velz, l_size)
 Compute density and total energy from pressure and temperature. More...
 
subroutine cf_thermo_de_from_pt (pres, temp, dens, ener, vel, l_size)
 Compute density and total energy from pressure and temperature (interleaved version). More...
 
subroutine cf_thermo_dt_from_pe_ni (pres, ener, dens, temp, velx, vely, velz, l_size)
 Compute density and temperature from pressure and total energy. More...
 
subroutine cf_thermo_dt_from_pe (pres, ener, dens, temp, vel, l_size)
 Compute density and temperature from pressure and total energy (interleaved version). More...
 
subroutine cf_thermo_pe_from_dt_ni (dens, temp, pres, ener, velx, vely, velz, l_size)
 Compute pressure and total energy from density and temperature. More...
 
subroutine cf_thermo_pe_from_dt (dens, temp, pres, ener, vel, l_size)
 Compute pressure and total energy from density and temperature (interleaved version). More...
 
subroutine cf_thermo_pt_from_de_ni (dens, ener, pres, temp, velx, vely, velz, l_size)
 Compute pressure and temperature from density and total energy. More...
 
subroutine cf_thermo_pt_from_de (dens, ener, pres, temp, vel, l_size)
 Compute pressure and temperature from density and total energy. More...
 
subroutine cf_thermo_c_square (pres, dens, c2, l_size)
 Compute square of sound velocity: More...
 
subroutine cf_thermo_beta (dens, beta, l_size)
 Compute $\beta$: More...
 
subroutine cf_thermo_cv (cp, cv, l_size)
 Compute the isochoric specific heat: More...
 
subroutine cf_thermo_s_from_dp (dens, pres, entr, l_size)
 Compute entropy from pressure and density: More...
 
subroutine cf_thermo_wall_bc (rtp, wbfb, ifac)
 Compute wall boundary conditions. More...
 
subroutine cf_thermo_subsonic_outlet_bc (rtp, bval, ifac)
 Compute subsonic outlet boundary conditions. More...
 
subroutine cf_thermo_ph_inlet_bc (rtp, bval, ifac)
 Compute inlet boundary condition with total pressure and total enthalpy imposed. More...
 
subroutine cf_thermo_eps_sup (output, l_size)
 Compute epsilon sup: More...
 

Detailed Description

Define thermodynamic laws (especially for the compressible flow scheme).

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/Subroutine Documentation

subroutine cf_check_density ( double precision, dimension(*)  dens,
integer  l_size 
)

Check strict positivity of the density given by the user.

Parameters
[in]densarray of density values
[in]l_sizel_size of the array
subroutine cf_check_internal_energy ( double precision, dimension(*)  ener,
integer  l_size,
double precision, dimension(3,*)  vel 
)

Check strict positivity of the internal energy.

Parameters
[in]enerarray of total energy values
[in]l_sizel_size of the array
[in]velarray of velocity values
subroutine cf_check_pressure ( double precision, dimension(*)  pres,
integer  l_size 
)

Check positivity of the pressure.

Parameters
[in]presarray of pressure values
[in]l_sizel_size of the array
subroutine cf_check_temperature ( double precision, dimension(*)  temp,
integer  l_size 
)

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

Parameters
[in]temparray of temperature values
[in]l_sizel_size of the array
subroutine cf_get_molar_mass ( double precision  xmasml)

Retrieve molar mass.

Parameters
[out]xmasmlmolar mass
subroutine cf_set_thermo_options ( )

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

subroutine cf_thermo_beta ( double precision, dimension(*)  dens,
double precision, dimension(*)  beta,
integer  l_size 
)

Compute $\beta$:

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

for a perfect gas, the explicit formula is:

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

Parameters
[in]densarray of density values
[out]betaarray of beta values
[in]l_sizel_size of the array
subroutine cf_thermo_c_square ( double precision, dimension(*)  pres,
double precision, dimension(*)  dens,
double precision, dimension(*)  c2,
integer  l_size 
)

Compute square of sound velocity:

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

for perfect gas, the explicit formula is:

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

Parameters
[in]presarray of pressure values
[in]densarray of density values
[out]c2array of the values of the square of sound velocity
[in]l_sizel_size of the array
subroutine cf_thermo_cv ( double precision, dimension(*)  cp,
double precision, dimension(*)  cv,
integer  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]cvarray of isochoric specific heat values
[in]l_sizel_size of the array
subroutine cf_thermo_de_from_pt ( double precision, dimension(*)  pres,
double precision, dimension(*)  temp,
double precision, dimension(*)  dens,
double precision, dimension(*)  ener,
double precision, dimension(3,*)  vel,
integer  l_size 
)

Compute density and total energy from pressure and temperature (interleaved version).

Parameters
[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
subroutine cf_thermo_de_from_pt_ni ( double precision, dimension(*)  pres,
double precision, dimension(*)  temp,
double precision, dimension(*)  dens,
double precision, dimension(*)  ener,
double precision, dimension(*)  velx,
double precision, dimension(*)  vely,
double precision, dimension(*)  velz,
integer  l_size 
)

Compute density and total energy from pressure and temperature.

Parameters
[in]presarray of pressure values
[in]temparray of temperature values
[out]densarray of density values
[out]enerarray of total energy values
[in]velxarray of velocity x-component values
[in]velzarray of velocity y-component values
[in]velyarray of velocity z-component values
[in]l_sizel_size of the array
subroutine cf_thermo_default_init ( integer  ncel,
integer  ncelet,
double precision, dimension(ncelet,nflown:nvar)  rtp 
)

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

Parameters
[in]ncelnumber of cells
[in]ncelettotal number of cells on the local rank
[in,out]rtpcalculated variables at cell centers (at current time step)
subroutine cf_thermo_dt_from_pe ( double precision, dimension(*)  pres,
double precision, dimension(*)  ener,
double precision, dimension(*)  dens,
double precision, dimension(*)  temp,
double precision, dimension(3,*)  vel,
integer  l_size 
)

Compute density and temperature from pressure and total energy (interleaved version).

Parameters
[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
subroutine cf_thermo_dt_from_pe_ni ( double precision, dimension(*)  pres,
double precision, dimension(*)  ener,
double precision, dimension(*)  dens,
double precision, dimension(*)  temp,
double precision, dimension(*)  velx,
double precision, dimension(*)  vely,
double precision, dimension(*)  velz,
integer  l_size 
)

Compute density and temperature from pressure and total energy.

Parameters
[in]presarray of pressure values
[in]enerarray of total energy values
[out]densarray of density values
[out]temparray of temperature values
[in]velxarray of velocity x-component values
[in]velzarray of velocity y-component values
[in]velyarray of velocity z-component values
[in]l_sizel_size of the array
subroutine cf_thermo_eps_sup ( double precision, dimension(*)  output,
integer  l_size 
)

Compute epsilon sup:

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

for perfect gas:

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

Parameters
[out]outputoutput work array
[in]l_sizel_size of the array
subroutine cf_thermo_gamma ( double precision  gamma)

Compute $\gamma$.

Parameters
[out]gammaratio of specific heat
subroutine cf_thermo_pe_from_dt ( double precision, dimension(*)  dens,
double precision, dimension(*)  temp,
double precision, dimension(*)  pres,
double precision, dimension(*)  ener,
double precision, dimension(3,*)  vel,
integer  l_size 
)

Compute pressure and total energy from density and temperature (interleaved version).

Parameters
[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
subroutine cf_thermo_pe_from_dt_ni ( double precision, dimension(*)  dens,
double precision, dimension(*)  temp,
double precision, dimension(*)  pres,
double precision, dimension(*)  ener,
double precision, dimension(*)  velx,
double precision, dimension(*)  vely,
double precision, dimension(*)  velz,
integer  l_size 
)

Compute pressure and total energy from density and temperature.

Parameters
[in]densarray of density values
[in]temparray of temperature values
[out]presarray of pressure values
[out]enerarray of total energy values
[in]velxarray of velocity x-component values
[in]velzarray of velocity y-component values
[in]velyarray of velocity z-component values
[in]l_sizel_size of the array
subroutine cf_thermo_ph_inlet_bc ( double precision, dimension(ncelet,nflown:nvar)  rtp,
double precision, dimension(nfabor,*)  bval,
integer  ifac 
)

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

Parameters
[in]rtpcalculated variables at cell centers (at current time step)
[in,out]bvalvariable values at boundary faces
[in]ifacboundary face indice
subroutine cf_thermo_pt_from_de ( double precision, dimension(*)  dens,
double precision, dimension(*)  ener,
double precision, dimension(*)  pres,
double precision, dimension(*)  temp,
double precision, dimension(3,*)  vel,
integer  l_size 
)

Compute pressure and temperature from density and total energy.

Parameters
[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
subroutine cf_thermo_pt_from_de_ni ( double precision, dimension(*)  dens,
double precision, dimension(*)  ener,
double precision, dimension(*)  pres,
double precision, dimension(*)  temp,
double precision, dimension(*)  velx,
double precision, dimension(*)  vely,
double precision, dimension(*)  velz,
integer  l_size 
)

Compute pressure and temperature from density and total energy.

Parameters
[in]densarray of density values
[in]temparray of temperature values
[out]presarray of pressure values
[out]enerarray of total energy values
[in]velxarray of velocity x-component values
[in]velzarray of velocity y-component values
[in]velyarray of velocity z-component values
[in]l_sizel_size of the array
subroutine cf_thermo_s_from_dp ( double precision, dimension(*)  dens,
double precision, dimension(*)  pres,
double precision, dimension(*)  entr,
integer  l_size 
)

Compute entropy from pressure and density:

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

Parameters
[in]densarray of density values
[in]presarray of pressure values
[out]entrarray of total energy values
[in]l_sizel_size of the array
subroutine cf_thermo_subsonic_outlet_bc ( double precision, dimension(ncelet,nflown:nvar)  rtp,
double precision, dimension(nfabor,*)  bval,
integer  ifac 
)

Compute subsonic outlet boundary conditions.

Parameters
[in]rtpcalculated variables at cell centers (at current time step)
[in,out]bvalvariable values at boundary faces
[in]ifacboundary face indice
subroutine cf_thermo_te_from_dp ( double precision, dimension(*)  pres,
double precision, dimension(*)  dens,
double precision, dimension(*)  temp,
double precision, dimension(*)  ener,
double precision, dimension(3,*)  vel,
integer  l_size 
)

Compute temperature and total energy from density and pressure.

Parameters
[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
subroutine cf_thermo_te_from_dp_ni ( double precision, dimension(*)  pres,
double precision, dimension(*)  dens,
double precision, dimension(*)  temp,
double precision, dimension(*)  ener,
double precision, dimension(*)  velx,
double precision, dimension(*)  vely,
double precision, dimension(*)  velz,
integer  l_size 
)

Compute temperature and total energy from density and pressure.

Parameters
[in]presarray of pressure values
[in]densarray of density values
[out]temparray of temperature values
[out]enerarray of total energy values
[in]velxarray of velocity x-component values
[in]velzarray of velocity y-component values
[in]velyarray of velocity z-component values
[in]l_sizel_size of the array
subroutine cf_thermo_wall_bc ( double precision, dimension(ncelet,nflown:nvar)  rtp,
double precision, dimension(nfabor)  wbfb,
integer  ifac 
)

Compute wall boundary conditions.

Parameters
[in]rtpcalculated variables at cell centers (at current time step)
[in,out]wbfboutput work array
[in]ifacboundary face indice
subroutine cfther ( integer  nvar,
integer  iccfth,
integer  imodif,
double precision, dimension(ncelet,nflown:nvar)  rtp,
double precision, dimension(*)  output1,
double precision, dimension(*)  output2,
double precision, dimension(nfabor,nvar)  bval 
)

This subroutine is a driver allowing to call the appropriate thermodynamicalfunctions 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]nvartotal number of variables
[in]iccfthid of computation
[in]imodifmodification indicator
  • 0 variables and properties not modified
  • > 0 variables and properties modified for a bulk computation / face number for a B.C.
[in,out]rtpcalculated variables at cell centers (at current time step)
[out]output1computed therm. property 1 at cell centers
[out]output2computed therm. property 2 at cell centers
[in,out]bvalvariable values at boundary faces