ENH: Subtle renovations in wall function documentation and input

- Improves header file documentations
  - Adds const specifier to various objects
  - Allows various model constants to be user-defined
  - Changes from lookupOrDefault() to getOrDefault()
  - Consistent namespace usage:
    - If the WF belongs to only Foam:: namespace, use Foam:: explicitly
    - If the WF belongs to more than one namespaces, put the WF in namespace
      parentheses
  - Adds the missing dashes in comments required by Doxygen
  - Corrects capitalisation in comments
  - The terminology 'viscous sublayer' was preferred over 'laminar sublayer'
    due to the fact that the sublayer is not laminar.
  - The order of initialisation of fields is changed to be the same across all.
This commit is contained in:
Kutalmis Bercin
2019-10-02 12:58:20 +01:00
committed by Andrew Heather
parent ce9ea1ca08
commit 458738f095
29 changed files with 767 additions and 549 deletions

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,6 +31,7 @@ License
#include "fvMatrix.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::scalar Foam::epsilonWallFunctionFvPatchScalarField::tolerance_ = 1e-5;
@ -127,7 +128,10 @@ void Foam::epsilonWallFunctionFvPatchScalarField::createAveragingWeights()
Foam::epsilonWallFunctionFvPatchScalarField&
Foam::epsilonWallFunctionFvPatchScalarField::epsilonPatch(const label patchi)
Foam::epsilonWallFunctionFvPatchScalarField::epsilonPatch
(
const label patchi
)
{
const volScalarField& epsilon =
static_cast<const volScalarField&>(this->internalField());
@ -244,11 +248,11 @@ epsilonWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF),
G_(),
epsilon_(),
lowReCorrection_(false),
initialised_(false),
master_(-1),
G_(),
epsilon_(),
cornerWeights_()
{}
@ -263,11 +267,11 @@ epsilonWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
G_(),
epsilon_(),
lowReCorrection_(ptf.lowReCorrection_),
initialised_(false),
master_(-1),
G_(),
epsilon_(),
cornerWeights_()
{}
@ -281,11 +285,11 @@ epsilonWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
G_(),
epsilon_(),
lowReCorrection_(dict.lookupOrDefault("lowReCorrection", false)),
lowReCorrection_(dict.getOrDefault("lowReCorrection", false)),
initialised_(false),
master_(-1),
G_(),
epsilon_(),
cornerWeights_()
{
// Apply zero-gradient condition on start-up
@ -300,11 +304,11 @@ epsilonWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ewfpsf),
G_(),
epsilon_(),
lowReCorrection_(ewfpsf.lowReCorrection_),
initialised_(false),
master_(-1),
G_(),
epsilon_(),
cornerWeights_()
{}
@ -317,18 +321,21 @@ epsilonWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ewfpsf, iF),
G_(),
epsilon_(),
lowReCorrection_(ewfpsf.lowReCorrection_),
initialised_(false),
master_(-1),
G_(),
epsilon_(),
cornerWeights_()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalarField& Foam::epsilonWallFunctionFvPatchScalarField::G(bool init)
Foam::scalarField& Foam::epsilonWallFunctionFvPatchScalarField::G
(
bool init
)
{
if (patch().index() == master_)
{
@ -398,7 +405,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::updateCoeffs()
forAll(*this, facei)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
G[celli] = G0[celli];
epsilon[celli] = epsilon0[celli];
@ -449,11 +456,11 @@ void Foam::epsilonWallFunctionFvPatchScalarField::updateWeightedCoeffs
// Only set the values if the weights are > tolerance
forAll(weights, facei)
{
scalar w = weights[facei];
const scalar w = weights[facei];
if (w > tolerance_)
if (tolerance_ < w)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
G[celli] = (1.0 - w)*G[celli] + w*G0[celli];
epsilon[celli] = (1.0 - w)*epsilon[celli] + w*epsilon0[celli];
@ -501,7 +508,7 @@ void Foam::epsilonWallFunctionFvPatchScalarField::manipulateMatrix
forAll(weights, facei)
{
// Only set the values if the weights are > tolerance
if (weights[facei] > tolerance_)
if (tolerance_ < weights[facei])
{
const label celli = faceCells[facei];
@ -524,6 +531,16 @@ void Foam::epsilonWallFunctionFvPatchScalarField::manipulateMatrix
}
void Foam::epsilonWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
os.writeEntry("lowReCorrection", lowReCorrection_);
fixedValueFvPatchField<scalar>::write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam

View File

@ -30,32 +30,31 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulence dissipation wall constraint
for low- and high-Reynolds number turbulence models.
This boundary condition provides a wall constraint on turbulent kinetic
energy dissipation rate, i.e. \c epsilon, for low- and high-Reynolds number
turbulence models.
The condition can be applied to wall boundaries for which it
- calculates \c epsilon and \c G
- specifies the near-wall epsilon value
- specifies the near-wall \c epsilon value
where
\vartable
epsilon | turblence dissipation field
G | turblence generation field
epsilon | turbulent kinetic energy dissipation rate field
G | turbulent kinetic energy production field (divergence-free)
\endvartable
The low-Re correction is activated by setting the entry
\c lowReCorrection to 'on'; in this mode the model switches between
laminar and turbulent functions based on the laminar-to-turbulent y+ value
derived from the kappa and E specified in the corresponding nutWallFunction. When the \c lowReCorrection is inactive, the
wall function operates in high-Re mode.
viscous and turbulent functions based on the viscous-to-turbulent
\c y+ value derived from the \c kappa and \c E.
When the \c lowReCorrection is inactive, the wall function operates
in high-Re mode.
Usage
\table
Property | Description | Required | Default value
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
lowReCorrection | Low-Re correction active | no | off
\endtable
@ -63,13 +62,20 @@ Usage
\verbatim
<patchName>
{
// Mandatory entries
type epsilonWallFunction;
// Optional entries
}
\endverbatim
Note
The coefficients \c Cmu, \c kappa, and \c E are obtained from
the specified \c nutWallFunction in order to ensure that each patch
possesses the same set of values for these coefficients.
See also
Foam::fixedInternalValueFvPatchField
Foam::omegaWallFunctionFvPatchScalarField
SourceFiles
epsilonWallFunctionFvPatchScalarField.C
@ -98,17 +104,11 @@ class epsilonWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Tolerance used in weighted calculations
static scalar tolerance_;
//- Local copy of turbulence G field
scalarField G_;
//- Local copy of turbulence epsilon field
scalarField epsilon_;
//- Apply low-Re correction term; default = no
bool lowReCorrection_;
@ -118,6 +118,12 @@ protected:
//- Master patch ID
label master_;
//- Local copy of turbulence G field
scalarField G_;
//- Local copy of turbulence epsilon field
scalarField epsilon_;
//- List of averaging corner weights
List<List<scalar>> cornerWeights_;
@ -125,11 +131,11 @@ protected:
// Protected Member Functions
//- Set the master patch - master is responsible for updating all
// wall function patches
//- wall function patches
virtual void setMaster();
//- Create the averaging weights for cells which are bounded by
// multiple wall function faces
//- multiple wall function faces
virtual void createAveragingWeights();
//- Helper function to return non-const access to an epsilon patch
@ -187,8 +193,8 @@ public:
);
//- Construct by mapping given
// epsilonWallFunctionFvPatchScalarField
// onto a new patch
//- epsilonWallFunctionFvPatchScalarField
//- onto a new patch
epsilonWallFunctionFvPatchScalarField
(
const epsilonWallFunctionFvPatchScalarField&,
@ -231,6 +237,7 @@ public:
);
}
//- Destructor
virtual ~epsilonWallFunctionFvPatchScalarField() = default;
@ -263,6 +270,12 @@ public:
fvMatrix<scalar>& matrix,
const scalarField& weights
);
// I-O
//- Write
virtual void write(Ostream&) const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016, 2019 OpenFOAM Foundation
@ -117,6 +117,9 @@ void fWallFunctionFvPatchScalarField::updateCoeffs()
const scalarField& y = turbModel.y()[patchi];
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
@ -126,28 +129,25 @@ void fWallFunctionFvPatchScalarField::updateCoeffs()
const tmp<volScalarField> tv2 = v2fModel.v2();
const volScalarField& v2 = tv2();
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const scalar Cmu25 = pow025(nutw.Cmu());
const scalar N = 6.0;
scalarField& f = *this;
// Set f wall values
forAll(f, facei)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[celli]);
const scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = uTau*y[facei]/nuw[facei];
const scalar yPlus = uTau*y[facei]/nuw[facei];
if (yPlus > nutw.yPlusLam())
if (nutw.yPlusLam() < yPlus)
{
scalar N = 6.0;
scalar v2c = v2[celli];
scalar epsc = epsilon[celli];
scalar kc = k[celli];
const scalar v2c = v2[celli];
const scalar epsc = epsilon[celli];
const scalar kc = k[celli];
f[facei] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL);
f[facei] /= sqr(uTau) + ROOTVSMALL;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016, 2019 OpenFOAM Foundation
@ -30,29 +30,44 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulence damping function, f, wall
function condition for low- and high Reynolds number, turbulent flow cases
This boundary condition provides a wall constraint on the elliptic
relaxation factor, \c f, which is executed in the \c v2-f eddy viscosity
turbulence model. The condition is applicable for low- and high-Reynolds
number turbulent flow cases.
The model operates in two modes, based on the computed laminar-to-turbulent
switch-over y+ value derived from kappa and E specified in the corresponding
nutWallFunction.
For \c f, the viscous sublayer and log-law region blending approaches are
claimed to be inviable (Popovac and Hanjalić (2007), p. 194). Therefore,
the only boundary condition blending mode is the stepwise mode
where the viscous sublayer and log-law region contributions switch over
\c y+ value derived from the \c kappa and \c E.
Reference:
\verbatim
Remark on the blending approach:
Popovac, M., & Hanjalić, K. (2007).
Compound wall treatment for RANS computation of complex
turbulent flows and heat transfer.
Flow, turbulence and combustion, 78(2), 177-202.
doi:10.1007/s10494-006-9067-x
\endverbatim
Usage
\table
Property | Description | Required | Default value
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type fWallFunction;
// No optional entry
}
\endverbatim
Note
The coefficients \c Cmu, \c kappa, and \c E are obtained from
the specified \c nutWallFunction in order to ensure that each patch
possesses the same set of values for these coefficients.
See also
Foam::fixedValueFvPatchField
@ -81,7 +96,6 @@ class fWallFunctionFvPatchScalarField
:
public fixedValueFvPatchField<scalar>
{
public:
//- Runtime type information
@ -106,7 +120,7 @@ public:
);
//- Construct by mapping given fWallFunctionFvPatchScalarField
// onto a new patch
//- onto a new patch
fWallFunctionFvPatchScalarField
(
const fWallFunctionFvPatchScalarField&,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016, 2019 OpenFOAM Foundation
@ -30,25 +30,24 @@ License
#include "turbulenceModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
Foam::kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(p, iF),
Ceps2_(1.9)
Ceps2_(1.9),
Ck_(-0.416),
Bk_(8.366),
C_(11.0)
{}
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
Foam::kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
(
const kLowReWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -57,11 +56,14 @@ kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
Ceps2_(ptf.Ceps2_)
Ceps2_(ptf.Ceps2_),
Ck_(ptf.Ck_),
Bk_(ptf.Bk_),
C_(ptf.C_)
{}
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
Foam::kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -69,34 +71,43 @@ kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
Ceps2_(dict.lookupOrDefault<scalar>("Ceps2", 1.9))
Ceps2_(dict.getOrDefault<scalar>("Ceps2", 1.9)),
Ck_(dict.getOrDefault<scalar>("Ck", -0.416)),
Bk_(dict.getOrDefault<scalar>("Bk", 8.366)),
C_(dict.getOrDefault<scalar>("C", 11.0))
{}
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
Foam::kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
(
const kLowReWallFunctionFvPatchScalarField& kwfpsf
)
:
fixedValueFvPatchField<scalar>(kwfpsf),
Ceps2_(kwfpsf.Ceps2_)
Ceps2_(kwfpsf.Ceps2_),
Ck_(kwfpsf.Ck_),
Bk_(kwfpsf.Bk_),
C_(kwfpsf.C_)
{}
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
Foam::kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
(
const kLowReWallFunctionFvPatchScalarField& kwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(kwfpsf, iF),
Ceps2_(kwfpsf.Ceps2_)
Ceps2_(kwfpsf.Ceps2_),
Ck_(kwfpsf.Ck_),
Bk_(kwfpsf.Bk_),
C_(kwfpsf.C_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
void Foam::kLowReWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -119,12 +130,12 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalar Cmu25 = pow025(nutw.Cmu());
scalarField& kw = *this;
@ -132,22 +143,20 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
// Set k wall values
forAll(kw, facei)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[celli]);
const scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = uTau*y[facei]/nuw[facei];
const scalar yPlus = uTau*y[facei]/nuw[facei];
if (yPlus > nutw.yPlusLam())
if (nutw.yPlusLam() < yPlus)
{
scalar Ck = -0.416;
scalar Bk = 8.366;
kw[facei] = Ck/nutw.kappa()*log(yPlus) + Bk;
kw[facei] = Ck_/nutw.kappa()*log(yPlus) + Bk_;
}
else
{
scalar C = 11.0;
scalar Cf = (1.0/sqr(yPlus + C) + 2.0*yPlus/pow3(C) - 1.0/sqr(C));
const scalar Cf =
1.0/sqr(yPlus + C_) + 2.0*yPlus/pow3(C_) - 1.0/sqr(C_);
kw[facei] = 2400.0/sqr(Ceps2_)*Cf;
}
@ -163,23 +172,29 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs()
}
void kLowReWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::kLowReWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
os.writeEntry("Ceps2", Ceps2_);
os.writeEntry("Ck", Ck_);
os.writeEntry("Bk", Bk_);
os.writeEntry("C", C_);
fixedValueFvPatchField<scalar>::write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
kLowReWallFunctionFvPatchScalarField
);
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
kLowReWallFunctionFvPatchScalarField
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016, 2019 OpenFOAM Foundation
@ -30,30 +30,37 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulence kinetic energy wall function
condition for low- and high-Reynolds number turbulent flow cases.
This boundary condition provides a wall constraint on turbulent kinetic
energy, i.e. \c k, for low- and high-Reynolds number turbulence models.
The model operates in two modes, based on the computed laminar-to-turbulent
switch-over y+ value derived from kappa and E specified in the corresponding
nutWallFunction.
The model operates in two modes, based on the computed viscous-to-turbulent
switch-over \c y+ value derived from \c kappa and \c E.
Usage
\table
Property | Description | Required | Default value
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
Ceps2 | model coefficient | no | 1.9
Ceps2 | Model coefficient | no | 1.9
Ck | Model coefficient | no | -0.416
Bk | Model coefficient | no | 8.366
C | Model coefficient | no | 11.0
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type kLowReWallFunction;
// Optional entries
}
\endverbatim
Note
The coefficients \c Cmu, \c kappa, and \c E are obtained from
the specified \c nutWallFunction in order to ensure that each patch
possesses the same set of values for these coefficients.
See also
Foam::fixedValueFvPatchField
@ -82,11 +89,20 @@ class kLowReWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Ceps2 coefficient
scalar Ceps2_;
//- Ck coefficient
scalar Ck_;
//- Bk coefficient
scalar Bk_;
//- C coefficient
scalar C_;
public:
@ -156,7 +172,7 @@ public:
}
// Member functions
// Member Functions
// Evaluation functions

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,17 +30,16 @@ Group
grpWallFunctions
Description
This boundary condition provides a suitable condition for turbulence
\c k, \c q, and \c R fields for the case of high Reynolds number flow using
wall functions.
It is a simple wrapper around the zero-gradient condition.
This boundary condition provides a simple wrapper around the zero-gradient
condition, which can be used for \c k, \c q, and \c R fields for
the case of high Reynolds number flow using wall functions.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type kqRWallFunction;
}
\endverbatim
@ -72,7 +71,6 @@ class kqRWallFunctionFvPatchField
:
public zeroGradientFvPatchField<Type>
{
public:
//- Runtime type information
@ -97,8 +95,8 @@ public:
);
//- Construct by mapping given
// kqRWallFunctionFvPatchField
// onto a new patch
//- kqRWallFunctionFvPatchField
//- onto a new patch
kqRWallFunctionFvPatchField
(
const kqRWallFunctionFvPatchField&,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
@ -31,14 +31,11 @@ License
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::calcNut() const
Foam::tmp<Foam::scalarField> Foam::nutLowReWallFunctionFvPatchScalarField::
calcNut() const
{
return tmp<scalarField>::New(patch().size(), Zero);
}
@ -46,7 +43,8 @@ tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::calcNut() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
Foam::nutLowReWallFunctionFvPatchScalarField::
nutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -56,7 +54,8 @@ nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
Foam::nutLowReWallFunctionFvPatchScalarField::
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -68,7 +67,8 @@ nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
Foam::nutLowReWallFunctionFvPatchScalarField::
nutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -79,7 +79,8 @@ nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
Foam::nutLowReWallFunctionFvPatchScalarField::
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf
)
@ -88,7 +89,8 @@ nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
Foam::nutLowReWallFunctionFvPatchScalarField::
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf,
const DimensionedField<scalar, volMesh>& iF
@ -100,7 +102,8 @@ nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::yPlus() const
Foam::tmp<Foam::scalarField> Foam::nutLowReWallFunctionFvPatchScalarField::
yPlus() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
@ -122,14 +125,13 @@ tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::yPlus() const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutLowReWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
nutLowReWallFunctionFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,16 +30,26 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
for use with low Reynolds number models. It sets \c nut to zero, and
provides an access function to calculate y+.
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut for use with low Reynolds number models.
It sets \c nut to zero, and provides an access function to calculate \c y+.
Usage
\table
Property | Description | Required | Default value
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type nutLowReWallFunction;
// Optional entries
}
\endverbatim
@ -101,8 +111,8 @@ public:
);
//- Construct by mapping given
// nutLowReWallFunctionFvPatchScalarField
// onto a new patch
//- nutLowReWallFunctionFvPatchScalarField
//- onto a new patch
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField&,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 201-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -99,11 +99,12 @@ Foam::nutUBlendedWallFunctionFvPatchScalarField::calcUTau
label iter = 0;
while (iter++ < 10 && error > 0.001)
{
scalar yPlus = y[facei]*ut/nuw[facei];
scalar uTauVis = magUp[facei]/yPlus;
scalar uTauLog = kappa_*magUp[facei]/log(E_*yPlus);
const scalar yPlus = y[facei]*ut/nuw[facei];
const scalar uTauVis = magUp[facei]/yPlus;
const scalar uTauLog = kappa_*magUp[facei]/log(E_*yPlus);
scalar utNew = pow(pow(uTauVis, n_) + pow(uTauLog, n_), 1.0/n_);
const scalar utNew =
pow(pow(uTauVis, n_) + pow(uTauLog, n_), 1.0/n_);
error = mag(ut - utNew)/(ut + ROOTVSMALL);
ut = 0.5*(ut + utNew);
}
@ -204,7 +205,10 @@ Foam::nutUBlendedWallFunctionFvPatchScalarField::yPlus() const
}
void Foam::nutUBlendedWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::nutUBlendedWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);

