atmBoundaryLayer: Attempt to rationalize the inputs and documentation to make these BCs more usable

Resolves bug report http://www.openfoam.org/mantisbt/view.php?id=860
This commit is contained in:
Henry
2014-12-29 17:39:20 +00:00
parent a6ccbc6d7d
commit 8f9a576bde
7 changed files with 111 additions and 114 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,7 +49,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(vector::zero), z_(vector::zero),
kappa_(0.41), kappa_(0.41),
Uref_(0), Uref_(0),
Href_(0), Zref_(0),
z0_(0), z0_(0),
zGround_(0), zGround_(0),
Ustar_(0) Ustar_(0)
@ -69,7 +69,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(ptf.z_), z_(ptf.z_),
kappa_(ptf.kappa_), kappa_(ptf.kappa_),
Uref_(ptf.Uref_), Uref_(ptf.Uref_),
Href_(ptf.Href_), Zref_(ptf.Zref_),
z0_(ptf.z0_, mapper), z0_(ptf.z0_, mapper),
zGround_(ptf.zGround_, mapper), zGround_(ptf.zGround_, mapper),
Ustar_(ptf.Ustar_, mapper) Ustar_(ptf.Ustar_, mapper)
@ -88,7 +88,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(dict.lookup("z")), z_(dict.lookup("z")),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Uref_(readScalar(dict.lookup("Uref"))), Uref_(readScalar(dict.lookup("Uref"))),
Href_(readScalar(dict.lookup("Href"))), Zref_(readScalar(dict.lookup("Zref"))),
z0_("z0", dict, p.size()), z0_("z0", dict, p.size()),
zGround_("zGround", dict, p.size()), zGround_("zGround", dict, p.size()),
Ustar_(p.size()) Ustar_(p.size())
@ -108,15 +108,15 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
<< abort(FatalError); << abort(FatalError);
} }
forAll (Ustar_, i) // Ensure direction vectors are normalized
{
Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001)));
}
z_ /= mag(z_); z_ /= mag(z_);
const vectorField& c = patch().Cf(); Ustar_ = kappa_*Uref_/(log((Zref_ + z0_)/max(z0_, 0.001)));
scalarField::operator=(pow3(Ustar_)/(kappa_*((c & z_) - zGround_ + z0_)));
scalarField::operator=
(
pow3(Ustar_)/(kappa_*((z_ & patch().Cf()) - zGround_ + z0_))
);
} }
@ -131,7 +131,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(blpsf.z_), z_(blpsf.z_),
kappa_(blpsf.kappa_), kappa_(blpsf.kappa_),
Uref_(blpsf.Uref_), Uref_(blpsf.Uref_),
Href_(blpsf.Href_), Zref_(blpsf.Zref_),
z0_(blpsf.z0_), z0_(blpsf.z0_),
zGround_(blpsf.zGround_), zGround_(blpsf.zGround_),
Ustar_(blpsf.Ustar_) Ustar_(blpsf.Ustar_)
@ -178,8 +178,8 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
<< kappa_ << token::END_STATEMENT << nl; << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Uref") os.writeKeyword("Uref")
<< Uref_ << token::END_STATEMENT << nl; << Uref_ << token::END_STATEMENT << nl;
os.writeKeyword("Href") os.writeKeyword("Zref")
<< Href_ << token::END_STATEMENT << nl; << Zref_ << token::END_STATEMENT << nl;
z0_.writeEntry("z0", os); z0_.writeEntry("z0", os);
zGround_.writeEntry("zGround", os); zGround_.writeEntry("zGround", os);
writeEntry("value", os); writeEntry("value", os);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,57 +29,56 @@ Group
Description Description
This boundary condition specifies an inlet value for the turbulence This boundary condition specifies an inlet value for the turbulence
dissipation, \f$\epsilon\f$ (\c epsilon), appropriate for atmospheric dissipation, \f$\epsilon\f$, appropriate for atmospheric boundary layers
boundary layers (ABL), and designed to be used in conjunction with the (ABL), and designed to be used in conjunction with the
\c ABLInletVelocity inlet velocity boundary condition. atmBoundaryLayerInletVelocity inlet velocity boundary condition.
\f[ \f[
\epsilon = \frac{(U^*)^3}{K(z - z_g + z_0)} \epsilon = \frac{(U^*)^3}{\kappa(z - z_g + z_0)}
\f] \f]
where where
\vartable \vartable
U^* | frictional velocity U^* | Friction velocity
K | Karman's constant \kappa | von Karman's constant
z | vertical co-ordinate [m] z | Vertical coordinate
z_0 | surface roughness length [m] z_0 | Surface roughness height [m]
z_g | minimum vlaue in z direction [m] z_g | Minimum z-coordinate [m]
\endvartable \endvartable
and: and:
\f[ \f[
U^* = K \frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)} U^* = \kappa\frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)}
\f] \f]
where: where:
\vartable \vartable
U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s] U_{ref} | Reference velocity at \f$Z_{ref}\f$ [m/s]
Z_{ref} | reference height [m] Z_{ref} | Reference height [m]
\endvartable \endvartable
\heading Patch usage \heading Patch usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
z | vertical direction of z-axis | yes | z | Vertical direction | yes |
kappa | Karman's constanat | no | 0.41 kappa | von Karman's constant | no | 0.41
Uref | reference velocity [m/s] | yes | Uref | Reference velocity [m/s] | yes |
Href | reference height [m] | yes | Zref | Reference height [m] | yes |
z0 | surface roughness length [m] | yes | z0 | Surface roughness height [m] | yes |
zGround | minimum z co-ordinate [m] | yes | zGround | Minimum z coordinate [m] | yes |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
myPatch ground
{ {
type atmBoundaryLayerInletEpsilon; type atmBoundaryLayerInletEpsilon;
z (0 1 0); z (0 0 1);
kappa 0.41; Uref 10.0;
Uref 1.0; Zref 20.0;
Href 0.0; z0 uniform 0.1;
z0 uniform 0.0;
zGround uniform 0.0; zGround uniform 0.0;
} }
\endverbatim \endverbatim
@ -121,22 +120,22 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField
//- Direction of the z-coordinate //- Direction of the z-coordinate
vector z_; vector z_;
//- Von Karman constant //- von Karman constant
const scalar kappa_; const scalar kappa_;
//- Reference velocity //- Reference velocity
const scalar Uref_; const scalar Uref_;
//- Reference height //- Reference height
const scalar Href_; const scalar Zref_;
//- Surface roughness length //- Surface roughness height
scalarField z0_; scalarField z0_;
//- Minimum co-ordinate value in z direction //- Minimum coordinate value in z direction
scalarField zGround_; scalarField zGround_;
//- Frictional velocity //- Friction velocity
scalarField Ustar_; scalarField Ustar_;
@ -206,13 +205,13 @@ public:
// Access // Access
//- Return max value //- Return friction velocity
const scalarField& Ustar() const const scalarField& Ustar() const
{ {
return Ustar_; return Ustar_;
} }
//- Return z direction //- Return z-direction
const vector& z() const const vector& z() const
{ {
return z_; return z_;

View File

@ -46,14 +46,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF),
Ustar_(0),
n_(pTraits<vector>::zero), n_(pTraits<vector>::zero),
z_(pTraits<vector>::zero), z_(pTraits<vector>::zero),
z0_(0),
kappa_(0.41), kappa_(0.41),
Uref_(0), Uref_(0),
Href_(0), Zref_(0),
zGround_(0) z0_(0),
zGround_(0),
Ustar_(0)
{} {}
@ -67,14 +67,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(ptf, p, iF, mapper), fixedValueFvPatchVectorField(ptf, p, iF, mapper),
Ustar_(ptf.Ustar_, mapper),
n_(ptf.n_), n_(ptf.n_),
z_(ptf.z_), z_(ptf.z_),
z0_(ptf.z0_, mapper),
kappa_(ptf.kappa_), kappa_(ptf.kappa_),
Uref_(ptf.Uref_), Uref_(ptf.Uref_),
Href_(ptf.Href_), Zref_(ptf.Zref_),
zGround_(ptf.zGround_, mapper) z0_(ptf.z0_, mapper),
zGround_(ptf.zGround_, mapper),
Ustar_(ptf.Ustar_, mapper)
{} {}
@ -87,14 +87,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF),
Ustar_(p.size()),
n_(dict.lookup("n")), n_(dict.lookup("n")),
z_(dict.lookup("z")), z_(dict.lookup("z")),
z0_("z0", dict, p.size()),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Uref_(readScalar(dict.lookup("Uref"))), Uref_(readScalar(dict.lookup("Uref"))),
Href_(readScalar(dict.lookup("Href"))), Zref_(readScalar(dict.lookup("Zref"))),
zGround_("zGround", dict, p.size()) z0_("z0", dict, p.size()),
zGround_("zGround", dict, p.size()),
Ustar_(p.size())
{ {
if (mag(n_) < SMALL || mag(z_) < SMALL) if (mag(n_) < SMALL || mag(z_) < SMALL)
{ {
@ -115,7 +115,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
n_ /= mag(n_); n_ /= mag(n_);
z_ /= mag(z_); z_ /= mag(z_);
Ustar_ = kappa_*Uref_/(log((Href_ + z0_)/max(z0_, 0.001))); Ustar_ = kappa_*Uref_/(log((Zref_ + z0_)/max(z0_, 0.001)));
scalarField Un scalarField Un
( (
(Ustar_/kappa_) (Ustar_/kappa_)
@ -134,14 +134,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(blpvf, iF), fixedValueFvPatchVectorField(blpvf, iF),
Ustar_(blpvf.Ustar_),
n_(blpvf.n_), n_(blpvf.n_),
z_(blpvf.z_), z_(blpvf.z_),
z0_(blpvf.z0_),
kappa_(blpvf.kappa_), kappa_(blpvf.kappa_),
Uref_(blpvf.Uref_), Uref_(blpvf.Uref_),
Href_(blpvf.Href_), Zref_(blpvf.Zref_),
zGround_(blpvf.zGround_) z0_(blpvf.z0_),
zGround_(blpvf.zGround_),
Ustar_(blpvf.Ustar_)
{} {}
@ -188,8 +188,8 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
<< kappa_ << token::END_STATEMENT << nl; << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Uref") os.writeKeyword("Uref")
<< Uref_ << token::END_STATEMENT << nl; << Uref_ << token::END_STATEMENT << nl;
os.writeKeyword("Href") os.writeKeyword("Zref")
<< Href_ << token::END_STATEMENT << nl; << Zref_ << token::END_STATEMENT << nl;
zGround_.writeEntry("zGround", os) ; zGround_.writeEntry("zGround", os) ;
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,34 +30,33 @@ Group
Description Description
This boundary condition specifies a velocity inlet profile appropriate This boundary condition specifies a velocity inlet profile appropriate
for atmospheric boundary layers (ABL). The profile is derived from the for atmospheric boundary layers (ABL). The profile is derived from the
friction velocity, flow direction and the direction of the parabolic friction velocity, flow direction and "vertical" direction.
co-ordinate \c z.
\f[ \f[
U = \frac{U^*}{K} ln\left(\frac{z - z_g + z_0}{z_0}\right) U = \frac{U^*}{\kappa} ln\left(\frac{z - z_g + z_0}{z_0}\right)
\f] \f]
where where
\vartable \vartable
U^* | frictional velocity U^* | Friction velocity
K | Karman's constant \kappa | von Karman's constant
z | vertical co-ordinate [m] z | Vertical coordinate
z_0 | surface roughness length [m] z_0 | Surface roughness height [m]
z_g | minimum vlaue in z direction [m] z_g | Minimum z-coordinate [m]
\endvartable \endvartable
and
and:
\f[ \f[
U^* = K \frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)} U^* = \kappa\frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)}
\f] \f]
where
where:
\vartable \vartable
U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s] U_{ref} | Reference velocity at \f$Z_{ref}\f$ [m/s]
Z_{ref} | reference height [m] Z_{ref} | Reference height [m]
\endvartable \endvartable
Use in conjunction with the atmBoundaryLayerInletEpsilon boundary
condition if using an \f$\epsilon\f$ based turbulence model.
Reference: Reference:
D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model 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 in commercial CFD software to model the neutral atmospheric boundary
@ -67,27 +66,26 @@ Description
\heading Patch usage \heading Patch usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
n | flow direction | yes | n | Flow direction | yes |
z | vertical direction of z-axis | yes | z | Vertical direction | yes |
kappa | Karman's constanat | no | 0.41 kappa | von Karman's constant | no | 0.41
Uref | reference velocity [m/s] | yes | Uref | Reference velocity [m/s] | yes |
Href | reference height [m] | yes | Zref | Reference height [m] | yes |
z0 | surface roughness length [m] | yes | z0 | Surface roughness height [m] | yes |
zGround | minimum z co-ordinate [m] | yes | zGround | Minimum z-coordinate [m] | yes |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
myPatch ground
{ {
type atmBoundaryLayerInletVelocity; type atmBoundaryLayerInletVelocity;
n (0 1 0); n (1 0 0);
z (0 1 0); z (0 0 1);
kappa 0.41; Uref 10.0;
Uref 1.0; Zref 20.0;
Href 0.0; z0 uniform 0.1;
z0 uniform 0.0;
zGround uniform 0.0; zGround uniform 0.0;
} }
\endverbatim \endverbatim
@ -126,30 +124,30 @@ class atmBoundaryLayerInletVelocityFvPatchVectorField
{ {
// Private data // Private data
//- Frictional velocity
scalarField Ustar_;
//- Flow direction //- Flow direction
vector n_; vector n_;
//- Direction of the z-coordinate //- Direction of the z-coordinate
vector z_; vector z_;
//- Surface roughness length //- von Karman constant
scalarField z0_;
//- Von Karman constant
const scalar kappa_; const scalar kappa_;
//- Reference velocity //- Reference velocity
const scalar Uref_; const scalar Uref_;
//- Reference hight //- Reference height
const scalar Href_; const scalar Zref_;
//- Minimum corrdinate value in z direction //- Surface roughness height
scalarField z0_;
//- Minimum coordinate value in z direction
scalarField zGround_; scalarField zGround_;
//- Friction velocity
scalarField Ustar_;
public: public:
@ -217,7 +215,7 @@ public:
// Access // Access
//- Return Ustar //- Return friction velocity
const scalarField& Ustar() const const scalarField& Ustar() const
{ {
return Ustar_; return Ustar_;
@ -229,7 +227,7 @@ public:
return n_; return n_;
} }
//- Return z direction //- Return z-direction
const vector& z() const const vector& z() const
{ {
return z_; return z_;

View File

@ -36,7 +36,7 @@ boundaryField
{ {
type atmBoundaryLayerInletVelocity; type atmBoundaryLayerInletVelocity;
Uref $Uref; Uref $Uref;
Href $Href; Zref $Zref;
n $windDirection; n $windDirection;
z $zDirection; z $zDirection;
z0 $z0; z0 $z0;

View File

@ -45,7 +45,7 @@ boundaryField
{ {
type atmBoundaryLayerInletEpsilon; type atmBoundaryLayerInletEpsilon;
Uref $Uref; Uref $Uref;
Href $Href; Zref $Zref;
z $zDirection; z $zDirection;
z0 $z0; z0 $z0;
value $internalField; value $internalField;

View File

@ -7,7 +7,7 @@
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
Uref 10.0; Uref 10.0;
Href 20; Zref 20;
z0 uniform 0.1; z0 uniform 0.1;
turbulentKE 1.3; turbulentKE 1.3;
windDirection (1 0 0); windDirection (1 0 0);