When the fluid properties are not constant, the user may define the variation laws in the GUI or in the cs_user_physical_properties user-defined function, which is called at each time step. In the GUI, in the item Fluid properties under the Physical properties section , the variation laws are defined for the fluid density, viscosity, specific heat, thermal conductivity and scalar diffusivity as shown on the figures below.
Variable (in space and time) properties can be defined using a formula editor, described in a later section.
The validity of the variation laws is the user's responsibility, and should be verified, particularly when non-linear laws are defined (for instance, a third-degree polynomial law may produce negative density values).
irovar
or ivivar
respectively must have been set to 1 in cs_glob_fluid_properties at an earlier stage (i.e. in cs_user_parameters).cpro_cp
which can be accessed through ->val.The usvist user-defined subroutine can be used to modify the calculation of the turbulent viscosity, i.e. μt in . The correspondig field,
turbulent_viscosity
, can be accessed by calling field_get_val_s(ivisct, cpro_visct)
. The subroutine is called at the beginning of every time step, after the calculation of the physical parameters of the flow and of the "conventional" value of μt corresponding to the chosen turbulence model.
The ussmag user-defined subroutine can be used to modify the calculation of the variable C of the LES sub-grid scale dynamic model.
It worth recalling that the LES approach introduces the notion of filtering between large eddies and small motions. The solved variables are said to be filtered in an "implicit" way. Sub-grid scale models ("dynamic" models) introduce in addition an explicit filtering.
The notations used for the definition of the variable C used in the dynamic models of code_saturne are specified below. These notations are the ones assumed in the document [1].
The value of a filtered by the explicit filter (of width ) is called
and the value of a filtered by the implicit filter (of width
) is called
. We define:
In the framework of LES, the total viscosity (molecular + sub-grid) in $kg.m^{-1}.s^{-1}$ may be written in \CS:
is the width of the implicit filter, defined at the cell
by
In the case of the Smagorinsky model, C is a constant which is worth .
is the so-called Smagorinsky constant and is stored in the variable cs_turb_csmago.
In the case of the dynamic model, C is variable in time and in space. It is determined by .
In practice, in order to increase the stability, the code does not use the value of C obtained in each cell, but an average with the values obtained in the neighboring cells (this average uses the extended neighborhood or other vertex neighbors and corresponds to the explicit filter). By default, the value calculated by the code is
The ussmag subroutine (called at each time step, only when this model is active) allows to modify this value. It is for example possible to compute the local average after having computed the