View File

@ -28,9 +28,9 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions, based on a blending of laminar sub-layer and
log region contributions.
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut, when using wall functions based on
a blending of laminar sub-layer and log region contributions.
\f[
u_\tau = (u_{\tau,v}^n + u_{\tau,l}^n)^{1/n}
@ -43,26 +43,34 @@ Description
u_{\tau,l} | friction velocity in the log region
\endvartable
Usage
Example of the boundary condition specification:
\verbatim
myPatch
{
type nutUBlendedWallFunction;
}
\endverbatim
Reference:
See the section that describes 'automatic wall treatment'
\verbatim
Menter, F., Carregal Ferreira, J., Esch, T., Konno, B. (2003).
Menter, F., Ferreira, J. C., Esch, T., Konno, B. (2003).
The SST Turbulence Model with Improved Wall Treatment
for Heat Transfer Predictions in Gas Turbines.
Proceedings of the International Gas Turbine Congress 2003 Tokyo
\endverbatim
Usage
\table
Property | Description | Required | Default value
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type nutUBlendedWallFunction;
// Optional entries
}
\endverbatim
Note
The full 'automatic wall treatment' description also requires use of the
Foam::omegaWallFunction with the \c blended flag set to 'on'
@ -100,7 +108,7 @@ class nutUBlendedWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Model coefficient; default = 4
scalar n_;
@ -139,8 +147,8 @@ public:
);
//- Construct by mapping given
// nutUBlendedWallFunctionFvPatchScalarField
// onto a new patch
//- nutUBlendedWallFunctionFvPatchScalarField
//- onto a new patch
nutUBlendedWallFunctionFvPatchScalarField
(
const nutUBlendedWallFunctionFvPatchScalarField&,
@ -184,7 +192,7 @@ public:
}
// Member functions
// Member Functions
// Evaluation functions

