src/user/cs_user_physical_properties.f90 File Reference

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions/Subroutines
cs_user_physical_properties.f90 File Reference

Definition of physical variable laws. More...

## Functions/Subroutines
subroutine | usphyv (nvar, nscal, mbrom, dt, rtp, rtpa, propce)
subroutine | uscfpv (nvar, nscal, dt, rtp, rtpa, propce)
| uscfpv More...
subroutine | uselph
subroutine | usvist (nvar, nscal, ncepdp, ncesmp, icepdc, icetsm, itypsm, dt, rtp, rtpa, propce, ckupdc, smacel)
| usvist More...
subroutine | ussmag
subroutine | usvima (nvar, nscal, dt, rtp, rtpa, propce, viscmx, viscmy, viscmz)
| usvima More...
subroutine | usatph (propce)
| usatph More...

## Detailed Description

Definition of physical variable laws.

usphyv Definition of physical variable laws.

# Warning

It is forbidden to modify turbulent viscosity `visct` here (a specific subroutine is dedicated to that: usvist)

- icp = 1 must have been specified in usipph if we wish to define a variable specific heat cp (otherwise: memory overwrite).

- ivisls = 1 must have been specified in usipsc if we wish to define a variable viscosity `viscls` (otherwise: memory overwrite).

Remarks
  - This routine is called at the beginning of each time step Thus, AT THE FIRST TIME STEP (non-restart case), the only values initialized before this call are those defined
    - in the GUI or usipsu (cs_user_parameters.f90)
      - density (initialized at `ro0`)
      - viscosity (initialized at `viscl0`)
    - in the GUI or cs_user_initialization.f90
      - calculation variables (initialized at 0 by defaut or to the value given in the GUI or in cs_user_initialization.f90)

- We may define here variation laws for cell properties, for:
  - density: rom kg/m3
  - density at boundary faces: romb kg/m3)
  - molecular viscosity: viscl kg/(m s)
  - specific heat: cp J/(kg degrees)
  - diffusivities associated with scalars: visls kg/(m s)

Warning: if the scalar is the temperature, visls corresponds to its conductivity (Lambda) in W/(m K)

The types of boundary faces at the previous time step are available (except at the first time step, where arrays `itypfb` and `itrifb` have not been initialized yet)

It is recommended to keep only the minimum necessary in this file (i.e. remove all unused example code)

# Cells identification

Cells may be identified using the getcel subroutine. The syntax of this subroutine is described in the cs_user_boundary_conditions subroutine, but a more thorough description can be found in the user guide.

## Function/Subroutine Documentation

subroutine usatph | ( | double precision, dimension(ncelet,*) | propce | ) |

usatph

User subroutine dedicated to modifie physical properties of the atmospheric module

This subroutine is called at beginning of each time step at the end of atphyv.

Parameters

  [in] | propce | physical properties at cell centers

subroutine uscfpv | ( | integer | nvar,
|  | integer | nscal,
|  | double precision, dimension(ncelet) | dt,
|  | double precision, dimension(ncelet,*) | rtp,
|  | double precision, dimension(ncelet,*) | rtpa,
|  | double precision, dimension(ncelet,*) | propce
| ) |  |

uscfpv

Set (variable) physical properties for the compressible flow scheme.

# Description

This subroutine replaces the user subroutine usphyv for the compressible flow scheme.

This subroutine is called at the beginning of each time step.

At the very first time step (not at restart), the only variables that have been initialized are those provided:

- in the GUI and in the user subroutines usipsu and uscfx2; ex.:
  - the density (set to ro0)
  - the molecular viscosity (set to viscl0)
  - the volumetric molecular viscosity (set to viscv0)
  - the molecular thermal conductivity (set to visls0(itempk))
- in the user subroutine cs_user_initialization.f90; ex.:
  - the unknown variables (null by default)

This subroutine allows the user to set the cell values for:

- the molecular viscosity: viscl kg/(m s)
- the isobaric specific heat ( ): cp J/(kg degree)
- the molecular thermal conductivity: lambda W/(m degree)
- the molecular diffusivity for user-defined scalars: viscls kg/(m s)

# Warnings

The density must not be set here: for the compressible scheme, it is one of the unknowns, and it can be initialized as such in the user subroutine cs_user_initialization.f90 (rtp array).

The turbulent viscosity must not be modified here (to modify this variable, use the user subroutine usvist)

To set a variable isobaric specific heat, the integer `icp` must have been set to 1: the value for `icp` is set automatically in the subroutine cfther, depending on the thermodynamics laws selected by the user.

To set a variable diffusivity for a given user-defined scalar, the variable `ivisls(scalar_number)` must have been set to 1 in the user subroutine usipsc or in the GUI (otherwise, a memory problem is expected).

Examples are provided in the present subroutine (but they do not have any physical signification).

# Cells identification

