9.0
general documentation
Loading...
Searching...
No Matches
User source terms

Basic User source terms

Function called every time step.

Assume, for example, that the user source terms modify the equation of a variable $\varphi$ in the following way: $\rho\frac{\partial \varphi}{\partial t}+\ldots = \ldots + S_{impl}\times\varphi+S_{expl}$ The example is valid for a velocity component, for a turbulent variable ( $k$, $\varepsilon$, $R_{ij}$, $\omega$, $\varphi$ or $\overline{f}$) and for a scalar (or for the average of the square of the fluctuations of a scalar), because the syntax of the cs_user_source_terms function in the cs_user_source_terms.c file is similar.

For user scalars

The source terms in the transport equations related to the user scalars (passive or not, average of the square of the fluctuations of a scalar, ...) can be filled in thanks to the GUI or the cs_user_source_terms user file. Without the GUI, the cs_user_source_terms function is used to add source terms to the transport equations related to the user scalars, this function is called every time step, once for each user scalar. The user must provide the arrays st_imp and st_exp related to each scalar. st_imp and st_exp must be set to 0 for the scalars on which it is not wished for the user source term to be applied.

With the GUI

The GUI can be used if the source terms are proportional to the volume of the cells or the volume of the fluid in the cell.

By example if we have:

$\text{\texttt{st\_exp[c\_id]}}= 0.5*\text{\texttt{cell\_vol[c\_id]}}$

$\text{\texttt{st\_imp[c\_id]}}= -0.75*\text{\texttt{cell\_vol[c\_id]}}$

We can define them directly in the GUI

Adding the scalar

select the scalar source terms

initialization of source terms