![]() |
programmer's documentation
|
Additional right-hand side source terms for scalar equations (user scalars and specific physics scalars) with ustssc subroutine.
The routine is called for each scalar, user or specific physisc. It is therefore necessary to test the value of the scalar number iscal to separate the treatments of the different scalars (if (iscal.eq.p) then ....)
.
The additional source term is decomposed into an explicit part and an implicit part
that must be provided here. The resulting equation solved by the code for a scalar
is:
The and
arrays are already initialized to 0 before entering the the routine. It is not needed to do it in the routine (waste of CPU time).
For stability reasons, Code_Saturne
will not add -crvimp
directly to the diagonal of the matrix, but Max
(-crvimp,0). This way, the crvimp
term is treated implicitely only if it strengthens the diagonal of the matrix. However, when using the second-order in time scheme, this limitation cannot be done anymore and -crvimp
is added directly. The user should therefore test the negativity of crvimp
by himself.
When using the second-order in time scheme, one should supply:
The selection of cells where to apply the source terms is based on a getcel command. For more info on the syntax of the getcel command, refer to the user manual or to the comments on the similar command getfbr in the routine cs_user_boundary_conditions.
In case of a complex, non-linear source term, say , for scalar
, the easiest method is to implement the source term explicitely.
where is the value of
at time
, the beginning of the time step.
This yields :
crvexp = volume*F(f(n))
crvimp = 0
However, if the source term is potentially steep, this fully explicit method will probably generate instabilities. It is therefore wiser to partially implicit the term by writing:
This yields:
crvexp = volume*(F(f(n)) - dF/df*f(n))
crvimp = volume*dF/df
Initialization
Map field arrays
Parallelism