interstitialInletVelocityFvPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "volFields.H"
29 #include "fvPatchFieldMapper.H"
30 #include "surfaceFields.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
36 (
37  const fvPatch& p,
39 )
40 :
41  fixedValueFvPatchVectorField(p, iF),
42  inletVelocity_(p.size(), Zero),
43  alphaName_("alpha")
44 {}
45 
46 
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
55  fixedValueFvPatchVectorField(p, iF, dict),
56  inletVelocity_("inletVelocity", dict, p.size()),
57  alphaName_(dict.lookupOrDefault<word>("alpha", "alpha"))
58 {}
59 
60 
63 (
65  const fvPatch& p,
67  const fvPatchFieldMapper& mapper
68 )
69 :
70  fixedValueFvPatchVectorField(ptf, p, iF, mapper),
71  inletVelocity_(mapper(ptf.inletVelocity_)),
72  alphaName_(ptf.alphaName_)
73 {}
74 
75 
78 (
81 )
82 :
83  fixedValueFvPatchVectorField(ptf, iF),
84  inletVelocity_(ptf.inletVelocity_),
85  alphaName_(ptf.alphaName_)
86 {}
87 
88 
89 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
90 
92 (
93  const fvPatchFieldMapper& m
94 )
95 {
96  fixedValueFvPatchVectorField::autoMap(m);
97  m(inletVelocity_, inletVelocity_);
98 }
99 
100 
102 (
103  const fvPatchVectorField& ptf,
104  const labelList& addr
105 )
106 {
107  fixedValueFvPatchVectorField::rmap(ptf, addr);
108 
110  refCast<const interstitialInletVelocityFvPatchVectorField>(ptf);
111 
112  inletVelocity_.rmap(tiptf.inletVelocity_, addr);
113 }
114 
115 
117 (
118  const fvPatchVectorField& ptf
119 )
120 {
121  fixedValueFvPatchVectorField::reset(ptf);
122 
124  refCast<const interstitialInletVelocityFvPatchVectorField>(ptf);
125 
126  inletVelocity_.reset(tiptf.inletVelocity_);
127 }
128 
129 
131 {
132  if (updated())
133  {
134  return;
135  }
136 
137  const fvPatchField<scalar>& alphap =
138  patch().lookupPatchField<volScalarField, scalar>(alphaName_);
139 
140  operator==(inletVelocity_/alphap);
141  fixedValueFvPatchVectorField::updateCoeffs();
142 }
143 
144 
146 {
148  writeEntryIfDifferent<word>(os, "alpha", "alpha", alphaName_);
149  writeEntry(os, "inletVelocity", inletVelocity_);
150  writeEntry(os, "value", *this);
151 }
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 namespace Foam
157 {
159  (
162  );
163 }
164 
165 
166 // ************************************************************************* //
Foam::surfaceFields.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:243
Macros for easy insertion into run-time selection tables.
interstitialInletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
static const zero Zero
Definition: zero.H:97
virtual label size() const
Return size.
Definition: fvPatch.H:157
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Inlet velocity in which the actual interstitial velocity is calculated by dividing the specified inle...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
Namespace for OpenFOAM.