The open source CFD toolbox
potentialFoam

# Overview

• Category: Basic
• potentialFoam is a potential flow solver which solves for the velocity potential (i.e. Phi) to calculate the volumetric face-flux field (i.e. phi) from which the velocity field (i.e. U) is obtained by reconstructing the flux.
• The application scope of potentialFoam covers flow types with the following characteristics:
• Irrotational
• Inviscid
• Incompressible
• Statistically stationary
• Multiple reference frame
• potentialFoam can be used for the following applications:
• Potential flow applications within the aforementioned scope. Accordingly, for example, wake or boundary layer flows are out of the potentialFoam's scope.
• Initialisation of internal fields away from walls for viscous computations.

## Input operands

Operand Description Required Type Location
U Velocity [m/s] mandatory volVectorField $FOAM_CASE/<time>/U p Kinematic pressure [m2/s2] optional volScalarField $FOAM_CASE/<time>/p
Phi Velocity potential [m2/s] optional volScalarField $FOAM_CASE/<time>/Phi ## Output operands • All output fields are written at the end of the application execution. • No write is performed at the end of any sub-iteration. Operand Description Note Type Location U Velocity [m/s] overwrites U volVectorField $FOAM_CASE/<time>/U
p Kinematic pressure [m2/s2] overwrites p if -writep exists volScalarField $FOAM_CASE/<time>/p Phi Velocity potential [m2/s] overwrites Phi if -writePhi exists volScalarField $FOAM_CASE/<time>/Phi
phi Volumetric face flux [m3/s] writes phi if -writephi exists surfaceScalarField $FOAM_CASE/<time>/phi ## Solution controls$FOAM_CASE/system/fvSchemes requirements:

• grad(Phi)
• grad(p) if -writep is on
• Divergence schemes:
• div(phi,U)
• div(div(phi,U))
• Laplacian schemes:
• laplacian(1,Phi)
• laplacian(p) if -writep is on

\$FOAM_CASE/system/fvSolution requirements:

• Solver entry for Phi
• Solver entry for p if -writep is on.
• Iteration entry, e.g.
    potentialFlow
{
nNonOrthogonalCorrectors  3;
}


## Command line options

• -pName <pFieldName>: Use the field named <pFieldName> as the input pressure field
• -writePhi: Write the velocity potential field
• -writephi: Write the volumetric face flux field
• -writep: Write the estimated Euler pressure field
• -initialiseUBCs: Initialise the velocity boundary conditions prior to computing the volumetric flux

# Model equations

For incompressible steady-state potential flows, the governing equation of the velocity potential satisfies the Laplace's equation:

$\laplacian \Phi = 0$

where $$\Phi$$ is the velocity potential.

Velocity field (i.e. $$\u$$) can then be computed from the velocity potential as follows:

$\u = \grad \Phi$

where the velocity field is solenoidal:

$\div \u = 0$

# OpenFOAM implementation

## Equations

The main differences between the original and implemented governing equations are as follows:

• The solenoidality of the velocity field is valid on the theoretical level, for example on the differential form of governing equations. However, the divergence of the velocity field on an arbitrary numerical setup and process is not strictly zero; therefore, the solenoidal field cannot be strictly applied in practice. As a consequence, the Poisson's equation has been computed in potentialFoam instead of the Laplace's equation.
• The input internal field of velocity is internally overwritten as zero at the outset of the application execution.

The implementation of the velocity potential governing equation:

$\laplacian \Phi = \div \phi$

where

 $$\Phi$$ = Velocity potential [m2/s] $$\phi$$ = Volumetric face flux [m3/s]

$$\phi$$ is computed by:

$\phi = \u_f \dprod \vec{S}_f$

where

 $$\u_f$$ = Face-centre velocity field [m/s] $$\vec{S}_f$$ = Surface-normal area vector field [m2] $$\dprod$$ = Inner product

Finally the cell-centre velocity (i.e. $$\u$$) is derived by reconstructing the volumetric face flux.

In addition to the computation of $$\u$$ and $$\phi$$, at the end of the potentialFoam execution, two error metrics and optionally the Euler pressure field are computed.

The first error metric is the continuity error which is computed as the cell-volume weighted average of the divergence of the volumetric face flux field:

$\epsilon_c = \frac{ \sum_i V_i |\div \phi |_i }{ \sum_i V_i }$

where

 $$\epsilon_c$$ = Continuity error $$i$$ = Cell index $$V_i$$ = Volume of the cell i [m3] $$\phi$$ = Volumetric face flux [m3/s]

The second error metric is the interpolated velocity error which is computed as the normalised difference between the original volumetric face flux (i.e. $$\phi$$), and the volumetric face flux computed from the cell-centre velocity field (which is derived from the original $$\phi$$):

$\epsilon_i = \frac{ \sqrt{ \sum (\phi_\u - \phi)_i^2} }{ \sum |\vec{S}_f|_i }$

where

 $$\epsilon_i$$ = Interpolated velocity error $$i$$ = Cell index $$\phi_\u$$ = Volumetric face flux obtained from velocity [m3/s] $$\phi$$ = Original volumetric face flux [m3/s] $$\vec{S}_f$$ = Surface-normal area vector [m2]

Optionally, the corresponding pressure field can be estimated from the divergence of the Euler equation:

$\laplacian p + \div(\div(\u \otimes \u )) = 0$

where $$\otimes$$ is the dyadic operator (i.e. outer product).

However, the expression above generates excessive pressure variation in regions of large velocity gradient normal to the flow direction. A better option is to calculate the pressure field corresponding to velocity variation along the streamlines:

$\laplacian p + \vec{F}_p = 0$

where

$\vec{F}_p = \div(\vec{F} \dprod \div(\phi \u))$

with the symmetric flow-direction filter tensor (i.e. $$\vec{F}$$) is obtained from:

$\vec{F} = \frac{ \u \otimes \u }{ |\u^2| + \zeta \hat{|\u^2|} }$

where

 $$\hat{.}$$ = Arithmetic average operator $$\zeta$$ = Small value to prevent floating point exceptions $$\u$$ = Velocity field [m/s]

• None

Tutorial:

Source code: