mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
atmBoundaryLayer: rationalized U and epsilon BCs and added the corresponding k BC
This commit is contained in:
@ -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
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
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,33 +46,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
z_(vector::zero),
|
||||
kappa_(0.41),
|
||||
Uref_(0),
|
||||
Zref_(0),
|
||||
z0_(0),
|
||||
zGround_(0),
|
||||
Ustar_(0)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
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)
|
||||
atmBoundaryLayer()
|
||||
{}
|
||||
|
||||
|
||||
@ -85,56 +59,35 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
)
|
||||
:
|
||||
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())
|
||||
atmBoundaryLayer(patch().Cf(), dict)
|
||||
{
|
||||
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_))
|
||||
);
|
||||
scalarField::operator=(epsilon(patch().Cf()));
|
||||
}
|
||||
|
||||
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf,
|
||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField& psf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(psf, p, iF, mapper),
|
||||
atmBoundaryLayer(psf, mapper)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
(
|
||||
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.
|
||||
dissipation, \f$\epsilon\f$, appropriate for atmospheric boundary layers.
|
||||
|
||||
\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
|
||||
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
|
||||
|
||||
@ -0,0 +1,142 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,177 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new atmBoundaryLayerInletKFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
atmBoundaryLayerInletKFvPatchScalarField
|
||||
(
|
||||
const atmBoundaryLayerInletKFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new atmBoundaryLayerInletKFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,6 +1,7 @@
|
||||
turbulenceModel.C
|
||||
laminar/laminar.C
|
||||
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C
|
||||
derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C
|
||||
derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libincompressibleTurbulenceModel
|
||||
|
||||
@ -0,0 +1,182 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "atmBoundaryLayer.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace incompressible
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
atmBoundaryLayer::atmBoundaryLayer()
|
||||
:
|
||||
flowDir_(pTraits<vector>::zero),
|
||||
zDir_(pTraits<vector>::zero),
|
||||
kappa_(0.41),
|
||||
Cmu_(0.09),
|
||||
Uref_(0),
|
||||
Zref_(0),
|
||||
z0_(0),
|
||||
zGround_(0),
|
||||
Ustar_(0)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayer::atmBoundaryLayer(const vectorField& p, const dictionary& dict)
|
||||
:
|
||||
flowDir_(dict.lookup("flowDir")),
|
||||
zDir_(dict.lookup("zDir")),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
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(flowDir_) < SMALL || mag(zDir_) < SMALL)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"atmBoundaryLayer(const dictionary&)"
|
||||
) << "magnitude of n or z must be greater than zero"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Ensure direction vectors are normalized
|
||||
flowDir_ /= mag(flowDir_);
|
||||
zDir_ /= mag(zDir_);
|
||||
|
||||
Ustar_ = kappa_*Uref_/(log((Zref_ + z0_)/max(z0_, 0.001)));
|
||||
}
|
||||
|
||||
|
||||
atmBoundaryLayer::atmBoundaryLayer
|
||||
(
|
||||
const atmBoundaryLayer& ptf,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
flowDir_(ptf.flowDir_),
|
||||
zDir_(ptf.zDir_),
|
||||
kappa_(ptf.kappa_),
|
||||
Cmu_(ptf.Cmu_),
|
||||
Uref_(ptf.Uref_),
|
||||
Zref_(ptf.Zref_),
|
||||
z0_(ptf.z0_, mapper),
|
||||
zGround_(ptf.zGround_, mapper),
|
||||
Ustar_(ptf.Ustar_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayer::atmBoundaryLayer(const atmBoundaryLayer& blpvf)
|
||||
:
|
||||
flowDir_(blpvf.flowDir_),
|
||||
zDir_(blpvf.zDir_),
|
||||
kappa_(blpvf.kappa_),
|
||||
Cmu_(blpvf.Cmu_),
|
||||
Uref_(blpvf.Uref_),
|
||||
Zref_(blpvf.Zref_),
|
||||
z0_(blpvf.z0_),
|
||||
zGround_(blpvf.zGround_),
|
||||
Ustar_(blpvf.Ustar_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void atmBoundaryLayer::autoMap(const fvPatchFieldMapper& m)
|
||||
{
|
||||
z0_.autoMap(m);
|
||||
zGround_.autoMap(m);
|
||||
Ustar_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayer::rmap
|
||||
(
|
||||
const atmBoundaryLayer& blptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
z0_.rmap(blptf.z0_, addr);
|
||||
zGround_.rmap(blptf.zGround_, addr);
|
||||
Ustar_.rmap(blptf.Ustar_, addr);
|
||||
}
|
||||
|
||||
|
||||
tmp<vectorField> atmBoundaryLayer::U(const vectorField& p) const
|
||||
{
|
||||
scalarField Un
|
||||
(
|
||||
(Ustar_/kappa_)
|
||||
*log(((zDir_ & p) - zGround_ + z0_)/max(z0_, 0.001))
|
||||
);
|
||||
|
||||
return flowDir_*Un;
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> atmBoundaryLayer::k(const vectorField& p) const
|
||||
{
|
||||
return sqr(Ustar_)/sqrt(Cmu_);
|
||||
}
|
||||
|
||||
|
||||
tmp<scalarField> atmBoundaryLayer::epsilon(const vectorField& p) const
|
||||
{
|
||||
return pow3(Ustar_)/(kappa_*((zDir_ & p) - zGround_ + z0_));
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayer::write(Ostream& os) const
|
||||
{
|
||||
z0_.writeEntry("z0", os) ;
|
||||
os.writeKeyword("flowDir")
|
||||
<< flowDir_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("zDir")
|
||||
<< zDir_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa")
|
||||
<< kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Cmu")
|
||||
<< Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Uref")
|
||||
<< Uref_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("Zref")
|
||||
<< Zref_ << token::END_STATEMENT << nl;
|
||||
zGround_.writeEntry("zGround", os) ;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,244 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::atmBoundaryLayer
|
||||
|
||||
Group
|
||||
grpIcoRASBoundaryConditions grpInletBoundaryConditions
|
||||
|
||||
Description
|
||||
This class provides functions to evaluate the velocity and turbulence
|
||||
distributions appropriate for atmospheric boundary layers (ABL).
|
||||
|
||||
The profile is derived from the friction velocity, flow direction and
|
||||
"vertical" direction:
|
||||
|
||||
\f[
|
||||
U = \frac{U^*}{\kappa} ln\left(\frac{z - z_g + z_0}{z_0}\right)
|
||||
\f]
|
||||
|
||||
\f[
|
||||
k = \frac{(U^*)^2}{\sqrt{C_mu}}
|
||||
\f]
|
||||
|
||||
\f[
|
||||
\epsilon = \frac{(U^*)^3}{\kappa(z - z_g + z_0)}
|
||||
\f]
|
||||
|
||||
where
|
||||
\vartable
|
||||
U^* | Friction velocity
|
||||
\kappa | von Karman's constant
|
||||
C_mu | Turbulence viscosity coefficient
|
||||
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
|
||||
|
||||
Use in the atmBoundaryLayerInletVelocity, atmBoundaryLayerInletK and
|
||||
atmBoundaryLayerInletEpsilon boundary conditions.
|
||||
|
||||
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.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
flowDir | Flow direction | yes |
|
||||
zDir | Vertical direction | yes |
|
||||
kappa | von Karman's constant | no | 0.41
|
||||
Cmu | Turbulence viscosity coefficient | no | 0.09
|
||||
Uref | Reference velocity [m/s] | yes |
|
||||
Zref | Reference height [m] | yes |
|
||||
z0 | Surface roughness height [m] | yes |
|
||||
zGround | Minimum z-coordinate [m] | yes |
|
||||
\endtable
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
ground
|
||||
{
|
||||
type atmBoundaryLayerInletVelocity;
|
||||
flowDir (1 0 0);
|
||||
zDir (0 0 1);
|
||||
Uref 10.0;
|
||||
Zref 20.0;
|
||||
z0 uniform 0.1;
|
||||
zGround uniform 0.0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the
|
||||
k-epsilon model should be changed from 1.3 to 1.11 for consistency.
|
||||
The roughness height (Er) is given by Er = 20 z0 following the same
|
||||
reference.
|
||||
|
||||
SourceFiles
|
||||
atmBoundaryLayer.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef atmBoundaryLayer_H
|
||||
#define atmBoundaryLayer_H
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace incompressible
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class atmBoundaryLayer Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class atmBoundaryLayer
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Flow direction
|
||||
vector flowDir_;
|
||||
|
||||
//- Direction of the z-coordinate
|
||||
vector zDir_;
|
||||
|
||||
//- von Karman constant
|
||||
const scalar kappa_;
|
||||
|
||||
//- Turbulent viscosity coefficient
|
||||
const scalar Cmu_;
|
||||
|
||||
//- 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:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
atmBoundaryLayer();
|
||||
|
||||
//- Construct from the coordinates field and dictionary
|
||||
atmBoundaryLayer(const vectorField& p, const dictionary&);
|
||||
|
||||
//- Construct by mapping given
|
||||
// atmBoundaryLayer onto a new patch
|
||||
atmBoundaryLayer
|
||||
(
|
||||
const atmBoundaryLayer&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
atmBoundaryLayer(const atmBoundaryLayer&);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return flow direction
|
||||
const vector& flowDir() const
|
||||
{
|
||||
return flowDir_;
|
||||
}
|
||||
|
||||
//- Return z-direction
|
||||
const vector& zDir() const
|
||||
{
|
||||
return zDir_;
|
||||
}
|
||||
|
||||
//- Return friction velocity
|
||||
const scalarField& Ustar() const
|
||||
{
|
||||
return Ustar_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
void rmap(const atmBoundaryLayer&, const labelList&);
|
||||
|
||||
|
||||
// Evaluate functions
|
||||
|
||||
//- Return the velocity distribution for the ATM
|
||||
tmp<vectorField> U(const vectorField& p) const;
|
||||
|
||||
//- Return the turbulent kinetic energy distribution for the ATM
|
||||
tmp<scalarField> k(const vectorField& p) const;
|
||||
|
||||
//- Return the turbulent dissipation rate distribution for the ATM
|
||||
tmp<scalarField> epsilon(const vectorField& p) const;
|
||||
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,9 @@
|
||||
wmake: 'Make' directory does not exist in /home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer
|
||||
Searching up directories tree for Make directory
|
||||
Found target directory ./../..
|
||||
/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/turbulenceModels/incompressible/turbulenceModel
|
||||
Making dependency list for source file derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C
|
||||
g++ -m64 -Dlinux64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/finiteVolume/lnInclude -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/turbulenceModels -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/transportModels -IlnInclude -I. -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/OpenFOAM/lnInclude -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/OSspecific/POSIX/lnInclude -fPIC -c derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C -o /home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.o
|
||||
g++ -m64 -Dlinux64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/finiteVolume/lnInclude -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/turbulenceModels -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/transportModels -IlnInclude -I. -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/OpenFOAM/lnInclude -I/home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/OSspecific/POSIX/lnInclude -fPIC -shared -Xlinker --add-needed -Xlinker --no-as-needed /home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.o /home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.o /home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.o /home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.o /home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.o -L/home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib \
|
||||
-lfiniteVolume -o /home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/libincompressibleTurbulenceModel.so
|
||||
'/home/dm2/henry/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/libincompressibleTurbulenceModel.so' is up to date.
|
||||
@ -46,35 +46,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
n_(pTraits<vector>::zero),
|
||||
z_(pTraits<vector>::zero),
|
||||
kappa_(0.41),
|
||||
Uref_(0),
|
||||
Zref_(0),
|
||||
z0_(0),
|
||||
zGround_(0),
|
||||
Ustar_(0)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||
n_(ptf.n_),
|
||||
z_(ptf.z_),
|
||||
kappa_(ptf.kappa_),
|
||||
Uref_(ptf.Uref_),
|
||||
Zref_(ptf.Zref_),
|
||||
z0_(ptf.z0_, mapper),
|
||||
zGround_(ptf.zGround_, mapper),
|
||||
Ustar_(ptf.Ustar_, mapper)
|
||||
atmBoundaryLayer()
|
||||
{}
|
||||
|
||||
|
||||
@ -87,61 +59,35 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
n_(dict.lookup("n")),
|
||||
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())
|
||||
atmBoundaryLayer(patch().Cf(), dict)
|
||||
{
|
||||
if (mag(n_) < SMALL || mag(z_) < SMALL)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"atmBoundaryLayerInletVelocityFvPatchVectorField"
|
||||
"("
|
||||
"const fvPatch&, "
|
||||
"const DimensionedField<vector, volMesh>&, "
|
||||
"onst dictionary&"
|
||||
")"
|
||||
)
|
||||
<< "magnitude of n or z must be greater than zero"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Ensure direction vectors are normalized
|
||||
n_ /= mag(n_);
|
||||
z_ /= mag(z_);
|
||||
|
||||
Ustar_ = kappa_*Uref_/(log((Zref_ + z0_)/max(z0_, 0.001)));
|
||||
scalarField Un
|
||||
(
|
||||
(Ustar_/kappa_)
|
||||
*log(((z_ & patch().Cf()) - zGround_ + z0_)/max(z0_, 0.001))
|
||||
);
|
||||
|
||||
vectorField::operator=(n_*Un);
|
||||
vectorField::operator=(U(patch().Cf()));
|
||||
}
|
||||
|
||||
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf,
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& pvf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(pvf, p, iF, mapper),
|
||||
atmBoundaryLayer(pvf, mapper)
|
||||
{}
|
||||
|
||||
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
(
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& pvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(blpvf, iF),
|
||||
n_(blpvf.n_),
|
||||
z_(blpvf.z_),
|
||||
kappa_(blpvf.kappa_),
|
||||
Uref_(blpvf.Uref_),
|
||||
Zref_(blpvf.Zref_),
|
||||
z0_(blpvf.z0_),
|
||||
zGround_(blpvf.zGround_),
|
||||
Ustar_(blpvf.Ustar_)
|
||||
fixedValueFvPatchVectorField(pvf, iF),
|
||||
atmBoundaryLayer(pvf)
|
||||
{}
|
||||
|
||||
|
||||
@ -153,44 +99,29 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::autoMap
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchVectorField::autoMap(m);
|
||||
z0_.autoMap(m);
|
||||
zGround_.autoMap(m);
|
||||
Ustar_.autoMap(m);
|
||||
atmBoundaryLayer::autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayerInletVelocityFvPatchVectorField::rmap
|
||||
(
|
||||
const fvPatchVectorField& ptf,
|
||||
const fvPatchVectorField& pvf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchVectorField::rmap(ptf, addr);
|
||||
fixedValueFvPatchVectorField::rmap(pvf, addr);
|
||||
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& blptf =
|
||||
refCast<const atmBoundaryLayerInletVelocityFvPatchVectorField>(ptf);
|
||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf =
|
||||
refCast<const atmBoundaryLayerInletVelocityFvPatchVectorField>(pvf);
|
||||
|
||||
z0_.rmap(blptf.z0_, addr);
|
||||
zGround_.rmap(blptf.zGround_, addr);
|
||||
Ustar_.rmap(blptf.Ustar_, addr);
|
||||
atmBoundaryLayer::rmap(blpvf, addr);
|
||||
}
|
||||
|
||||
|
||||
void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
z0_.writeEntry("z0", os) ;
|
||||
os.writeKeyword("n")
|
||||
<< n_ << token::END_STATEMENT << nl;
|
||||
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;
|
||||
zGround_.writeEntry("zGround", os) ;
|
||||
atmBoundaryLayer::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -29,52 +29,9 @@ Group
|
||||
|
||||
Description
|
||||
This boundary condition specifies a velocity inlet profile appropriate
|
||||
for atmospheric boundary layers (ABL). The profile is derived from the
|
||||
friction velocity, flow direction and "vertical" direction.
|
||||
for atmospheric boundary layers (ABL).
|
||||
|
||||
\f[
|
||||
U = \frac{U^*}{\kappa} ln\left(\frac{z - z_g + z_0}{z_0}\right)
|
||||
\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
|
||||
|
||||
Use in conjunction with the atmBoundaryLayerInletEpsilon boundary
|
||||
condition if using an \f$\epsilon\f$ based turbulence model.
|
||||
|
||||
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.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
n | Flow direction | yes |
|
||||
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
|
||||
See Foam::incompressible::atmBoundaryLayer for details.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
@ -90,11 +47,10 @@ Description
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the
|
||||
k-epsilon model should be changed from 1.3 to 1.11 for consistency.
|
||||
The roughness height (Er) is given by Er = 20 z0 following the same
|
||||
reference.
|
||||
SeeAlso
|
||||
Foam::incompressible::atmBoundaryLayer,
|
||||
Foam::incompressible::atmBoundaryLayerInletKFvPatchScalarField,
|
||||
Foam::incompressible::atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
atmBoundaryLayerInletVelocityFvPatchVectorField.C
|
||||
@ -106,6 +62,7 @@ SourceFiles
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "atmBoundaryLayer.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -120,34 +77,9 @@ namespace incompressible
|
||||
|
||||
class atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
public fixedValueFvPatchVectorField,
|
||||
public atmBoundaryLayer
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Flow direction
|
||||
vector n_;
|
||||
|
||||
//- 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:
|
||||
|
||||
@ -213,27 +145,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return friction velocity
|
||||
const scalarField& Ustar() const
|
||||
{
|
||||
return Ustar_;
|
||||
}
|
||||
|
||||
//- Return flow direction
|
||||
const vector& n() const
|
||||
{
|
||||
return n_;
|
||||
}
|
||||
|
||||
//- Return z-direction
|
||||
const vector& z() const
|
||||
{
|
||||
return z_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
|
||||
@ -23,8 +23,6 @@ internalField uniform $flowVelocity;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#include "include/ABLConditions"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
@ -35,13 +33,7 @@ boundaryField
|
||||
inlet
|
||||
{
|
||||
type atmBoundaryLayerInletVelocity;
|
||||
Uref $Uref;
|
||||
Zref $Zref;
|
||||
n $windDirection;
|
||||
z $zDirection;
|
||||
z0 $z0;
|
||||
value $internalField;
|
||||
zGround $zGround;
|
||||
#include "include/ABLConditions"
|
||||
}
|
||||
|
||||
terrain
|
||||
|
||||
@ -23,8 +23,6 @@ internalField uniform $turbulentEpsilon;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#include "include/ABLConditions"
|
||||
|
||||
terrain
|
||||
{
|
||||
type epsilonWallFunction;
|
||||
@ -44,12 +42,7 @@ boundaryField
|
||||
inlet
|
||||
{
|
||||
type atmBoundaryLayerInletEpsilon;
|
||||
Uref $Uref;
|
||||
Zref $Zref;
|
||||
z $zDirection;
|
||||
z0 $z0;
|
||||
value $internalField;
|
||||
zGround $zGround;
|
||||
#include "include/ABLConditions"
|
||||
}
|
||||
|
||||
ground
|
||||
|
||||
@ -8,9 +8,10 @@
|
||||
|
||||
Uref 10.0;
|
||||
Zref 20;
|
||||
zDir (0 0 1);
|
||||
flowDir (1 0 0);
|
||||
z0 uniform 0.1;
|
||||
turbulentKE 1.3;
|
||||
windDirection (1 0 0);
|
||||
zDirection (0 0 1);
|
||||
zGround uniform 935.0;
|
||||
value $internalField;
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -22,8 +22,6 @@ internalField uniform $turbulentKE;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#include "include/ABLConditions"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
@ -33,8 +31,8 @@ boundaryField
|
||||
|
||||
inlet
|
||||
{
|
||||
type uniformFixedValue;
|
||||
uniformValue constant $turbulentKE;
|
||||
type atmBoundaryLayerInletK;
|
||||
#include "include/ABLConditions"
|
||||
}
|
||||
|
||||
terrain
|
||||
|
||||
Reference in New Issue
Block a user