![]() |
programmer's documentation
|
Additional right-hand side source terms for velocity components equation (Navier-Stokes)
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 velocity is:
Note that and
are defined after the Finite Volume integration over the cells, so they include the
term. More precisely:
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 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.
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.
Example of arbitrary source term for component :
appearing in the equation under the form:
In the following example:
with:
CKP = 1.d0
(in MMT = 100.d0
(in which yields:
crvimp(1, 1, iel) = volume(iel)* A = - volume(iel)*(rho*CKP )
crvexp(1, iel) = volume(iel)* B = volume(iel)*(XMMT)
Example to add Boussinesq source to the z component of :