View File

@ -31,14 +31,11 @@ License
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
Foam::tmp<Foam::scalarField>
Foam::nutURoughWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
@ -66,7 +63,7 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
forAll(yPlus, facei)
{
if (yPlus[facei] > yPlusLam_)
if (yPlusLam_ < yPlus[facei])
{
const scalar Re = magUp[facei]*y[facei]/nuw[facei] + ROOTVSMALL;
nutw[facei] = nuw[facei]*(sqr(yPlus[facei])/Re - 1);
@ -77,7 +74,8 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
}
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
Foam::tmp<Foam::scalarField>
Foam::nutURoughWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
@ -99,7 +97,7 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
tmp<scalarField> tyPlus(new scalarField(patch().size(), Zero));
scalarField& yPlus = tyPlus.ref();
if (roughnessHeight_ > 0.0)
if (0.0 < roughnessHeight_)
{
// Rough Walls
const scalar c_1 = 1/(90 - 2.25) + roughnessConstant_;
@ -207,7 +205,7 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
}
void nutURoughWallFunctionFvPatchScalarField::writeLocalEntries
void Foam::nutURoughWallFunctionFvPatchScalarField::writeLocalEntries
(
Ostream& os
) const
@ -223,7 +221,8 @@ void nutURoughWallFunctionFvPatchScalarField::writeLocalEntries
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
Foam::nutURoughWallFunctionFvPatchScalarField::
nutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -238,7 +237,8 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
Foam::nutURoughWallFunctionFvPatchScalarField::
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -255,7 +255,8 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
Foam::nutURoughWallFunctionFvPatchScalarField::
nutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -271,7 +272,8 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
Foam::nutURoughWallFunctionFvPatchScalarField::
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& rwfpsf
)
@ -285,7 +287,8 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
Foam::nutURoughWallFunctionFvPatchScalarField::
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
@ -302,7 +305,8 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const
Foam::tmp<Foam::scalarField>
Foam::nutURoughWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
@ -321,7 +325,10 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const
}
void nutURoughWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::nutURoughWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
@ -331,14 +338,13 @@ void nutURoughWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutURoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
nutURoughWallFunctionFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -30,16 +30,20 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions for rough walls, based on velocity.
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut, when using wall functions for rough walls,
based on velocity, \c U.
Usage
\table
Property | Description | Required | Default value
roughnessHeight | roughness height | yes |
roughnessConstant | roughness constanr | yes |
roughnessFactor | scaling factor | yes |
maxIter | Number of N-R iterations | no | 10
roughnessHeight | Roughness height | yes |
roughnessConstant | Roughness constanr | yes |
roughnessFactor | Scaling factor | yes |
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
maxIter | Number of Newton-Raphson iterations | no | 10
tolerance | Convergence tolerance | no | 0.0001
\endtable
@ -47,10 +51,13 @@ Usage
\verbatim
<patchName>
{
// Mandatory entries
type nutURoughWallFunction;
roughnessHeight 1e-5;
roughnessConstant 0.5;
roughnessFactor 1;
roughnessHeight 1e-5;
roughnessConstant 0.5;
roughnessFactor 1;
// Optional entries
}
\endverbatim
@ -88,7 +95,7 @@ class nutURoughWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
{
// Private data
// Private Data
// Roughness model parameters
@ -145,8 +152,8 @@ public:
);
//- Construct by mapping given
// nutURoughWallFunctionFvPatchScalarField
// onto a new patch
//- nutURoughWallFunctionFvPatchScalarField
//- onto a new patch
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField&,
@ -190,7 +197,7 @@ public:
}
// Member functions
// Member Functions
// Access
@ -226,15 +233,13 @@ public:
}
//- Return reference to the roughness scale factor to allow
// adjustment
//- adjustment
scalar& roughnessFactor()
{
return roughnessFactor_;
}
// I-O
// Evaluation functions
//- Calculate and return the yPlus at the boundary

