Commit 4e492805 authored by Henry's avatar Henry
Browse files

atmBoundaryLayer: rationalized U and epsilon BCs and added the corresponding k BC

parent ded2f257
......@@ -58,6 +58,7 @@ $(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C
/* Patch fields */
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C
derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C
......
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
......
......@@ -46,95 +46,48 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
z_(vector::zero),
kappa_(0.41),
Uref_(0),
Zref_(0),
z0_(0),
zGround_(0),
Ustar_(0)
atmBoundaryLayer()
{}
atmBoundaryLayerInletEpsilonFvPatchScalarField::
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const atmBoundaryLayerInletEpsilonFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
const dictionary& dict
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
z_(ptf.z_),
kappa_(ptf.kappa_),
Uref_(ptf.Uref_),
Zref_(ptf.Zref_),
z0_(ptf.z0_, mapper),
zGround_(ptf.zGround_, mapper),
Ustar_(ptf.Ustar_, mapper)
{}
fixedValueFvPatchScalarField(p, iF),
atmBoundaryLayer(patch().Cf(), dict)
{
scalarField::operator=(epsilon(patch().Cf()));
}
atmBoundaryLayerInletEpsilonFvPatchScalarField::
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const atmBoundaryLayerInletEpsilonFvPatchScalarField& psf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(p, iF),
z_(dict.lookup("z")),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Uref_(readScalar(dict.lookup("Uref"))),
Zref_(readScalar(dict.lookup("Zref"))),
z0_("z0", dict, p.size()),
zGround_("zGround", dict, p.size()),
Ustar_(p.size())
{
if (mag(z_) < SMALL)
{
FatalErrorIn
(
"atmBoundaryLayerInletEpsilonFvPatchScalarField"
"("
"const fvPatch&, "
"const DimensionedField<scalar, volMesh>&, "
"const dictionary&"
")"
)
<< "magnitude of z vector must be greater than zero"
<< abort(FatalError);
}
// Ensure direction vectors are normalized
z_ /= mag(z_);
Ustar_ = kappa_*Uref_/(log((Zref_ + z0_)/max(z0_, 0.001)));
scalarField::operator=
(
pow3(Ustar_)/(kappa_*((z_ & patch().Cf()) - zGround_ + z0_))
);
}
fixedValueFvPatchScalarField(psf, p, iF, mapper),
atmBoundaryLayer(psf, mapper)
{}
atmBoundaryLayerInletEpsilonFvPatchScalarField::
atmBoundaryLayerInletEpsilonFvPatchScalarField
(
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf,
const atmBoundaryLayerInletEpsilonFvPatchScalarField& psf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(blpsf, iF),
z_(blpsf.z_),
kappa_(blpsf.kappa_),
Uref_(blpsf.Uref_),
Zref_(blpsf.Zref_),
z0_(blpsf.z0_),
zGround_(blpsf.zGround_),
Ustar_(blpsf.Ustar_)
fixedValueFvPatchScalarField(psf, iF),
atmBoundaryLayer(psf)
{}
......@@ -146,42 +99,29 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::autoMap
)
{
fixedValueFvPatchScalarField::autoMap(m);
z0_.autoMap(m);
zGround_.autoMap(m);
Ustar_.autoMap(m);
atmBoundaryLayer::autoMap(m);
}
void atmBoundaryLayerInletEpsilonFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const fvPatchScalarField& psf,
const labelList& addr
)
{
fixedValueFvPatchScalarField::rmap(ptf, addr);
fixedValueFvPatchScalarField::rmap(psf, addr);
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blptf =
refCast<const atmBoundaryLayerInletEpsilonFvPatchScalarField>(ptf);
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf =
refCast<const atmBoundaryLayerInletEpsilonFvPatchScalarField>(psf);
z0_.rmap(blptf.z0_, addr);
zGround_.rmap(blptf.zGround_, addr);
Ustar_.rmap(blptf.Ustar_, addr);
atmBoundaryLayer::rmap(blpsf, addr);
}
void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("z")
<< z_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa")
<< kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Uref")
<< Uref_ << token::END_STATEMENT << nl;
os.writeKeyword("Zref")
<< Zref_ << token::END_STATEMENT << nl;
z0_.writeEntry("z0", os);
zGround_.writeEntry("zGround", os);
atmBoundaryLayer::write(os);
writeEntry("value", os);
}
......
......@@ -29,46 +29,9 @@ Group
Description
This boundary condition specifies an inlet value for the turbulence
dissipation, \f$\epsilon\f$, appropriate for atmospheric boundary layers
(ABL), and designed to be used in conjunction with the
atmBoundaryLayerInletVelocity inlet velocity boundary condition.
\f[
\epsilon = \frac{(U^*)^3}{\kappa(z - z_g + z_0)}
\f]
where
\vartable
U^* | Friction velocity
\kappa | von Karman's constant
z | Vertical coordinate
z_0 | Surface roughness height [m]
z_g | Minimum z-coordinate [m]
\endvartable
and:
\f[
U^* = \kappa\frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)}
\f]
where:
\vartable
U_{ref} | Reference velocity at \f$Z_{ref}\f$ [m/s]
Z_{ref} | Reference height [m]
\endvartable
\heading Patch usage
\table
Property | Description | Required | Default value
z | Vertical direction | yes |
kappa | von Karman's constant | no | 0.41
Uref | Reference velocity [m/s] | yes |
Zref | Reference height [m] | yes |
z0 | Surface roughness height [m] | yes |
zGround | Minimum z coordinate [m] | yes |
\endtable
dissipation, \f$\epsilon\f$, appropriate for atmospheric boundary layers.
See Foam::incompressible::atmBoundaryLayer for details.
Example of the boundary condition specification:
\verbatim
......@@ -83,11 +46,10 @@ Description
}
\endverbatim
Reference:
D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model
in commercial CFD software to model the neutral atmospheric boundary
layer", Journal of Wind Engineering and Industrial Aerodynamics
95(2007), pp 355-369.
SeeAlso
Foam::incompressible::atmBoundaryLayer,
Foam::incompressible::atmBoundaryLayerInletVelocityFvPatchVectorField,
Foam::incompressible::atmBoundaryLayerInletKFvPatchScalarField
SourceFiles
atmBoundaryLayerInletEpsilonFvPatchScalarField.C
......@@ -99,6 +61,7 @@ SourceFiles
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H"
#include "atmBoundaryLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -113,31 +76,9 @@ namespace incompressible
class atmBoundaryLayerInletEpsilonFvPatchScalarField
:
public fixedValueFvPatchScalarField
public fixedValueFvPatchScalarField,
public atmBoundaryLayer
{
// Private data
//- Direction of the z-coordinate
vector z_;
//- von Karman constant
const scalar kappa_;
//- Reference velocity
const scalar Uref_;
//- Reference height
const scalar Zref_;
//- Surface roughness height
scalarField z0_;
//- Minimum coordinate value in z direction
scalarField zGround_;
//- Friction velocity
scalarField Ustar_;
public:
......@@ -203,21 +144,6 @@ public:
// Member functions
// Access
//- Return friction velocity
const scalarField& Ustar() const
{
return Ustar_;
}
//- Return z-direction
const vector& z() const
{
return z_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "atmBoundaryLayerInletKFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
atmBoundaryLayerInletKFvPatchScalarField::
atmBoundaryLayerInletKFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
atmBoundaryLayer()
{}
atmBoundaryLayerInletKFvPatchScalarField::
atmBoundaryLayerInletKFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF),
atmBoundaryLayer(patch().Cf(), dict)
{
scalarField::operator=(k(patch().Cf()));
}
atmBoundaryLayerInletKFvPatchScalarField::
atmBoundaryLayerInletKFvPatchScalarField
(
const atmBoundaryLayerInletKFvPatchScalarField& psf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(psf, p, iF, mapper),
atmBoundaryLayer(psf, mapper)
{}
atmBoundaryLayerInletKFvPatchScalarField::
atmBoundaryLayerInletKFvPatchScalarField
(
const atmBoundaryLayerInletKFvPatchScalarField& psf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(psf, iF),
atmBoundaryLayer(psf)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void atmBoundaryLayerInletKFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
fixedValueFvPatchScalarField::autoMap(m);
atmBoundaryLayer::autoMap(m);
}
void atmBoundaryLayerInletKFvPatchScalarField::rmap
(
const fvPatchScalarField& psf,
const labelList& addr
)
{
fixedValueFvPatchScalarField::rmap(psf, addr);
const atmBoundaryLayerInletKFvPatchScalarField& blpsf =
refCast<const atmBoundaryLayerInletKFvPatchScalarField>(psf);
atmBoundaryLayer::rmap(blpsf, addr);
}
void atmBoundaryLayerInletKFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
atmBoundaryLayer::write(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
atmBoundaryLayerInletKFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::incompressible::atmBoundaryLayerInletKFvPatchScalarField
Group
grpIcoRASBoundaryConditions grpInletBoundaryConditions
Description
This boundary condition specifies an inlet value for the turbulence
kinetic energy, \f$\K\f$, appropriate for atmospheric boundary layers.
See Foam::incompressible::atmBoundaryLayer for details.
Example of the boundary condition specification:
\verbatim
ground
{
type atmBoundaryLayerInletK;
z (0 0 1);
Uref 10.0;
Zref 20.0;
z0 uniform 0.1;
zGround uniform 0.0;
}
\endverbatim
SeeAlso
Foam::incompressible::atmBoundaryLayer,
Foam::incompressible::atmBoundaryLayerInletVelocityFvPatchVectorField,
Foam::incompressible::atmBoundaryLayerInletEpsilonFvPatchScalarField
SourceFiles
atmBoundaryLayerInletKFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef atmBoundaryLayerInletKFvPatchScalarField_H
#define atmBoundaryLayerInletKFvPatchScalarField_H
#include "fvPatchFields.H"
#include "fixedValueFvPatchFields.H"
#include "atmBoundaryLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class atmBoundaryLayerInletKFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class atmBoundaryLayerInletKFvPatchScalarField
:
public fixedValueFvPatchScalarField,
public atmBoundaryLayer
{
public:
//- Runtime type information
TypeName("atmBoundaryLayerInletK");
// Constructors
//- Construct from patch and internal field
atmBoundaryLayerInletKFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
atmBoundaryLayerInletKFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// atmBoundaryLayerInletKFvPatchScalarField onto a new patch
atmBoundaryLayerInletKFvPatchScalarField
(
const atmBoundaryLayerInletKFvPatchScalarField&,