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 dynamic dynamic 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).
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 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 [3].
The value of a filtered by the explicit filter (of width
In the framework of LES, the total viscosity (molecular + sub-grid) in $kg.m^{-1}.s^{-1}$ may be written in \CS:
In the case of the Smagorinsky model, C is a constant which is worth
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