diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index cd9a9bfdb610ea8412677a276ced67a4e84ac214..bb0258c6f4ad00028a45fa9df9c4ac546d2c6546 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -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 diff --git a/src/turbulenceModels/incompressible/RAS/Make/options b/src/turbulenceModels/incompressible/RAS/Make/options index 73454e7e385407d020a13a7bd734fdbad5bcc956..a5242e05ee4b0df567ebec7630f129cbd54aa116 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/options +++ b/src/turbulenceModels/incompressible/RAS/Make/options @@ -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 diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C index b5936628ef02473ebdbb8a8826d883cedff794b9..a1bf04e968136b2c3c6e39e0bd91c79dc1816b76 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -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); } diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H index 34a9966baa15a088a19ddb56afd0f4ea93747eac..4cbda74cf38b8104ec6cae354b170d62f54558aa 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H @@ -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 diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..3980ad27e045ab98a11a1a40c2a0cba4efb5e972 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.C @@ -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 + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..8e266db127428b343ad3ccd72fda494a5a9b8a10 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletK/atmBoundaryLayerInletKFvPatchScalarField.H @@ -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 + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/turbulenceModel/Make/files b/src/turbulenceModels/incompressible/turbulenceModel/Make/files index c83a939fae20dd5dd893d353dfe63811d6227edd..f770af1ec8bab3d01e8f4fe0a2196ca6dbdc0f49 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/Make/files +++ b/src/turbulenceModels/incompressible/turbulenceModel/Make/files @@ -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 diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C new file mode 100644 index 0000000000000000000000000000000000000000..1c6ff3fcff096ccba37cdc553dc83621f6f442b9 --- /dev/null +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C @@ -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 + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H new file mode 100644 index 0000000000000000000000000000000000000000..50641ee0e56e028a7f381e24b54bc6110e67526e --- /dev/null +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H @@ -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 + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/log b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/log new file mode 100644 index 0000000000000000000000000000000000000000..58b7a97bdfd13748cd6a7f26334a3ecd45527384 --- /dev/null +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayer/log @@ -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. diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index f46b9bbdb3e9d2644f120d4333cf337b1be1568c..9c8e5e423b3bdac7a35ad31bd8ec73cbba3d2750 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -46,102 +46,48 @@ 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) + atmBoundaryLayer() {} atmBoundaryLayerInletVelocityFvPatchVectorField:: atmBoundaryLayerInletVelocityFvPatchVectorField ( - const atmBoundaryLayerInletVelocityFvPatchVectorField& ptf, const fvPatch& p, const DimensionedField<vector, volMesh>& iF, - const fvPatchFieldMapper& mapper + const dictionary& dict ) : - 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) -{} + fixedValueFvPatchVectorField(p, iF), + atmBoundaryLayer(patch().Cf(), dict) +{ + vectorField::operator=(U(patch().Cf())); +} atmBoundaryLayerInletVelocityFvPatchVectorField:: atmBoundaryLayerInletVelocityFvPatchVectorField ( + const atmBoundaryLayerInletVelocityFvPatchVectorField& pvf, const fvPatch& p, const DimensionedField<vector, volMesh>& iF, - const dictionary& dict + const fvPatchFieldMapper& mapper ) : - 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()) -{ - 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); -} + fixedValueFvPatchVectorField(pvf, p, iF, mapper), + atmBoundaryLayer(pvf, mapper) +{} atmBoundaryLayerInletVelocityFvPatchVectorField:: atmBoundaryLayerInletVelocityFvPatchVectorField ( - const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf, + 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); } diff --git a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H index 39262b259898c27f9e76516104f5e82c1123ac0b..87022836869383e3735db9dbcc8db279ab393467 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H @@ -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. - - \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 + for atmospheric boundary layers (ABL). + + 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 diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/U b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/U index 3aa64952c969d694475bf0b9009e4dcf55b52ff6..8aa9427eaa5ffdc9546586608780dc5547d65b71 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/U +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/U @@ -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 diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon index bd65224dab25d6b41df91210bc020e976dec8030..fdfa0cad34762b4e28bfdd932b8f81615c5bb1da 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon @@ -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 diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/include/ABLConditions b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/include/ABLConditions index 78f948e5c0a63137a1ab7bfde8d195a01136bb5e..c40c87b65f1899e2caf097c943d389e145eb7d31 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/include/ABLConditions +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/include/ABLConditions @@ -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; + // ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k index ed2498cabfae5fdf398510bdb51276f4a8ffde2e..4708c7943097ebece21024790da6ce487266ad3b 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k @@ -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