My Project
programmer's documentation
|
The subroutine Examples of data settings for mass source terms (cs_user_mass_source_terms.f90) is called at three different stages in the code (iappel = 1, 2 or 3):
iappel
= 1: Calculation of the number of cells where a mass source is imposed: ncesmp
. Called once at the beginning of the calculation.iappel
= 2: Identification of the cells where a mass source term is imposed: array icesmp(ncesmp)
. Called once at the beginning of the calculation.iappel
= 3: Calculation of the values of the mass source terms. Called at each time step.The equation for mass conservation becomes:
The equation for a variable becomes: discretized as
is the value of associated to the injected mass.
Two options are available:
ncesmp:
number of cells where a mass source term is imposedicetsm(ieltsm)
: identification of the cells where a mass source term is imposed. For each cell where a mass source term is imposed (ielstm
in
[1;ncesmp]), icetsm(ieltsm)
is the global index number of the corresponding cell (icestm(ieltsm)
in
[1;ncel])smacel(ieltsm,ipr)
: value of the injection mass rate gamma (in ) in the ieltsm
cell with mass source termitypsm(ieltsm,ivar)
: type of treatment for variable ivar in the ieltsm
cell with mass source term. itypsm = 0
--> injection of ivar
at local value itypsm = 1
--> injection of ivar
at user specified valuesmacel(ieltsm,ivar)
: specified value for variable ivar associated to the injected mass in the ieltsm
cell with a mass source term except for ivar=ipr
itypsm(ieltsm,ivar)=0
, smacel(ieltsm,ivar)
is not usedsmacel(ieltsm,ipr)<0
, mass is removed from the system, therefore Code_Saturne
automatically considers , whatever the values of itypsm
or smacel
specified by the userivar
is not linked for a mass source term is imposed, no source term will be taken into account.The following initialization block needs to be added for the following examples:
At the end of the subroutine, it is recommended to deallocate the work array:
In theory Fortran 95 deallocates locally-allocated arrays automatically, but deallocating arrays in a symetric manner to their alloacation is good pratice, and avoids using a different logic C and Fortran.
iappel = 1
: ncesmp:
calculation of the number of cells with mass source termncesmp>0
): iappel = 2
: icetsm:
index number of cells with mass source termssmacel
in this section (it is set on the third call, iappel = 3
)icetsm
in this section on the first call (iappel=1
)This section (iappel = 1 or 2)
is only accessed at the beginning of a calculation. Should the localization of the mass source terms evolve in time, the user must identify at the beginning all cells that can potentially become a mass source term.
No mass source term (default)
Mass source term in the cells that have boundary face of color 3 and the cells with a coordinate X between 2.5 and 5.
In this test in two parts, one must pay attention not to count the cells twice (a cell with a boundary face of color 3 can also have a coordinate X between 2.5 and 5). One should also pay attention that, on the first call, the array icetsm
doesn't exist yet. It mustn't be used outside of tests (iappel.eq.2
).
iappel
= 1: specification of ncesmp
. This block is valid for both examples.iappel
= 3: - itypsm:
type of mass source term
smacel
: mass source termitypsm(ieltsm,var)
is set to 1, smaccel(ieltsm,var)
must be set.Simulation of an inlet condition by mass source terms and printing of the total mass rate.
Calculation of the inlet conditions for k and epsilon with standard laws in a circular pipe
Simulation of a suction (by a pump for instance) with a total rate of . The suction rate is supposed to be uniformly distributed on all the cells selected above.
Calculation of the total volume of the area where the mass source term is imposed (the case of parallel computing is taken into account with the call to parsom
).
The mass suction rate is (in ). It is set below, with a test for cases where . The total mass rate is calculated for verification.