fvOptions meanVelocityForce

An Example Usage of meanVelocityForce

  • fields: [Required] Name of the velocity field
  • Ubar: [Required] Desired mean velocity
  • relaxation: [Optional] Relaxation factor (default = 1.0)
  • selectionMode: [Required] Domain the source is applied (all/cellSet/cellZone/points)

The parameter name fields has been changed from fieldNames in the latest version as described in this page.

The meanVelocityForce fvOptions calculates a momentum source so that the volume averaged velocity \eqref{eq:magUbarAve} in the whole computational domain (all) or a part of domain specified using cellSet or cellZone reaches the desired mean velocity Ubar.

\begin{align}
\frac{\sum_{i}^{} \left(\frac{\bar{\boldsymbol{u}}}{|\bar{\boldsymbol{u}}|} \cdot \boldsymbol{u}_i \right)V_i}{\sum_{i}^{} V_i}, \tag{1} \label{eq:magUbarAve}
\end{align}
where the summation is over the cells that belong to the user-specified domain, \(\bar{\boldsymbol{u}}\) is Ubar, \(\boldsymbol{u}_i\) is the velocity in the i-th cell and \(V_i\) is the volume of the i-th cell.

patchMeanVelocityForce

The patchMeanVelocityForce fvOptions is also available to specify the desired mean velocity on a patch instead of the volumetric average \eqref{eq:magUbarAve}.

Tutorial
Source Code

In the case of pimpleFoam, we can find three lines related to the fvOptions as shown in the following code (UEqn.H):

In what follows, we will take a closer look at each of three highlighted lines when the meanVelocityForce fvOptions is used. The source files of this class are in src/fvOptions/sources/derived/meanVelocityForce.

  • l. 11

The addSup function is called from l.11 in UEqn.H when discretizing the momentum equation and source term Su is added to the equation.

  • l. 17

The constrain function is called from l.17 in UEqn.H. The if loop is true in the first iteration and else loop is executed for the other iterations to initialize and update the volScalarField defined as the reciprocal of the diagonal coefficients.

  • l. 23

As the average velocity magUbarAve \eqref{eq:magUbarAve} reaches a user-specified value Ubar, the pressure gradient increment dGradP_ needed to adjust the average velocity converges to 0.

Author: fumiya

CFD engineer in Japan

One thought on “fvOptions meanVelocityForce”

  1. I saw in the code it only handle pressure incompressible case, so can you guide me to apply it for compressible solver? Thank you!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.