fixedNormalInletOutletVelocityFvPatchVectorField.H
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) 2014-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::fixedNormalInletOutletVelocityFvPatchVectorField
28 
29 Group
30  grpInletBoundaryConditions grpOutletBoundaryConditions
31 
32 Description
33  This velocity inlet/outlet boundary condition combines a fixed normal
34  component obtained from the "normalVelocity" patchField supplied with a
35  fixed or zero-gradiented tangential component.
36 
37  The tangential component is set depending on the direction
38  of the flow and the setting of "fixTangentialInflow":
39  - Outflow: apply zero-gradient condition to tangential components
40  - Inflow:
41  - fixTangentialInflow is true
42  apply value provided by the normalVelocity patchField to the
43  tangential components
44  - fixTangentialInflow is false
45  apply zero-gradient condition to tangential components.
46 
47 Usage
48  \table
49  Property | Description | Required | Default value
50  phi | flux field name | no | phi
51  fixTangentialInflow | If true fix the tangential component for inflow | yes |
52  normalVelocity | patchField providing the normal velocity field | yes |
53  \endtable
54 
55  Example of the boundary condition specification:
56  \verbatim
57  <patchName>
58  {
59  type fixedNormalInletOutletVelocity;
60 
61  fixTangentialInflow false;
62  normalVelocity
63  {
64  type uniformFixedValue;
65  uniformValue sine;
66  uniformValueCoeffs
67  {
68  frequency 1;
69  amplitude table
70  (
71  (0 0)
72  (2 0.088)
73  (8 0.088)
74  );
75  scale (0 1 0);
76  level (0 0 0);
77  }
78  }
79 
80  value uniform (0 0 0);
81  }
82  \endverbatim
83 
84 SourceFiles
85  fixedNormalInletOutletVelocityFvPatchVectorField.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef fixedNormalInletOutletVelocityFvPatchVectorField_H
90 #define fixedNormalInletOutletVelocityFvPatchVectorField_H
91 
92 #include "fvPatchFields.H"
94 #include "Switch.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class fixedNormalInletOutletVelocityFvPatchVectorField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class fixedNormalInletOutletVelocityFvPatchVectorField
106 :
107  public directionMixedFvPatchVectorField
108 {
109 protected:
110 
111  // Protected data
112 
113  //- Flux field name
114  word phiName_;
115 
116  //- Set true to fix the tangential component for inflow
117  Switch fixTangentialInflow_;
118 
119  //- BC which provided the normal component of the velocity
120  tmp<fvPatchVectorField> normalVelocity_;
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("fixedNormalInletOutletVelocity");
127 
128 
129  // Constructors
130 
131  //- Construct from patch and internal field
133  (
134  const fvPatch&,
136  );
137 
138  //- Construct from patch, internal field and dictionary
140  (
141  const fvPatch&,
143  const dictionary&
144  );
145 
146  //- Construct by mapping given
147  // fixedNormalInletOutletVelocityFvPatchVectorField onto a new patch
149  (
151  const fvPatch&,
153  const fvPatchFieldMapper&
154  );
155 
156  //- Construct as copy
158  (
160  );
161 
162  //- Construct and return a clone
163  virtual tmp<fvPatchVectorField> clone() const
164  {
166  (
168  );
169  }
170 
171  //- Construct as copy setting internal field reference
173  (
176  );
177 
178  //- Construct and return a clone setting internal field reference
180  (
182  ) const
183  {
185  (
187  );
188  }
189 
190 
191  // Member functions
192 
193  // Attributes
194 
195  //- Return true: this patch field is altered by assignment
196  virtual bool assignable() const
197  {
198  return true;
199  }
200 
201 
202  // Access
203 
204  //- Return the name of phi
205  const word& phiName() const
206  {
207  return phiName_;
208  }
209 
210  //- Return reference to the name of phi to allow adjustment
211  word& phiName()
212  {
213  return phiName_;
214  }
215 
217  {
218  return fixTangentialInflow_;
219  }
220 
221  //- Return the BC which provides the normal component of velocity
222  const fvPatchVectorField& normalVelocity() const
223  {
224  return normalVelocity_();
225  }
226 
227 
228  // Mapping functions
229 
230  //- Map (and resize as needed) from self given a mapping object
231  virtual void autoMap
232  (
233  const fvPatchFieldMapper&
234  );
235 
236  //- Reverse map the given fvPatchField onto this fvPatchField
237  virtual void rmap
238  (
239  const fvPatchVectorField&,
240  const labelList&
241  );
242 
243 
244  //- Update the coefficients associated with the patch field
245  virtual void updateCoeffs();
246 
247  //- Write
248  virtual void write(Ostream&) const;
249 
250 
251  // Member operators
252 
253  virtual void operator=(const fvPatchField<vector>& pvf);
254 };
255 
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 } // End namespace Foam
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #endif
264 
265 // ************************************************************************* //
Foam::fvPatchField< vector >
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::rmap
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.C:141
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::phiName
const word & phiName() const
Return the name of phi.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:224
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::operator=
virtual void operator=(const fvPatchField< vector > &pvf)
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.C:201
directionMixedFvPatchFields.H
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::phiName_
word phiName_
Flux field name.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:133
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.C:155
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::fixTangentialInflow_
Switch fixTangentialInflow_
Set true to fix the tangential component for inflow.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:136
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Switch.H
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::normalVelocity_
tmp< fvPatchVectorField > normalVelocity_
BC which provided the normal component of the velocity.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:139
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::TypeName
TypeName("fixedNormalInletOutletVelocity")
Runtime type information.
Foam::fixedNormalInletOutletVelocityFvPatchVectorField
This velocity inlet/outlet boundary condition combines a fixed normal component obtained from the "no...
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:124
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.C:181
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::assignable
virtual bool assignable() const
Return true: this patch field is altered by assignment.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:215
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.C:131
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::phiName
word & phiName()
Return reference to the name of phi to allow adjustment.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:230
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::fixedNormalInletOutletVelocityFvPatchVectorField
fixedNormalInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.C:39
fvPatchFields.H
Foam::List< label >
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:182
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::fixTangentialInflow
Switch fixTangentialInflow() const
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:235
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::fixedNormalInletOutletVelocityFvPatchVectorField::normalVelocity
const fvPatchVectorField & normalVelocity() const
Return the BC which provides the normal component of velocity.
Definition: fixedNormalInletOutletVelocityFvPatchVectorField.H:241