1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
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"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 namespace incompressible
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 atmBoundaryLayerInletEpsilonFvPatchScalarField::
43 atmBoundaryLayerInletEpsilonFvPatchScalarField
46 const DimensionedField<scalar, volMesh>& iF
49 fixedValueFvPatchScalarField(p, iF),
51 z_(pTraits<vector>::zero),
58 atmBoundaryLayerInletEpsilonFvPatchScalarField::
59 atmBoundaryLayerInletEpsilonFvPatchScalarField
61 const atmBoundaryLayerInletEpsilonFvPatchScalarField& ptf,
63 const DimensionedField<scalar, volMesh>& iF,
64 const fvPatchFieldMapper& mapper
67 fixedValueFvPatchScalarField(ptf, p, iF, mapper),
72 zGround_(ptf.zGround_)
76 atmBoundaryLayerInletEpsilonFvPatchScalarField::
77 atmBoundaryLayerInletEpsilonFvPatchScalarField
80 const DimensionedField<scalar, volMesh>& iF,
81 const dictionary& dict
84 fixedValueFvPatchScalarField(p, iF),
85 Ustar_(readScalar(dict.lookup("Ustar"))),
87 z0_(readScalar(dict.lookup("z0"))),
88 kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
89 zGround_(readScalar(dict.lookup("zGround")))
95 "atmBoundaryLayerInletEpsilonFvPatchScalarField"
98 "const DimensionedField<scalar, volMesh>&, "
102 << "magnitude of z vector must be greater than zero"
103 << abort(FatalError);
112 atmBoundaryLayerInletEpsilonFvPatchScalarField::
113 atmBoundaryLayerInletEpsilonFvPatchScalarField
115 const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf,
116 const DimensionedField<scalar, volMesh>& iF
119 fixedValueFvPatchScalarField(blpsf, iF),
120 Ustar_(blpsf.Ustar_),
123 kappa_(blpsf.kappa_),
124 zGround_(blpsf.zGround_)
128 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs()
132 const vectorField& c = patch().Cf();
133 tmp<scalarField> coord = (c & z_);
134 scalarField::operator=(pow3(Ustar_)/(kappa_*(coord - zGround_ + z0_)));
138 void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
140 fvPatchScalarField::write(os);
141 os.writeKeyword("Ustar")
142 << Ustar_ << token::END_STATEMENT << nl;
144 << z_ << token::END_STATEMENT << nl;
145 os.writeKeyword("z0")
146 << z0_ << token::END_STATEMENT << nl;
147 os.writeKeyword("kappa")
148 << kappa_ << token::END_STATEMENT << nl;
149 os.writeKeyword("zGround")
150 << zGround_ << token::END_STATEMENT << nl;
151 writeEntry("value", os);
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 atmBoundaryLayerInletEpsilonFvPatchScalarField
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 } // End namespace incompressible
166 } // End namespace Foam
168 // ************************************************************************* //