pressureDirectedInletOutletVelocityFvPatchVectorField.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::pressureDirectedInletOutletVelocityFvPatchVectorField
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
31  is obtained from the flux with the specified inlet direction.
32 
33 Usage
34  \table
35  Property | Description | Required | Default value
36  phi | flux field name | no | phi
37  rho | density field name | no | rho
38  inletDirection | inlet direction per patch face | yes |
39  \endtable
40 
41  Example of the boundary condition specification:
42  \verbatim
43  <patchName>
44  {
45  type pressureDirectedInletOutletVelocity;
46  phi phi;
47  rho rho;
48  inletDirection uniform (1 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 with specified
57  direction
58 
59 See also
60  Foam::mixedFvPatchVectorField
61 
62 SourceFiles
63  pressureDirectedInletOutletVelocityFvPatchVectorField.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef pressureDirectedInletOutletVelocityFvPatchVectorField_H
68 #define pressureDirectedInletOutletVelocityFvPatchVectorField_H
69 
70 #include "fvPatchFields.H"
71 #include "mixedFvPatchFields.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 
78 /*---------------------------------------------------------------------------*\
79  Class pressureDirectedInletOutletVelocityFvPatchVectorField Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 class pressureDirectedInletOutletVelocityFvPatchVectorField
83 :
84  public mixedFvPatchVectorField
85 {
86  // Private data
87 
88  //- Flux field name
89  word phiName_;
90 
91  //- Density field name
92  word rhoName_;
93 
94  //- Inlet direction
95  vectorField inletDir_;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("pressureDirectedInletOutletVelocity");
102 
103 
104  // Constructors
105 
106  //- Construct from patch and internal field
108  (
109  const fvPatch&,
111  );
112 
113  //- Construct from patch, internal field and dictionary
115  (
116  const fvPatch&,
118  const dictionary&
119  );
120 
121  //- Construct by mapping given
122  // pressureDirectedInletOutletVelocityFvPatchVectorField
123  // onto a new patch
125  (
127  const fvPatch&,
129  const fvPatchFieldMapper&
130  );
131 
132  //- Construct as copy
134  (
136  );
137 
138  //- Construct and return a clone
139  virtual tmp<fvPatchVectorField> clone() const
140  {
142  (
144  (
145  *this
146  )
147  );
148  }
149 
150  //- Construct as copy setting internal field reference
152  (
155  );
156 
157  //- Construct and return a clone setting internal field reference
159  (
161  ) const
162  {
164  (
166  (
167  *this,
168  iF
169  )
170  );
171  }
172 
173 
174  // Member functions
175 
176  // Attributes
177 
178  //- Return true: this patch field is altered by assignment
179  virtual bool assignable() const
180  {
181  return true;
182  }
183 
184 
185  // Access
186 
187  //- Return the name of rho
188  const word& rhoName() const
189  {
190  return rhoName_;
191  }
192 
193  //- Return reference to the name of rho to allow adjustment
194  word& rhoName()
195  {
196  return rhoName_;
197  }
199  //- Return the name of phi
200  const word& phiName() const
201  {
202  return phiName_;
203  }
204 
205  //- Return reference to the name of phi to allow adjustment
206  word& phiName()
207  {
208  return phiName_;
209  }
210 
211 
212  // Mapping functions
214  //- Map (and resize as needed) from self given a mapping object
215  virtual void autoMap
216  (
217  const fvPatchFieldMapper&
218  );
220  //- Reverse map the given fvPatchField onto this fvPatchField
221  virtual void rmap
222  (
223  const fvPatchVectorField&,
224  const labelList&
225  );
226 
227 
228  //- Update the coefficients associated with the patch field
229  virtual void updateCoeffs();
230 
231  //- Write
232  virtual void write(Ostream&) const;
233 
234 
235  // Member operators
236 
237  virtual void operator=(const fvPatchField<vector>& pvf);
238 };
239 
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 } // End namespace Foam
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
pressureDirectedInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
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 void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is...
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
virtual bool assignable() const
Return true: this patch field is altered by assignment.
TypeName("pressureDirectedInletOutletVelocity")
Runtime type information.
Namespace for OpenFOAM.