Loading...
Searching...
No Matches
nutUSpaldingWallFunctionFvPatchScalarField Class Reference

This boundary condition provides a wall function for the turbulent viscosity (i.e. nut) based on velocity (i.e. U). Using Spalding's law gives a continuous nut profile to the wall. More...

#include <nutUSpaldingWallFunctionFvPatchScalarField.H>

Inheritance diagram for nutUSpaldingWallFunctionFvPatchScalarField:
Collaboration diagram for nutUSpaldingWallFunctionFvPatchScalarField:

Public Member Functions

 TypeName ("nutUSpaldingWallFunction")
 Runtime type information.
 nutUSpaldingWallFunctionFvPatchScalarField (const fvPatch &, const DimensionedField< scalar, volMesh > &)
 Construct from patch and internal field.
 nutUSpaldingWallFunctionFvPatchScalarField (const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
 Construct from patch, internal field and dictionary.
 nutUSpaldingWallFunctionFvPatchScalarField (const nutUSpaldingWallFunctionFvPatchScalarField &, const fvPatch &, const DimensionedField< scalar, volMesh > &, const fvPatchFieldMapper &)
 Construct by mapping given nutUSpaldingWallFunctionFvPatchScalarField onto a new patch.
 nutUSpaldingWallFunctionFvPatchScalarField (const nutUSpaldingWallFunctionFvPatchScalarField &)
 Construct as copy.
 nutUSpaldingWallFunctionFvPatchScalarField (const nutUSpaldingWallFunctionFvPatchScalarField &, const DimensionedField< scalar, volMesh > &)
 Construct as copy setting internal field reference.
virtual tmp< fvPatchField< scalar > > clone () const
 Return a clone.
virtual tmp< fvPatchField< scalar > > clone (const DimensionedField< scalar, volMesh > &iF) const
 Clone with an internal field reference.
virtual ~nutUSpaldingWallFunctionFvPatchScalarField ()
 Destructor.
virtual tmp< scalarFieldyPlus () const
 Calculate and return the yPlus at the boundary.
virtual void write (Ostream &os) const
 Write.
Public Member Functions inherited from nutWallFunctionFvPatchScalarField
 TypeName ("nutWallFunction")
 Runtime type information.
 nutWallFunctionFvPatchScalarField (const fvPatch &, const DimensionedField< scalar, volMesh > &)
 Construct from patch and internal field.
 nutWallFunctionFvPatchScalarField (const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
 Construct from patch, internal field and dictionary.
 nutWallFunctionFvPatchScalarField (const nutWallFunctionFvPatchScalarField &, const fvPatch &, const DimensionedField< scalar, volMesh > &, const fvPatchFieldMapper &)
 Construct by mapping given nutWallFunctionFvPatchScalarField onto a new patch.
 nutWallFunctionFvPatchScalarField (const nutWallFunctionFvPatchScalarField &)
 Construct as copy.
 nutWallFunctionFvPatchScalarField (const nutWallFunctionFvPatchScalarField &, const DimensionedField< scalar, volMesh > &)
 Construct as copy setting internal field reference.
const wallFunctionCoefficientswallCoeffs () const noexcept
 Return wallFunctionCoefficients.
virtual void updateCoeffs ()
 Update the coefficients associated with the patch field.

Protected Member Functions

virtual tmp< scalarFieldcalcNut () const
 Uncomment in case of intrumentation.
tmp< scalarFieldcalcUTau (const scalarField &magGradU) const
 Calculate the friction velocity.
tmp< scalarFieldcalcUTau (const scalarField &magGradU, const label maxIter, scalarField &err) const
 Calculate the friction velocity and number of iterations for convergence.
void writeLocalEntries (Ostream &) const
 Write local wall function variables.
Protected Member Functions inherited from nutWallFunctionFvPatchScalarField
virtual const volVectorFieldU (const turbulenceModel &turb) const
 Helper to return the velocity field either from the turbulence model (default) or the mesh database.
virtual void checkType ()
 Check the type of the patch.
void writeLocalEntries (Ostream &) const
 Write local wall function variables.

Protected Attributes

const label maxIter_
 Max iterations in calcNut.
const scalar tolerance_
 Convergence tolerance.
Protected Attributes inherited from nutWallFunctionFvPatchScalarField
word UName_
 Name of velocity field.
wallFunctionCoefficients wallCoeffs_
 Wall-function coefficients.

Additional Inherited Members

Static Public Member Functions inherited from nutWallFunctionFvPatchScalarField
static const nutWallFunctionFvPatchScalarFieldnutw (const turbulenceModel &turbModel, const label patchi)
 Return the nut patchField for the given wall patch.

Detailed Description

This boundary condition provides a wall function for the turbulent viscosity (i.e. nut) based on velocity (i.e. U). Using Spalding's law gives a continuous nut profile to the wall.

\‍[    y^+ = u^+ + \frac{1}{E} \left[exp(\kappa u^+) - 1 - \kappa u^+\,
        - 0.5 (\kappa u^+)^2 - \frac{1}{6} (\kappa u^+)^3\right]
\‍]

where

$      y^+     $=Wall-normal height of a cell centre in wall units
$      u^+     $=Velocity at $y^+$ in wall units
$      \kappa  $=von Karman constant
Usage
Example of the boundary condition specification:
<patchName>
{
    // Mandatory entries
    type            nutUSpaldingWallFunction;

    // Optional entries
    maxIter         10;
    tolerance       0.0001;

    // Inherited entries
    ...
}

where the entries mean:

Property Description Type Reqd Deflt
type Type name: nutUSpaldingWallFunction word yes -
maxIter Number of Newton-Raphson iterations label no 10
tolerance Convergence tolerance scalar no 0.0001

The inherited entries are elaborated in:

Note
  • Suffers from non-exact restart since correctNut() (called through turbulence->validate) returns a slightly different value every time it is called. This is since the seed for the Newton-Raphson iteration uses the current value of *this (=nut ).
  • This can be avoided by overriding the tolerance. This also switches on a pre-detection whether the current nut already satisfies the turbulence conditions and if so does not change it at all. This means that the nut only changes if it 'has really changed'. This probably should be used with a tight tolerance, to make sure to kick every iteration, e.g. maxIter 100; tolerance 1e-7;
Source files

Definition at line 141 of file nutUSpaldingWallFunctionFvPatchScalarField.H.

Constructor & Destructor Documentation

◆ nutUSpaldingWallFunctionFvPatchScalarField() [1/5]

nutUSpaldingWallFunctionFvPatchScalarField ( const fvPatch & p,
const DimensionedField< scalar, volMesh > & iF )

Construct from patch and internal field.

Definition at line 204 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References maxIter_, nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField(), p, and tolerance_.

Referenced by nutUSpaldingWallFunctionFvPatchScalarField(), nutUSpaldingWallFunctionFvPatchScalarField(), nutUSpaldingWallFunctionFvPatchScalarField(), and TypeName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nutUSpaldingWallFunctionFvPatchScalarField() [2/5]

nutUSpaldingWallFunctionFvPatchScalarField ( const fvPatch & p,
const DimensionedField< scalar, volMesh > & iF,
const dictionary & dict )

Construct from patch, internal field and dictionary.

Definition at line 240 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References dict, maxIter_, nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField(), p, and tolerance_.

Here is the call graph for this function:

◆ nutUSpaldingWallFunctionFvPatchScalarField() [3/5]

nutUSpaldingWallFunctionFvPatchScalarField ( const nutUSpaldingWallFunctionFvPatchScalarField & ptf,
const fvPatch & p,
const DimensionedField< scalar, volMesh > & iF,
const fvPatchFieldMapper & mapper )

◆ nutUSpaldingWallFunctionFvPatchScalarField() [4/5]

nutUSpaldingWallFunctionFvPatchScalarField ( const nutUSpaldingWallFunctionFvPatchScalarField & wfpsf)

◆ nutUSpaldingWallFunctionFvPatchScalarField() [5/5]

nutUSpaldingWallFunctionFvPatchScalarField ( const nutUSpaldingWallFunctionFvPatchScalarField & wfpsf,
const DimensionedField< scalar, volMesh > & iF )

Construct as copy setting internal field reference.

Definition at line 274 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References maxIter_, nutUSpaldingWallFunctionFvPatchScalarField(), nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField(), and tolerance_.

Here is the call graph for this function:

◆ ~nutUSpaldingWallFunctionFvPatchScalarField()

Member Function Documentation

◆ calcNut()

Foam::tmp< Foam::scalarField > calcNut ( ) const
protectedvirtual

Uncomment in case of intrumentation.

mutable uint64_t invocations_; mutable uint64_t nontrivial_; mutable uint64_t nonconvergence_; mutable uint64_t iterations_;

Calculate the turbulent viscosity

Implements nutWallFunctionFvPatchScalarField.

Definition at line 32 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References calcUTau(), forAll, IOobject::groupName(), Foam::mag(), Foam::max(), nutWallFunctionFvPatchScalarField::nutw(), turbulenceModel::propertiesName, tmp< T >::ref(), Foam::sqr(), tolerance_, and U.

Here is the call graph for this function:

◆ calcUTau() [1/2]

Foam::tmp< Foam::scalarField > calcUTau ( const scalarField & magGradU) const
protected

Calculate the friction velocity.

Definition at line 88 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References calcUTau(), and maxIter_.

Referenced by calcNut(), calcUTau(), and yPlus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calcUTau() [2/2]

Foam::tmp< Foam::scalarField > calcUTau ( const scalarField & magGradU,
const label maxIter,
scalarField & err ) const
protected

◆ writeLocalEntries()

void writeLocalEntries ( Ostream & os) const
protected

Write local wall function variables.

Definition at line 192 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References maxIter_, os(), and tolerance_.

Referenced by write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TypeName()

TypeName ( "nutUSpaldingWallFunction" )

Runtime type information.

References nutUSpaldingWallFunctionFvPatchScalarField().

Here is the call graph for this function:

◆ clone() [1/2]

virtual tmp< fvPatchField< scalar > > clone ( ) const
inlinevirtual

Return a clone.

Definition at line 260 of file nutUSpaldingWallFunctionFvPatchScalarField.H.

References fvPatchField< Type >::Clone().

Here is the call graph for this function:

◆ clone() [2/2]

virtual tmp< fvPatchField< scalar > > clone ( const DimensionedField< scalar, volMesh > & iF) const
inlinevirtual

Clone with an internal field reference.

Definition at line 268 of file nutUSpaldingWallFunctionFvPatchScalarField.H.

References fvPatchField< Type >::Clone().

Here is the call graph for this function:

◆ yPlus()

Foam::tmp< Foam::scalarField > yPlus ( ) const
virtual

Calculate and return the yPlus at the boundary.

Implements nutWallFunctionFvPatchScalarField.

Definition at line 315 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References calcUTau(), IOobject::groupName(), Foam::mag(), turbulenceModel::propertiesName, fvPatchField< Type >::snGrad(), U, and y.

Here is the call graph for this function:

◆ write()

void write ( Ostream & os) const
virtual

Write.

Reimplemented from nutWallFunctionFvPatchScalarField.

Definition at line 339 of file nutUSpaldingWallFunctionFvPatchScalarField.C.

References os(), nutWallFunctionFvPatchScalarField::write(), writeLocalEntries(), and fvPatchField< Type >::writeValueEntry().

Here is the call graph for this function:

Member Data Documentation

◆ maxIter_

◆ tolerance_


The documentation for this class was generated from the following files: