Commit fcd4213f authored by Henry's avatar Henry
Browse files

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
parent ef1f62b8
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -49,7 +49,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(vector::zero),
kappa_(0.41),
Uref_(0),
Href_(0),
Zref_(0),
z0_(0),
zGround_(0),
Ustar_(0)
......@@ -69,7 +69,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(ptf.z_),
kappa_(ptf.kappa_),
Uref_(ptf.Uref_),
Href_(ptf.Href_),
Zref_(ptf.Zref_),
z0_(ptf.z0_, mapper),
zGround_(ptf.zGround_, mapper),
Ustar_(ptf.Ustar_, mapper)
......@@ -88,7 +88,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(dict.lookup("z")),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Uref_(readScalar(dict.lookup("Uref"))),
Href_(readScalar(dict.lookup("Href"))),
Zref_(readScalar(dict.lookup("Zref"))),
z0_("z0", dict, p.size()),
zGround_("zGround", dict, p.size()),
Ustar_(p.size())
......@@ -108,15 +108,15 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
<< abort(FatalError);
}
forAll (Ustar_, i)
{
Ustar_[i] = kappa_*Uref_/(log((Href_ + z0_[i])/max(z0_[i] , 0.001)));
}
// Ensure direction vectors are normalized
z_ /= mag(z_);
const vectorField& c = patch().Cf();
scalarField::operator=(pow3(Ustar_)/(kappa_*((c & z_) - zGround_ + z0_)));
Ustar_ = kappa_*Uref_/(log((Zref_ + z0_)/max(z0_, 0.001)));
scalarField::operator=
(
pow3(Ustar_)/(kappa_*((z_ & patch().Cf()) - zGround_ + z0_))
);
}
......@@ -131,7 +131,7 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
z_(blpsf.z_),
kappa_(blpsf.kappa_),
Uref_(blpsf.Uref_),
Href_(blpsf.Href_),
Zref_(blpsf.Zref_),
z0_(blpsf.z0_),
zGround_(blpsf.zGround_),
Ustar_(blpsf.Ustar_)
......@@ -178,8 +178,8 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
<< kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Uref")
<< Uref_ << token::END_STATEMENT << nl;
os.writeKeyword("Href")
<< Href_ << token::END_STATEMENT << nl;
os.writeKeyword("Zref")
<< Zref_ << token::END_STATEMENT << nl;
z0_.writeEntry("z0", os);
zGround_.writeEntry("zGround", os);
writeEntry("value", os);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -29,57 +29,56 @@ Group
Description
This boundary condition specifies an inlet value for the turbulence
dissipation, \f$\epsilon\f$ (\c epsilon), appropriate for atmospheric
boundary layers (ABL), and designed to be used in conjunction with the
\c ABLInletVelocity inlet velocity boundary condition.
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}{K(z - z_g + z_0)}
\epsilon = \frac{(U^*)^3}{\kappa(z - z_g + z_0)}
\f]
where
\vartable
U^* | frictional velocity
K | Karman's constant
z | vertical co-ordinate [m]
z_0 | surface roughness length [m]
z_g | minimum vlaue in z direction [m]
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^* = 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]
where:
\vartable
U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s]
Z_{ref} | reference height [m]
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 of z-axis | yes |
kappa | Karman's constanat | no | 0.41
Uref | reference velocity [m/s] | yes |
Href | reference height [m] | yes |
z0 | surface roughness length [m] | yes |
zGround | minimum z co-ordinate [m] | yes |
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
Example of the boundary condition specification:
\verbatim
myPatch
ground
{
type atmBoundaryLayerInletEpsilon;
z (0 1 0);
kappa 0.41;
Uref 1.0;
Href 0.0;
z0 uniform 0.0;
z (0 0 1);
Uref 10.0;
Zref 20.0;
z0 uniform 0.1;
zGround uniform 0.0;
}
\endverbatim
......@@ -121,22 +120,22 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField
//- Direction of the z-coordinate
vector z_;
//- Von Karman constant
//- von Karman constant
const scalar kappa_;
//- Reference velocity
const scalar Uref_;
//- Reference height
const scalar Href_;
const scalar Zref_;
//- Surface roughness length
//- Surface roughness height
scalarField z0_;
//- Minimum co-ordinate value in z direction
//- Minimum coordinate value in z direction
scalarField zGround_;
//- Frictional velocity
//- Friction velocity
scalarField Ustar_;
......@@ -206,13 +205,13 @@ public:
// Access
//- Return max value
//- Return friction velocity
const scalarField& Ustar() const
{
return Ustar_;
}
//- Return z direction
//- Return z-direction
const vector& z() const
{
return z_;
......
......@@ -46,14 +46,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
Ustar_(0),
n_(pTraits<vector>::zero),
z_(pTraits<vector>::zero),
z0_(0),
kappa_(0.41),
Uref_(0),
Href_(0),
zGround_(0)
Zref_(0),
z0_(0),
zGround_(0),
Ustar_(0)
{}
......@@ -67,14 +67,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
Ustar_(ptf.Ustar_, mapper),
n_(ptf.n_),
z_(ptf.z_),
z0_(ptf.z0_, mapper),
kappa_(ptf.kappa_),
Uref_(ptf.Uref_),
Href_(ptf.Href_),
zGround_(ptf.zGround_, mapper)
Zref_(ptf.Zref_),
z0_(ptf.z0_, mapper),
zGround_(ptf.zGround_, mapper),
Ustar_(ptf.Ustar_, mapper)
{}
......@@ -87,14 +87,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
Ustar_(p.size()),
n_(dict.lookup("n")),
z_(dict.lookup("z")),
z0_("z0", dict, p.size()),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
Uref_(readScalar(dict.lookup("Uref"))),
Href_(readScalar(dict.lookup("Href"))),
zGround_("zGround", dict, p.size())
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)
{
......@@ -115,7 +115,7 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
n_ /= mag(n_);
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
(
(Ustar_/kappa_)
......@@ -134,14 +134,14 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(blpvf, iF),
Ustar_(blpvf.Ustar_),
n_(blpvf.n_),
z_(blpvf.z_),
z0_(blpvf.z0_),
kappa_(blpvf.kappa_),
Uref_(blpvf.Uref_),
Href_(blpvf.Href_),
zGround_(blpvf.zGround_)
Zref_(blpvf.Zref_),
z0_(blpvf.z0_),
zGround_(blpvf.zGround_),
Ustar_(blpvf.Ustar_)
{}
......@@ -188,8 +188,8 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
<< kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Uref")
<< Uref_ << token::END_STATEMENT << nl;
os.writeKeyword("Href")
<< Href_ << token::END_STATEMENT << nl;
os.writeKeyword("Zref")
<< Zref_ << token::END_STATEMENT << nl;
zGround_.writeEntry("zGround", os) ;
writeEntry("value", os);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,34 +30,33 @@ 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 the direction of the parabolic
co-ordinate \c z.
friction velocity, flow direction and "vertical" direction.
\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]
where
\vartable
U^* | frictional velocity
K | Karman's constant
z | vertical co-ordinate [m]
z_0 | surface roughness length [m]
z_g | minimum vlaue in z direction [m]
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:
and
\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]
where:
where
\vartable
U_{ref} | reference velocity at \f$Z_{ref}\f$ [m/s]
Z_{ref} | reference height [m]
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
......@@ -67,27 +66,26 @@ Description
\heading Patch usage
\table
Property | Description | Required | Default value
n | flow direction | yes |
z | vertical direction of z-axis | yes |
kappa | Karman's constanat | no | 0.41
Uref | reference velocity [m/s] | yes |
Href | reference height [m] | yes |
z0 | surface roughness length [m] | yes |
zGround | minimum z co-ordinate [m] | yes |
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
Example of the boundary condition specification:
\verbatim
myPatch
ground
{
type atmBoundaryLayerInletVelocity;
n (0 1 0);
z (0 1 0);
kappa 0.41;
Uref 1.0;
Href 0.0;
z0 uniform 0.0;
n (1 0 0);
z (0 0 1);
Uref 10.0;
Zref 20.0;
z0 uniform 0.1;
zGround uniform 0.0;
}
\endverbatim
......@@ -126,30 +124,30 @@ class atmBoundaryLayerInletVelocityFvPatchVectorField
{
// Private data
//- Frictional velocity
scalarField Ustar_;
//- Flow direction
vector n_;
//- Direction of the z-coordinate
vector z_;
//- Surface roughness length
scalarField z0_;
//- Von Karman constant
//- von Karman constant
const scalar kappa_;
//- Reference velocity
const scalar Uref_;
//- Reference hight
const scalar Href_;
//- Reference height
const scalar Zref_;
//- Surface roughness height
scalarField z0_;
//- Minimum corrdinate value in z direction
//- Minimum coordinate value in z direction
scalarField zGround_;
//- Friction velocity
scalarField Ustar_;
public:
......@@ -217,7 +215,7 @@ public:
// Access
//- Return Ustar
//- Return friction velocity
const scalarField& Ustar() const
{
return Ustar_;
......@@ -229,7 +227,7 @@ public:
return n_;
}
//- Return z direction
//- Return z-direction
const vector& z() const
{
return z_;
......
......@@ -36,7 +36,7 @@ boundaryField
{
type atmBoundaryLayerInletVelocity;
Uref $Uref;
Href $Href;
Zref $Zref;
n $windDirection;
z $zDirection;
z0 $z0;
......
......@@ -45,7 +45,7 @@ boundaryField
{
type atmBoundaryLayerInletEpsilon;
Uref $Uref;
Href $Href;
Zref $Zref;
z $zDirection;
z0 $z0;
value $internalField;
......
......@@ -7,7 +7,7 @@
\*---------------------------------------------------------------------------*/
Uref 10.0;
Href 20;
Zref 20;
z0 uniform 0.1;
turbulentKE 1.3;
windDirection (1 0 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment