pressureInletOutletVelocityFvPatchVectorField.H
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) 2011-2018 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 Class
25  Foam::pressureInletOutletVelocityFvPatchVectorField
26 
27 Description
28  This velocity inlet/outlet boundary condition is applied to pressure
29  boundaries where the pressure is specified. A zero-gradient condition is
30  applied for outflow (as defined by the flux); for inflow, the velocity is
31  obtained from the patch-face normal component of the internal-cell value.
32 
33  The tangential patch velocity can be optionally specified.
34 
35 Usage
36  \table
37  Property | Description | Required | Default value
38  phi | flux field name | no | phi
39  tangentialVelocity | tangential velocity field | no |
40  \endtable
41 
42  Example of the boundary condition specification:
43  \verbatim
44  <patchName>
45  {
46  type pressureInletOutletVelocity;
47  phi phi;
48  tangentialVelocity uniform (0 0 0);
49  value uniform 0;
50  }
51  \endverbatim
52 
53 Note
54  Sign conventions:
55  - positive flux (out of domain): apply zero-gradient condition
56  - negative flux (into of domain): derive from the flux in the patch-normal
57  direction
58 
59 SourceFiles
60  pressureInletOutletVelocityFvPatchVectorField.C
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef pressureInletOutletVelocityFvPatchVectorField_H
65 #define pressureInletOutletVelocityFvPatchVectorField_H
66 
67 #include "fvPatchFields.H"
69 
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 
72 namespace Foam
73 {
74 
75 /*---------------------------------------------------------------------------*\
76  Class pressureInletOutletVelocityFvPatchVectorField Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 class pressureInletOutletVelocityFvPatchVectorField
80 :
81  public directionMixedFvPatchVectorField
82 {
83  // Private data
84 
85  //- Flux field name
86  word phiName_;
87 
88  //- Optional tangential velocity component
89  vectorField tangentialVelocity_;
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("pressureInletOutletVelocity");
96 
97 
98  // Constructors
99 
100  //- Construct from patch and internal field
102  (
103  const fvPatch&,
105  );
106 
107  //- Construct from patch, internal field and dictionary
109  (
110  const fvPatch&,
112  const dictionary&
113  );
114 
115  //- Construct by mapping given
116  // pressureInletOutletVelocityFvPatchVectorField onto a new patch
118  (
120  const fvPatch&,
122  const fvPatchFieldMapper&
123  );
124 
125  //- Construct as copy
127  (
129  );
130 
131  //- Construct and return a clone
132  virtual tmp<fvPatchVectorField> clone() const
133  {
135  (
137  );
138  }
139 
140  //- Construct as copy setting internal field reference
142  (
145  );
147  //- Construct and return a clone setting internal field reference
149  (
151  ) const
152  {
154  (
156  );
157  }
158 
159 
160  // Member functions
161 
162  // Attributes
164  //- Return true: this patch field is altered by assignment
165  virtual bool assignable() const
166  {
167  return true;
168  }
169 
170 
171  // Access
172 
173  //- Return the name of phi
174  const word& phiName() const
175  {
176  return phiName_;
177  }
178 
179  //- Return reference to the name of phi to allow adjustment
180  word& phiName()
181  {
182  return phiName_;
183  }
184 
185  //- Return the tangential velocity
186  const vectorField& tangentialVelocity() const
187  {
188  return tangentialVelocity_;
189  }
190 
191  //- Reset the tangential velocity
193 
195  // Mapping functions
196 
197  //- Map (and resize as needed) from self given a mapping object
198  virtual void autoMap
199  (
201  );
202 
203  //- Reverse map the given fvPatchField onto this fvPatchField
204  virtual void rmap
205  (
206  const fvPatchVectorField&,
207  const labelList&
208  );
209 
210 
211  //- Update the coefficients associated with the patch field
212  virtual void updateCoeffs();
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 
217 
218  // Member operators
219 
220  virtual void operator=(const fvPatchField<vector>& pvf);
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
virtual bool assignable() const
Return true: this patch field is altered by assignment.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
pressureInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const vectorField & tangentialVelocity() const
Return the tangential velocity.
This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is...
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
TypeName("pressureInletOutletVelocity")
Runtime type information.
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
void setTangentialVelocity(const vectorField &tangentialVelocity)
Reset the tangential velocity.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.