atmBoundaryLayerInletVelocityFvPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2018 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
31 #include "fvPatchFieldMapper.H"
32 #include "volFields.H"
33 #include "surfaceFields.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
44 (
45  const fvPatch& p,
47 )
48 :
49  inletOutletFvPatchVectorField(p, iF),
50  atmBoundaryLayer(iF.time(), p.patch())
51 {}
52 
53 
56 (
57  const fvPatch& p,
59  const dictionary& dict
60 )
61 :
62  inletOutletFvPatchVectorField(p, iF),
63  atmBoundaryLayer(iF.time(), p.patch(), dict)
64 {
65  phiName_ = dict.getOrDefault<word>("phi", "phi");
66 
67  refValue() = U(patch().Cf());
68  refGrad() = Zero;
69  valueFraction() = 1;
70 
71  if (!initABL_)
72  {
73  vectorField::operator=(vectorField("value", dict, p.size()));
74  }
75  else
76  {
77  vectorField::operator=(refValue());
78  initABL_ = false;
79  }
80 }
81 
82 
85 (
86  const atmBoundaryLayerInletVelocityFvPatchVectorField& pvf,
87  const fvPatch& p,
88  const DimensionedField<vector, volMesh>& iF,
89  const fvPatchFieldMapper& mapper
90 )
91 :
92  inletOutletFvPatchVectorField(pvf, p, iF, mapper),
93  atmBoundaryLayer(pvf, p, mapper)
94 {}
95 
96 
99 (
102 )
103 :
104  inletOutletFvPatchVectorField(pvf, iF),
105  atmBoundaryLayer(pvf)
106 {}
107 
108 
109 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110 
112 {
113  if (updated())
114  {
115  return;
116  }
117 
118  refValue() = U(patch().Cf());
119 
120  inletOutletFvPatchVectorField::updateCoeffs();
121 }
122 
123 
125 (
126  const fvPatchFieldMapper& m
127 )
128 {
129  inletOutletFvPatchVectorField::autoMap(m);
131 }
132 
133 
135 (
136  const fvPatchVectorField& pvf,
137  const labelList& addr
138 )
139 {
140  inletOutletFvPatchVectorField::rmap(pvf, addr);
141 
143  refCast<const atmBoundaryLayerInletVelocityFvPatchVectorField>(pvf);
144 
145  atmBoundaryLayer::rmap(blpvf, addr);
146 }
147 
148 
150 {
152  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
154  writeEntry("value", os);
155 }
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
161 (
163  atmBoundaryLayerInletVelocityFvPatchVectorField
164 );
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // ************************************************************************* //
Foam::surfaceFields.
dictionary dict
Base class to set log-law type ground-normal inlet boundary conditions for wind velocity and turbulen...
fvPatchField< vector > fvPatchVectorField
void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:68
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:333
Macros for easy insertion into run-time selection tables.
A class for handling words, derived from Foam::string.
Definition: word.H:63
tmp< vectorField > U(const vectorField &pCf) const
Return the velocity distribution for the ATM.
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A FieldMapper for finite-volume patch fields.
void write(Ostream &) const
Write.
bool initABL_
Flag to initialise profiles with the theoretical ABL expressions, otherwise initialises by using "val...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
OBJstream os(runTime.globalPath()/outputName)
void operator=(const Field< vector > &)
Copy assignment.
Definition: Field.C:671
atmBoundaryLayerInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
const Time & time() const
Return Time associated with the objectRegistry.
Definition: IOobject.C:447
This boundary condition provides a log-law type ground-normal inlet boundary condition for the stream...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
const std::string patch
OpenFOAM patch number as a std::string.
void rmap(const atmBoundaryLayer &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
volScalarField & p
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:157