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-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 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  //- Disallow copy without setting internal field reference
134  (
136  ) = delete;
137 
138  //- Copy constructor setting internal field reference
140  (
143  );
144 
145  //- Construct and return a clone setting internal field reference
147  (
149  ) const
150  {
152  (
154  (
155  *this,
156  iF
157  )
158  );
159  }
160 
161 
162  // Member Functions
163 
164  // Attributes
165 
166  //- Return true: this patch field is altered by assignment
167  virtual bool assignable() const
168  {
169  return true;
170  }
171 
172 
173  // Access
174 
175  //- Return the name of rho
176  const word& rhoName() const
177  {
178  return rhoName_;
179  }
180 
181  //- Return reference to the name of rho to allow adjustment
182  word& rhoName()
183  {
184  return rhoName_;
185  }
187  //- Return the name of phi
188  const word& phiName() const
189  {
190  return phiName_;
191  }
192 
193  //- Return reference to the name of phi to allow adjustment
194  word& phiName()
195  {
196  return phiName_;
197  }
198 
199 
200  // Mapping functions
202  //- Map (and resize as needed) from self given a mapping object
203  // Used to update fields following mesh topology change
204  virtual void autoMap(const fvPatchFieldMapper&);
205 
206  //- Reverse map the given fvPatchField onto this fvPatchField
207  // Used to reconstruct fields
208  virtual void rmap(const fvPatchVectorField&, const labelList&);
209 
210  //- Reset the fvPatchField to the given fvPatchField
211  // Used for mesh to mesh mapping
212  virtual void reset(const fvPatchVectorField&);
214 
215  //- Update the coefficients associated with the patch field
216  virtual void updateCoeffs();
217 
218  //- Write
219  virtual void write(Ostream&) const;
220 
221 
222  // Member Operators
223 
224  virtual void operator=(const fvPatchField<vector>& pvf);
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
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:156
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: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 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 DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
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:54
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
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.