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.When code_saturne has been built with CoolProp support, that library may be used to compute fluid properties selected directly from the GUI.
Note than when properties are variable, CoolProp will default to using tabulated data properties for better performance. The choice of the backend may otherwise be forced by calling cs_physical_properties_set_coolprop_backend from the cs_user_model user-defined function.
Note that when using tables, CoolProp stores tabulations in the $HOME/.CoolProp/Tables
directory by default, though this can be modified by defining the ALTERNATIVE_TABLES_DIRECTORY
environment variable. Each table requires about 20 Mb in size, and will be created the first time a given fluid is used in a computation. The initialization time for that run will reflect this, though subsequent runs will simply read the data. Tabulation data may be cleaned by removing or cleaning this directory, and its size may otherwise be limited by using the MAXIMUM_TABLE_DIRECTORY_SIZE_IN_GB
environment variable.
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 cs_user_physical_properties_smagorinsky_c user-defined function 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 [2].
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 cs_user_physical_properties_smagorinsky_c function (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