Cells may be identified using the getcel subroutine. The syntax of this subroutine is described in the cs_user_boundary_conditions subroutine, but a more thorough description can be found in the user guide.

The type of the boundary faces at the previous time step is available (except at the first time step, since the arrays `itypfb` and `itrifb` have not yet been set);

Parameters

  [in] | nvar | total number of variables
  [in] | nscal | total number of scalars
  [in] | dt | time step (per cell)
  [in] | rtpR,rtpa | calculated variables at cell centers (at current and preceding time steps)
  [in,out] | propce | physical properties at cell centers

subroutine uselph | ( |  | ) |

subroutine usphyv | ( | integer | nvar,
|  | integer | nscal,
|  | integer | mbrom,
|  | double precision, dimension(ncelet) | dt,
|  | double precision, dimension(ncelet,*) | rtp,
|  | double precision, dimension(ncelet,*) | rtpa,
|  | double precision, dimension(ncelet,*) | propce
| ) |  |

Parameters

  [in] | nvar | total number of variables
  [in] | nscal | total number of scalars
  [in] | mbrom | indicator of filling of romb array
  [in] | dt | time step (per cell)
  [in] | rtp,rtpa | calculated variables at cell centers
  [in] | (at | current and previous time steps)
  [in] | propce | physical properties at cell centers

subroutine ussmag | ( |  | ) |

subroutine usvima | ( | integer | nvar,
|  | integer | nscal,
|  | double precision, dimension(ncelet) | dt,
|  | double precision, dimension(ncelet,*) | rtp,
|  | double precision, dimension(ncelet,*) | rtpa,
|  | double precision, dimension(ncelet,*) | propce,
|  | double precision, dimension(ncelet) | viscmx,
|  | double precision, dimension(ncelet) | viscmy,
|  | double precision, dimension(ncelet) | viscmz
| ) |  |

usvima

User subroutine dedicated the use of ALE (Arbitrary Lagrangian Eulerian Method): fills mesh viscosity arrays.

This subroutine is called at the beginning of each time step.

Here one can modify mesh viscosity value to prevent cells and nodes from huge displacements in awkward areas, such as boundary layer for example.

IF variable IORTVM = 0, mesh viscosity modeling is isotropic therefore VISCMX array only needs to be filled. IF variable IORTVM = 1, mesh viscosity modeling is orthotropic therefore all arrays VISCMX, VISCMY and VISCMZ need to be filled.

Note that VISCMX, VISCMY and VISCMZ arrays are initialized at the first time step to the value of 1.

# Cells identification

Cells may be identified using the getcel subroutine. The syntax of this subroutine is described in the cs_user_boundary_conditions subroutine, but a more thorough description can be found in the user guide.

Parameters

  [in] | nvar | total number of variables
  [in] | nscal | total number of scalars
  [in] | dt | time step (per cell)
  [in] | rtp,rtpa | calculated variables at cell centers (at current and preceding time steps)
  [in] | propce | physical properties at cell centers
  [out] | viscmx | mesh viscosity in X direction
  [out] | viscmy | mesh viscosity in Y direction
  [out] | viscmz | mesh viscosity in Z direction

subroutine usvist | ( | integer | nvar,
|  | integer | nscal,
|  | integer | ncepdp,
|  | integer | ncesmp,
|  | integer, dimension(ncepdp) | icepdc,
|  | integer, dimension(ncesmp) | icetsm,
|  | integer, dimension(ncesmp,nvar) | itypsm,
|  | double precision, dimension(ncelet) | dt,
|  | double precision, dimension(ncelet,*) | rtp,
|  | double precision, dimension(ncelet,*) | rtpa,
|  | double precision, dimension(ncelet,*) | propce,
|  | double precision, dimension(ncepdp,6) | ckupdc,
|  | double precision, dimension(ncesmp,nvar) | smacel
| ) |  |

usvist

Modify turbulent viscosity

This subroutine is called at beginning of each time step after the computation of the turbulent viscosity (physical quantities have already been computed in usphyv).

Turbulent viscosity (kg/(m s)) can be modified.

A modification of the turbulent viscosity can lead to very significant differences betwwen solutions and even give wrong results.

This subroutine is therefore reserved to expert users.

Parameters

  [in] | nvar | total number of variables
  [in] | nscal | total number of scalars
  [in] | ncepdp | number of cells with head loss
  [in] | ncesmp | number of cells with mass source term
  [in] | icepdc | head loss cell numbering
  [in] | icetsm | numbering of cells with mass source term
  [in] | itypsm | kind of mass source for each variable (cf. ustsma)
  [in] | dt | time step (per cell)
  [in] | rtp,rtpa | calculated variables at cell centers (at current and previous time steps)
  [in,out] | propce | physical properties at cell centers
  [in] | ckupdc | work array for head loss terms
  [in] | smacel | values of variables related to mass source term. If ivar=ipr, smacel=mass flux