View File

@ -31,14 +31,11 @@ License
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const
Foam::tmp<Foam::scalarField>
Foam::nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
@ -91,7 +88,8 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const
}
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
Foam::tmp<Foam::scalarField>
Foam::nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
(
const scalarField& magGradU
) const
@ -101,7 +99,8 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
}
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
Foam::tmp<Foam::scalarField>
Foam::nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
(
const scalarField& magGradU,
const label maxIter,
@ -140,7 +139,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
// Note: for exact restart seed with laminar viscosity only:
//scalar ut = sqrt(nuw[facei]*magGradU[facei]);
if (ut > ROOTVSMALL)
if (ROOTVSMALL < ut)
{
int iter = 0;
@ -204,7 +203,7 @@ void Foam::nutUSpaldingWallFunctionFvPatchScalarField::writeLocalEntries
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutUSpaldingWallFunctionFvPatchScalarField::
Foam::nutUSpaldingWallFunctionFvPatchScalarField::
nutUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch& p,
@ -221,7 +220,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
{}
nutUSpaldingWallFunctionFvPatchScalarField::
Foam::nutUSpaldingWallFunctionFvPatchScalarField::
nutUSpaldingWallFunctionFvPatchScalarField
(
const nutUSpaldingWallFunctionFvPatchScalarField& ptf,
@ -240,7 +239,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
{}
nutUSpaldingWallFunctionFvPatchScalarField::
Foam::nutUSpaldingWallFunctionFvPatchScalarField::
nutUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch& p,
@ -258,7 +257,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
{}
nutUSpaldingWallFunctionFvPatchScalarField::
Foam::nutUSpaldingWallFunctionFvPatchScalarField::
nutUSpaldingWallFunctionFvPatchScalarField
(
const nutUSpaldingWallFunctionFvPatchScalarField& wfpsf
@ -274,7 +273,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
{}
nutUSpaldingWallFunctionFvPatchScalarField::
Foam::nutUSpaldingWallFunctionFvPatchScalarField::
nutUSpaldingWallFunctionFvPatchScalarField
(
const nutUSpaldingWallFunctionFvPatchScalarField& wfpsf,
@ -293,7 +292,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
nutUSpaldingWallFunctionFvPatchScalarField::
Foam::nutUSpaldingWallFunctionFvPatchScalarField::
~nutUSpaldingWallFunctionFvPatchScalarField()
{
//if (debug)
@ -314,7 +313,8 @@ nutUSpaldingWallFunctionFvPatchScalarField::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const
Foam::tmp<Foam::scalarField>
Foam::nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
@ -335,7 +335,10 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const
}
void nutUSpaldingWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::nutUSpaldingWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
@ -345,14 +348,14 @@ void nutUSpaldingWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutUSpaldingWallFunctionFvPatchScalarField
);
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
nutUSpaldingWallFunctionFvPatchScalarField
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -30,9 +30,10 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions for rough walls, based on velocity, using
Spalding's law to give a continuous nut profile to the wall (y+ = 0)
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut, when using wall functions for rough walls,
based on velocity, \c U, using Spalding's law to give a continuous \c nut
profile to the wall (y+ = 0)
\f[
y^+ = u^+ + \frac{1}{E} \left[exp(\kappa u^+) - 1 - \kappa u^+\,
@ -46,26 +47,27 @@ Description
\kappa | Von Karman constant
\endvartable
Usage
\table
Property | Description | Required | Default value
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
maxIter | Number of Newton-Raphson iterations | no | 10
tolerance | Convergence tolerance | no | 0.0001
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type nutUSpaldingWallFunction;
// .. nutWallFunctionFvPatchScalarField entries ..
// Optional entries
}
\endverbatim
Additional entries (see below)
\table
Property | Description | Required | Default value
maxIter | Number of N-R iterations | no | 10
tolerance | Convergence tolerance | no | 0.01
\endtable
See also
Foam::nutWallFunctionFvPatchScalarField
@ -111,7 +113,7 @@ class nutUSpaldingWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Max iterations in calcNut
const label maxIter_;
@ -135,7 +137,7 @@ protected:
virtual tmp<scalarField> calcUTau(const scalarField& magGradU) const;
//- Calculate the friction velocity and number of iterations for
// convergence
//- convergence
virtual tmp<scalarField> calcUTau
(
const scalarField& magGradU,
@ -171,8 +173,8 @@ public:
);
//- Construct by mapping given
// nutUSpaldingWallFunctionFvPatchScalarField
// onto a new patch
//- nutUSpaldingWallFunctionFvPatchScalarField
//- onto a new patch
nutUSpaldingWallFunctionFvPatchScalarField
(
const nutUSpaldingWallFunctionFvPatchScalarField&,
@ -220,7 +222,7 @@ public:
virtual ~nutUSpaldingWallFunctionFvPatchScalarField();
// Member functions
// Member Functions
// Evaluation functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
@ -31,14 +31,11 @@ License
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const
Foam::tmp<Foam::scalarField>
Foam::nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
@ -68,7 +65,8 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const
}
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcUPlus
Foam::tmp<Foam::scalarField>
Foam::nutUTabulatedWallFunctionFvPatchScalarField::calcUPlus
(
const scalarField& Rey
) const
@ -87,7 +85,7 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcUPlus
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutUTabulatedWallFunctionFvPatchScalarField::
Foam::nutUTabulatedWallFunctionFvPatchScalarField::
nutUTabulatedWallFunctionFvPatchScalarField
(
const fvPatch& p,
@ -112,7 +110,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
{}
nutUTabulatedWallFunctionFvPatchScalarField::
Foam::nutUTabulatedWallFunctionFvPatchScalarField::
nutUTabulatedWallFunctionFvPatchScalarField
(
const nutUTabulatedWallFunctionFvPatchScalarField& ptf,
@ -127,7 +125,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
{}
nutUTabulatedWallFunctionFvPatchScalarField::
Foam::nutUTabulatedWallFunctionFvPatchScalarField::
nutUTabulatedWallFunctionFvPatchScalarField
(
const fvPatch& p,
@ -153,7 +151,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
{}
nutUTabulatedWallFunctionFvPatchScalarField::
Foam::nutUTabulatedWallFunctionFvPatchScalarField::
nutUTabulatedWallFunctionFvPatchScalarField
(
const nutUTabulatedWallFunctionFvPatchScalarField& wfpsf
@ -165,7 +163,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
{}
nutUTabulatedWallFunctionFvPatchScalarField::
Foam::nutUTabulatedWallFunctionFvPatchScalarField::
nutUTabulatedWallFunctionFvPatchScalarField
(
const nutUTabulatedWallFunctionFvPatchScalarField& wfpsf,
@ -180,7 +178,8 @@ nutUTabulatedWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const
Foam::tmp<Foam::scalarField>
Foam::nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
@ -203,7 +202,10 @@ tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const
}
void nutUTabulatedWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::nutUTabulatedWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
os.writeEntry("uPlusTable", uPlusTableName_);
@ -213,14 +215,14 @@ void nutUTabulatedWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutUTabulatedWallFunctionFvPatchScalarField
);
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
nutUTabulatedWallFunctionFvPatchScalarField
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
@ -30,23 +30,33 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions. As input, the user specifies a look-up table
of U+ as a function of near-wall Reynolds number. The table should be
located in the $FOAM_CASE/constant directory.
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut, when using wall functions, based on
velocity, i.e. \c U.
As input, the user specifies a look-up table of \c U+ as a function of
near-wall Reynolds number.
The table should be located in the $FOAM_CASE/constant directory.
Usage
\table
Property | Description | Required | Default value
uPlusTable | U+ as a function of Re table name | yes |
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type nutTabulatedWallFunction;
uPlusTable myUPlusTable;
// Optional entries
}
\endverbatim
@ -83,12 +93,12 @@ class nutUTabulatedWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Name of u+ table
word uPlusTableName_;
//- U+ table
//- u+ table
uniformInterpolationTable<scalar> uPlusTable_;
@ -125,8 +135,8 @@ public:
);
//- Construct by mapping given
// nutUTabulatedWallFunctionFvPatchScalarField
// onto a new patch
//- nutUTabulatedWallFunctionFvPatchScalarField
//- onto a new patch
nutUTabulatedWallFunctionFvPatchScalarField
(
const nutUTabulatedWallFunctionFvPatchScalarField&,
@ -170,7 +180,7 @@ public:
}
// Member functions
// Member Functions
// Evaluation functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
@ -31,14 +31,11 @@ License
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
Foam::tmp<Foam::scalarField>
Foam::nutUWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
@ -63,7 +60,7 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
forAll(yPlus, facei)
{
if (yPlus[facei] > yPlusLam_)
if (yPlusLam_ < yPlus[facei])
{
nutw[facei] =
nuw[facei]*(yPlus[facei]*kappa_/log(E_*yPlus[facei]) - 1.0);
@ -74,7 +71,8 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
}
tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
Foam::tmp<Foam::scalarField>
Foam::nutUWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
@ -98,10 +96,10 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
forAll(yPlus, facei)
{
scalar kappaRe = kappa_*magUp[facei]*y[facei]/nuw[facei];
const scalar kappaRe = kappa_*magUp[facei]*y[facei]/nuw[facei];
scalar yp = yPlusLam_;
scalar ryPlusLam = 1.0/yp;
const scalar ryPlusLam = 1.0/yp;
int iter = 0;
scalar yPlusLast = 0.0;
@ -122,7 +120,7 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
Foam::nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -132,7 +130,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
Foam::nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -144,7 +142,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
Foam::nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -155,7 +153,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
Foam::nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField& sawfpsf
)
@ -164,7 +162,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
{}
nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
Foam::nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField& sawfpsf,
const DimensionedField<scalar, volMesh>& iF
@ -176,7 +174,8 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const
Foam::tmp<Foam::scalarField>
Foam::nutUWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
@ -194,7 +193,10 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const
}
void nutUWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::nutUWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
@ -204,14 +206,14 @@ void nutUWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutUWallFunctionFvPatchScalarField
);
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
nutUWallFunctionFvPatchScalarField
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -30,15 +30,26 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions, based on velocity.
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut, when using wall functions, based on
velocity, \c U.
Usage
\table
Property | Description | Required | Default value
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type nutUWallFunction;
// Optional entries
}
\endverbatim
@ -108,8 +119,8 @@ public:
);
//- Construct by mapping given
// nutUWallFunctionFvPatchScalarField
// onto a new patch
//- nutUWallFunctionFvPatchScalarField
//- onto a new patch
nutUWallFunctionFvPatchScalarField
(
const nutUWallFunctionFvPatchScalarField&,
@ -153,7 +164,7 @@ public:
}
// Member functions
// Member Functions
// Evaluation functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
@ -133,10 +133,10 @@ Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", word::null)),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
UName_(dict.getOrDefault<word>("U", word::null)),
Cmu_(dict.getOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.getOrDefault<scalar>("kappa", 0.41)),
E_(dict.getOrDefault<scalar>("E", 9.8)),
yPlusLam_(yPlusLam(kappa_, E_))
{
checkType();
@ -201,7 +201,7 @@ Foam::scalar Foam::nutWallFunctionFvPatchScalarField::yPlusLam
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
for (int i = 0; i < 10; ++i)
{
ypl = log(max(E*ypl, 1))/kappa;
}
@ -229,7 +229,10 @@ void Foam::nutWallFunctionFvPatchScalarField::updateCoeffs()
}
void Foam::nutWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::nutWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
@ -30,9 +30,19 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions, based on turbulence kinetic energy.
- replicates OpenFOAM v1.5 (and earlier) behaviour
The class \c nutWallFunction is a base class that parents the derived
boundary conditions which provide a wall constraint on various fields, such
as turbulence kinematic viscosity, i.e. \c nut, for low- and high-Reynolds
number turbulence models.
Reference:
\verbatim
Default model coefficients:
Versteeg, H. K., & Malalasekera, W. (2011).
An introduction to computational fluid dynamics: the finite
volume method. Harlow: Pearson Education.
Subsection "3.5.2 k-epsilon model".
\endverbatim
Usage
\table
@ -46,16 +56,11 @@ Usage
\verbatim
<patchName>
{
// Mandatory entries
type nutWallFunction;
value uniform 0.0;
}
\endverbatim
Reference for the default model coefficients:
\verbatim
H. Versteeg, W. Malalasekera
An Introduction to Computational Fluid Dynamics: The Finite Volume
Method, subsection "3.5.2 k-epsilon model"
// Optional entries
}
\endverbatim
See also
@ -88,7 +93,7 @@ class nutWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Name of velocity field
// Defult is null (not specified) in which case the velocity is
@ -104,7 +109,7 @@ protected:
//- E coefficient
scalar E_;
//- Y+ at the edge of the laminar sublayer
//- Estimated y+ value at the edge of the viscous sublayer
scalar yPlusLam_;
@ -148,8 +153,8 @@ public:
);
//- Construct by mapping given
// nutWallFunctionFvPatchScalarField
// onto a new patch
//- nutWallFunctionFvPatchScalarField
//- onto a new patch
nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField&,
@ -199,10 +204,10 @@ public:
const label patchi
);
//- Calculate the Y+ at the edge of the laminar sublayer
//- Calculate the y+ at the edge of the viscous sublayer
static scalar yPlusLam(const scalar kappa, const scalar E);
//- Return the Y+ at the edge of the laminar sublayer
//- Return the y+ at the edge of the viscous sublayer
scalar yPlusLam() const;
//- Calculate and return the yPlus at the boundary

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,14 +31,10 @@ License
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
scalar nutkRoughWallFunctionFvPatchScalarField::fnRough
Foam::scalar Foam::nutkRoughWallFunctionFvPatchScalarField::fnRough
(
const scalar KsPlus,
const scalar Cs
@ -61,7 +57,8 @@ scalar nutkRoughWallFunctionFvPatchScalarField::fnRough
}
tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
Foam::tmp<Foam::scalarField> Foam::nutkRoughWallFunctionFvPatchScalarField::
calcNut() const
{
const label patchi = patch().index();
@ -86,19 +83,19 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
forAll(nutw, facei)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
scalar uStar = Cmu25*sqrt(k[celli]);
scalar yPlus = uStar*y[facei]/nuw[facei];
scalar KsPlus = uStar*Ks_[facei]/nuw[facei];
const scalar uStar = Cmu25*sqrt(k[celli]);
const scalar yPlus = uStar*y[facei]/nuw[facei];
const scalar KsPlus = uStar*Ks_[facei]/nuw[facei];
scalar Edash = E_;
if (KsPlus > 2.25)
if (2.25 < KsPlus)
{
Edash /= fnRough(KsPlus, Cs_[facei]);
}
scalar limitingNutw = max(nutw[facei], nuw[facei]);
const scalar limitingNutw = max(nutw[facei], nuw[facei]);
// To avoid oscillations limit the change in the wall viscosity
// which is particularly important if it temporarily becomes zero
@ -129,7 +126,8 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
Foam::nutkRoughWallFunctionFvPatchScalarField::
nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -141,7 +139,8 @@ nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
Foam::nutkRoughWallFunctionFvPatchScalarField::
nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -155,7 +154,8 @@ nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
Foam::nutkRoughWallFunctionFvPatchScalarField::
nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -168,7 +168,8 @@ nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
Foam::nutkRoughWallFunctionFvPatchScalarField::
nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf
)
@ -179,7 +180,8 @@ nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
Foam::nutkRoughWallFunctionFvPatchScalarField::
nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
@ -193,7 +195,7 @@ nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutkRoughWallFunctionFvPatchScalarField::autoMap
void Foam::nutkRoughWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
@ -204,7 +206,7 @@ void nutkRoughWallFunctionFvPatchScalarField::autoMap
}
void nutkRoughWallFunctionFvPatchScalarField::rmap
void Foam::nutkRoughWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
@ -220,7 +222,10 @@ void nutkRoughWallFunctionFvPatchScalarField::rmap
}
void nutkRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::nutkRoughWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
@ -232,14 +237,13 @@ void nutkRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutkRoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
nutkRoughWallFunctionFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,10 +30,10 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions for rough walls, based on turbulence kinetic
energy. The condition manipulates the E parameter to account for roughness
effects.
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut, when using wall functions for rough walls,
based on turbulent kinetic energy, \c k. The condition manipulates the \c E
parameter to account for roughness effects.
Parameter ranges
- roughness height = sand-grain roughness (0 for smooth walls)
@ -41,18 +41,24 @@ Description
Usage
\table
Property | Description | Required | Default value
Ks | sand-grain roughness height | yes |
Cs | roughness constant | yes |
Property | Description | Required | Default value
Ks | Sand-grain roughness height | yes |
Cs | Roughness constant | yes |
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type nutkRoughWallFunction;
Ks uniform 0;
Cs uniform 0.5;
// Optional entries
}
\endverbatim
@ -84,7 +90,7 @@ class nutkRoughWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Roughness height
scalarField Ks_;
@ -126,8 +132,8 @@ public:
);
//- Construct by mapping given
// nutkRoughWallFunctionFvPatchScalarField
// onto a new patch
//- nutkRoughWallFunctionFvPatchScalarField
//- onto a new patch
nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField&,

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,14 +32,11 @@ License
#include "wallFvPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
Foam::tmp<Foam::scalarField> Foam::nutkWallFunctionFvPatchScalarField::
calcNut() const
{
const label patchi = patch().index();
@ -65,11 +62,11 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
forAll(nutw, facei)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
scalar yPlus = Cmu25*y[facei]*sqrt(k[celli])/nuw[facei];
const scalar yPlus = Cmu25*y[facei]*sqrt(k[celli])/nuw[facei];
if (yPlus > yPlusLam_)
if (yPlusLam_ < yPlus)
{
nutw[facei] = nuw[facei]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
}
@ -81,7 +78,7 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
Foam::nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -91,7 +88,7 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
Foam::nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -103,7 +100,7 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
Foam::nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -114,7 +111,7 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
Foam::nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField& wfpsf
)
@ -123,7 +120,7 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
Foam::nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
@ -135,7 +132,8 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
Foam::tmp<Foam::scalarField> Foam::nutkWallFunctionFvPatchScalarField::
yPlus() const
{
const label patchi = patch().index();
@ -161,14 +159,14 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutkWallFunctionFvPatchScalarField
);
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
nutkWallFunctionFvPatchScalarField
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,16 +30,26 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions, based on turbulence kinetic energy.
- replicates OpenFOAM v1.5 (and earlier) behaviour
This boundary condition provides a wall constraint on the turbulent
kinematic viscosity, i.e. \c nut, when using wall functions,
based on turbulent kinetic energy, \c k.
Usage
\table
Property | Description | Required | Default value
Cmu | Model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type nutkWallFunction;
// Optional entries
}
\endverbatim
@ -101,8 +111,8 @@ public:
);
//- Construct by mapping given
// nutkWallFunctionFvPatchScalarField
// onto a new patch
//- nutkWallFunctionFvPatchScalarField
//- onto a new patch
nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField&,

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,18 +31,14 @@ License
#include "fvMatrix.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
scalar omegaWallFunctionFvPatchScalarField::tolerance_ = 1e-5;
Foam::scalar Foam::omegaWallFunctionFvPatchScalarField::tolerance_ = 1e-5;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void omegaWallFunctionFvPatchScalarField::setMaster()
void Foam::omegaWallFunctionFvPatchScalarField::setMaster()
{
if (master_ != -1)
{
@ -72,7 +68,7 @@ void omegaWallFunctionFvPatchScalarField::setMaster()
}
void omegaWallFunctionFvPatchScalarField::createAveragingWeights()
void Foam::omegaWallFunctionFvPatchScalarField::createAveragingWeights()
{
const volScalarField& omega =
static_cast<const volScalarField&>(this->internalField());
@ -111,7 +107,7 @@ void omegaWallFunctionFvPatchScalarField::createAveragingWeights()
const labelUList& faceCells = bf[patchi].patch().faceCells();
forAll(faceCells, i)
{
label celli = faceCells[i];
const label celli = faceCells[i];
weights[celli]++;
}
}
@ -120,7 +116,7 @@ void omegaWallFunctionFvPatchScalarField::createAveragingWeights()
cornerWeights_.setSize(bf.size());
forAll(omegaPatches, i)
{
label patchi = omegaPatches[i];
const label patchi = omegaPatches[i];
const fvPatchScalarField& wf = weights.boundaryField()[patchi];
cornerWeights_[patchi] = 1.0/wf.patchInternalField();
}
@ -132,8 +128,11 @@ void omegaWallFunctionFvPatchScalarField::createAveragingWeights()
}
omegaWallFunctionFvPatchScalarField&
omegaWallFunctionFvPatchScalarField::omegaPatch(const label patchi)
Foam::omegaWallFunctionFvPatchScalarField&
Foam::omegaWallFunctionFvPatchScalarField::omegaPatch
(
const label patchi
)
{
const volScalarField& omega =
static_cast<const volScalarField&>(this->internalField());
@ -147,7 +146,7 @@ omegaWallFunctionFvPatchScalarField::omegaPatch(const label patchi)
}
void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields
void Foam::omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields
(
const turbulenceModel& turbModel,
scalarField& G0,
@ -180,7 +179,7 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields
}
void omegaWallFunctionFvPatchScalarField::calculate
void Foam::omegaWallFunctionFvPatchScalarField::calculate
(
const turbulenceModel& turbModel,
const List<scalar>& cornerWeights,
@ -196,18 +195,18 @@ void omegaWallFunctionFvPatchScalarField::calculate
const scalarField& y = turbModel.y()[patchi];
const scalar Cmu25 = pow025(nutw.Cmu());
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magGradUw(mag(Uw.snGrad()));
const scalar Cmu25 = pow025(nutw.Cmu());
// Set omega and G
forAll(nutw, facei)
{
@ -237,7 +236,7 @@ void omegaWallFunctionFvPatchScalarField::calculate
}
else
{
if (yPlus > nutw.yPlusLam())
if (nutw.yPlusLam() < yPlus)
{
omega0[celli] += w*omegaLog;
}
@ -263,24 +262,24 @@ void omegaWallFunctionFvPatchScalarField::calculate
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(p, iF),
beta1_(0.075),
blended_(true),
G_(),
omega_(),
initialised_(false),
master_(-1),
beta1_(0.075),
G_(),
omega_(),
cornerWeights_()
{}
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
(
const omegaWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
@ -289,17 +288,17 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
beta1_(ptf.beta1_),
blended_(ptf.blended_),
G_(),
omega_(),
initialised_(false),
master_(-1),
beta1_(ptf.beta1_),
G_(),
omega_(),
cornerWeights_()
{}
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -307,12 +306,12 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchField<scalar>(p, iF, dict),
beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)),
blended_(dict.lookupOrDefault<Switch>("blended", true)),
G_(),
omega_(),
blended_(dict.getOrDefault<bool>("blended", true)),
initialised_(false),
master_(-1),
beta1_(dict.getOrDefault<scalar>("beta1", 0.075)),
G_(),
omega_(),
cornerWeights_()
{
// apply zero-gradient condition on start-up
@ -320,42 +319,45 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
}
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
(
const omegaWallFunctionFvPatchScalarField& owfpsf
)
:
fixedValueFvPatchField<scalar>(owfpsf),
beta1_(owfpsf.beta1_),
blended_(owfpsf.blended_),
G_(),
omega_(),
initialised_(false),
master_(-1),
beta1_(owfpsf.beta1_),
G_(),
omega_(),
cornerWeights_()
{}
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
(
const omegaWallFunctionFvPatchScalarField& owfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(owfpsf, iF),
beta1_(owfpsf.beta1_),
blended_(owfpsf.blended_),
G_(),
omega_(),
initialised_(false),
master_(-1),
beta1_(owfpsf.beta1_),
G_(),
omega_(),
cornerWeights_()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalarField& omegaWallFunctionFvPatchScalarField::G(bool init)
Foam::scalarField& Foam::omegaWallFunctionFvPatchScalarField::G
(
bool init
)
{
if (patch().index() == master_)
{
@ -371,7 +373,10 @@ scalarField& omegaWallFunctionFvPatchScalarField::G(bool init)
}
scalarField& omegaWallFunctionFvPatchScalarField::omega(bool init)
Foam::scalarField& Foam::omegaWallFunctionFvPatchScalarField::omega
(
bool init
)
{
if (patch().index() == master_)
{
@ -387,7 +392,7 @@ scalarField& omegaWallFunctionFvPatchScalarField::omega(bool init)
}
void omegaWallFunctionFvPatchScalarField::updateCoeffs()
void Foam::omegaWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -422,7 +427,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
forAll(*this, facei)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
G[celli] = G0[celli];
omega[celli] = omega0[celli];
@ -432,7 +437,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
}
void omegaWallFunctionFvPatchScalarField::updateWeightedCoeffs
void Foam::omegaWallFunctionFvPatchScalarField::updateWeightedCoeffs
(
const scalarField& weights
)
@ -473,11 +478,11 @@ void omegaWallFunctionFvPatchScalarField::updateWeightedCoeffs
// only set the values if the weights are > tolerance
forAll(weights, facei)
{
scalar w = weights[facei];
const scalar w = weights[facei];
if (w > tolerance_)
if (tolerance_ < w)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
G[celli] = (1.0 - w)*G[celli] + w*G0[celli];
omega[celli] = (1.0 - w)*omega[celli] + w*omega0[celli];
@ -489,7 +494,7 @@ void omegaWallFunctionFvPatchScalarField::updateWeightedCoeffs
}
void omegaWallFunctionFvPatchScalarField::manipulateMatrix
void Foam::omegaWallFunctionFvPatchScalarField::manipulateMatrix
(
fvMatrix<scalar>& matrix
)
@ -505,7 +510,7 @@ void omegaWallFunctionFvPatchScalarField::manipulateMatrix
}
void omegaWallFunctionFvPatchScalarField::manipulateMatrix
void Foam::omegaWallFunctionFvPatchScalarField::manipulateMatrix
(
fvMatrix<scalar>& matrix,
const Field<scalar>& weights
@ -525,7 +530,7 @@ void omegaWallFunctionFvPatchScalarField::manipulateMatrix
forAll(weights, facei)
{
// only set the values if the weights are > tolerance
if (weights[facei] > tolerance_)
if (tolerance_ < weights[facei])
{
const label celli = faceCells[facei];
@ -548,24 +553,27 @@ void omegaWallFunctionFvPatchScalarField::manipulateMatrix
}
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
void Foam::omegaWallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
os.writeEntry("beta1", beta1_);
os.writeEntry("blended", blended_);
os.writeEntry("beta1", beta1_);
fixedValueFvPatchField<scalar>::write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
omegaWallFunctionFvPatchScalarField
);
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
omegaWallFunctionFvPatchScalarField
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,10 +2,10 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016, 2019 OpenFOAM Foundation
| Copyright (C) 2011-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,8 +30,9 @@ Group
grpWallFunctions
Description
This boundary condition provides a wall constraint on turbulence specific
dissipation, omega for both low and high Reynolds number turbulence models.
This boundary condition provides a wall constraint on specific turbulent
kinetic energy dissipation rate, i.e. \c omega, for low- and high-Reynolds
number turbulence models.
The near-wall omega may be either blended between the viscous region and
logarithmic region values using:
@ -55,20 +56,12 @@ Description
Nov. 2001
\endverbatim
or switched between these values based on the laminar-to-turbulent y+ value
derived from kappa and E specified in the corresponding nutWallFunction.
Recent tests have shown that the standard switching method provides more
accurate results for 10 < y+ < 30 when used with high Reynolds number
wall-functions and both methods provide accurate results when used with
continuous wall-functions. Based on this the standard switching method is
used by default.
or switched between these values based on the viscous-to-turbulent \c y+
value derived from \c kappa and \c E.
Usage
\table
Property | Description | Required | Default value
Cmu | Model coefficient | no | 0.09
kappa | von Karman constant | no | 0.41
E | Model coefficient | no | 9.8
beta1 | Model coefficient | no | 0.075
blended | Blending switch | no | false
\endtable
@ -77,10 +70,25 @@ Usage
\verbatim
<patchName>
{
// Mandatory entries
type omegaWallFunction;
// Optional entries
}
\endverbatim
Note
The coefficients \c Cmu, \c kappa, and \c E are obtained from
the specified \c nutWallFunction in order to ensure that each patch
possesses the same set of values for these coefficients.
Some tests have shown that the stepwise switching method provides
more accurate predictions for 10 < y+ < 30 when used with high Reynolds
number wall-functions.
In addition, the stepwise switching method provides accurate predictions
when used with continuous wall-functions.
See also
Foam::fixedInternalValueFvPatchField
Foam::epsilonWallFunctionFvPatchScalarField
@ -112,22 +120,13 @@ class omegaWallFunctionFvPatchScalarField
{
protected:
// Protected data
// Protected Data
//- Tolerance used in weighted calculations
static scalar tolerance_;
//- beta1 coefficient
scalar beta1_;
//- beta1 coefficient
Switch blended_;
//- Local copy of turbulence G field
scalarField G_;
//- Local copy of turbulence omega field
scalarField omega_;
//- Blending switch
bool blended_;
//- Initialised flag
bool initialised_;
@ -135,6 +134,15 @@ protected:
//- Master patch ID
label master_;
//- beta1 coefficient
scalar beta1_;
//- Local copy of turbulence G field
scalarField G_;
//- Local copy of turbulence omega field
scalarField omega_;
//- List of averaging corner weights
List<List<scalar>> cornerWeights_;
@ -142,11 +150,11 @@ protected:
// Protected Member Functions
//- Set the master patch - master is responsible for updating all
// wall function patches
//- wall function patches
virtual void setMaster();
//- Create the averaging weights for cells which are bounded by
// multiple wall function faces
//- multiple wall function faces
virtual void createAveragingWeights();
//- Helper function to return non-const access to an omega patch
@ -204,8 +212,8 @@ public:
);
//- Construct by mapping given
// omegaWallFunctionFvPatchScalarField
// onto a new patch
//- omegaWallFunctionFvPatchScalarField
//- onto a new patch
omegaWallFunctionFvPatchScalarField
(
const omegaWallFunctionFvPatchScalarField&,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016, 2019 OpenFOAM Foundation
@ -45,7 +45,9 @@ v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(p, iF)
fixedValueFvPatchField<scalar>(p, iF),
Cv2_(0.193),
Bv2_(-0.94)
{}
@ -57,7 +59,9 @@ v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper)
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
Cv2_(ptf.Cv2_),
Bv2_(ptf.Bv2_)
{}
@ -68,7 +72,9 @@ v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchField<scalar>(p, iF, dict)
fixedValueFvPatchField<scalar>(p, iF, dict),
Cv2_(dict.getOrDefault<scalar>("Cv2", 0.193)),
Bv2_(dict.getOrDefault<scalar>("Bv2", -0.94))
{}
@ -77,7 +83,9 @@ v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
const v2WallFunctionFvPatchScalarField& v2wfpsf
)
:
fixedValueFvPatchField<scalar>(v2wfpsf)
fixedValueFvPatchField<scalar>(v2wfpsf),
Cv2_(v2wfpsf.Cv2_),
Bv2_(v2wfpsf.Bv2_)
{}
@ -87,7 +95,9 @@ v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(v2wfpsf, iF)
fixedValueFvPatchField<scalar>(v2wfpsf, iF),
Cv2_(v2wfpsf.Cv2_),
Bv2_(v2wfpsf.Bv2_)
{}
@ -116,12 +126,12 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs()
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const tmp<scalarField> tnuw = turbModel.nu(patchi);
const scalarField& nuw = tnuw();
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalar Cmu25 = pow025(nutw.Cmu());
scalarField& v2 = *this;
@ -129,22 +139,19 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs()
// Set v2 wall values
forAll(v2, facei)
{
label celli = patch().faceCells()[facei];
const label celli = patch().faceCells()[facei];
scalar uTau = Cmu25*sqrt(k[celli]);
const scalar uTau = Cmu25*sqrt(k[celli]);
scalar yPlus = uTau*y[facei]/nuw[facei];
const scalar yPlus = uTau*y[facei]/nuw[facei];
if (yPlus > nutw.yPlusLam())
if (nutw.yPlusLam() < yPlus)
{
scalar Cv2 = 0.193;
scalar Bv2 = -0.94;
v2[facei] = Cv2/nutw.kappa()*log(yPlus) + Bv2;
v2[facei] = Cv2_/nutw.kappa()*log(yPlus) + Bv2_;
}
else
{
scalar Cv2 = 0.193;
v2[facei] = Cv2*pow4(yPlus);
v2[facei] = Cv2_*pow4(yPlus);
}
v2[facei] *= sqr(uTau);
@ -156,6 +163,17 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs()
}
void v2WallFunctionFvPatchScalarField::write
(
Ostream& os
) const
{
os.writeEntry("Cv2", Cv2_);
os.writeEntry("Bv2", Bv2_);
fixedValueFvPatchField<scalar>::write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2012-2016, 2019 OpenFOAM Foundation
@ -30,31 +30,35 @@ Group
grpWallFunctions
Description
This boundary condition provides a turbulence stress normal to streamlines
wall function condition for low- and high-Reynolds number, turbulent flow
cases.
The model operates in two modes, based on the computed laminar-to-turbulent
switch-over y+ value derived from kappa and E specified in the corresponding
nutWallFunction.
This boundary condition provides a wall constraint on wall-normal velocity
scale, i.e. \c v2, for low- and high-Reynolds number turbulence models.
The model operates in two modes, based on the computed viscous-to-turbulent
switch-over \c y+ value derived from \c kappa and \c E.
Usage
\table
Property | Description | Required | Default value
Cmu | model coefficient | no | 0.09
kappa | Von Karman constant | no | 0.41
E | model coefficient | no | 9.8
Cv2 | model coefficient | no | 0.193
Bv2 | model coefficient | no | -0.94
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
// Mandatory entries
type v2WallFunction;
// Optional entries
}
\endverbatim
Note
The coefficients \c Cmu, \c kappa, and \c E are obtained from
the specified \c nutWallFunction in order to ensure that each patch
possesses the same set of values for these coefficients.
See also
Foam::fixedValueFvPatchField
@ -83,6 +87,16 @@ class v2WallFunctionFvPatchScalarField
:
public fixedValueFvPatchField<scalar>
{
protected:
// Protected Data
//- Cv2 coefficient
scalar Cv2_;
//- Bv2 coefficient
scalar Bv2_;
public:
@ -108,7 +122,7 @@ public:
);
//- Construct by mapping given v2WallFunctionFvPatchScalarField
// onto a new patch
//- onto a new patch
v2WallFunctionFvPatchScalarField
(
const v2WallFunctionFvPatchScalarField&,
@ -158,6 +172,12 @@ public:
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};