1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "atmBoundaryLayerInletEpsilonFvPatchScalarField.H"
28 #include "addToRunTimeSelectionTable.H"
29 #include "fvPatchFieldMapper.H"
30 #include "volFields.H"
31 #include "surfaceFields.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 namespace incompressible
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 atmBoundaryLayerInletEpsilonFvPatchScalarField::
44 atmBoundaryLayerInletEpsilonFvPatchScalarField
47 const DimensionedField<scalar, volMesh>& iF
50 fixedValueFvPatchScalarField(p, iF),
52 z_(pTraits<vector>::zero),
59 atmBoundaryLayerInletEpsilonFvPatchScalarField::
60 atmBoundaryLayerInletEpsilonFvPatchScalarField
62 const atmBoundaryLayerInletEpsilonFvPatchScalarField& ptf,
64 const DimensionedField<scalar, volMesh>& iF,
65 const fvPatchFieldMapper& mapper
68 fixedValueFvPatchScalarField(ptf, p, iF, mapper),
73 zGround_(ptf.zGround_)
77 atmBoundaryLayerInletEpsilonFvPatchScalarField::
78 atmBoundaryLayerInletEpsilonFvPatchScalarField
81 const DimensionedField<scalar, volMesh>& iF,
82 const dictionary& dict
85 fixedValueFvPatchScalarField(p, iF),
86 Ustar_(readScalar(dict.lookup("Ustar"))),
88 z0_(readScalar(dict.lookup("z0"))),
89 kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
90 zGround_(p.size(), 0.0)
96 "atmBoundaryLayerInletEpsilonFvPatchScalarField"
99 "const DimensionedField<scalar, volMesh>&, "
103 << "magnitude of z vector must be greater than zero"
104 << abort(FatalError);
113 atmBoundaryLayerInletEpsilonFvPatchScalarField::
114 atmBoundaryLayerInletEpsilonFvPatchScalarField
116 const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf,
117 const DimensionedField<scalar, volMesh>& iF
120 fixedValueFvPatchScalarField(blpsf, iF),
121 Ustar_(blpsf.Ustar_),
124 kappa_(blpsf.kappa_),
125 zGround_(blpsf.zGround_)
129 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
131 void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs()
133 const vectorField& c = patch().Cf();
134 const scalarField coord(c & z_);
136 scalarField::operator=(pow3(Ustar_)/(kappa_*(coord - zGround_ + z0_)));
140 void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
142 fvPatchScalarField::write(os);
143 os.writeKeyword("Ustar")
144 << Ustar_ << token::END_STATEMENT << nl;
146 << z_ << token::END_STATEMENT << nl;
147 os.writeKeyword("z0")
148 << z0_ << token::END_STATEMENT << nl;
149 os.writeKeyword("kappa")
150 << kappa_ << token::END_STATEMENT << nl;
151 os.writeKeyword("zGround")
152 << zGround_ << token::END_STATEMENT << nl;
153 writeEntry("value", os);
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 atmBoundaryLayerInletEpsilonFvPatchScalarField
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 } // End namespace incompressible
168 } // End namespace Foam
170 // ************************************************************************* //