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-2023 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, internal field and dictionary
108  (
109  const fvPatch&,
111  const dictionary&
112  );
113 
114  //- Construct by mapping given
115  // pressureDirectedInletOutletVelocityFvPatchVectorField
116  // onto a new patch
118  (
120  const fvPatch&,
122  const fvPatchFieldMapper&
123  );
124 
125  //- Disallow copy without setting internal field reference
127  (
129  ) = delete;
130 
131  //- Copy constructor setting internal field reference
133  (
136  );
137 
138  //- Construct and return a clone setting internal field reference
140  (
142  ) const
143  {
145  (
147  (
148  *this,
149  iF
150  )
151  );
152  }
153 
154 
155  // Member Functions
156 
157  // Attributes
158 
159  //- Return true: this patch field is altered by assignment
160  virtual bool assignable() const
161  {
162  return true;
163  }
164 
165 
166  // Access
167 
168  //- Return the name of rho
169  const word& rhoName() const
170  {
171  return rhoName_;
172  }
173 
174  //- Return reference to the name of rho to allow adjustment
175  word& rhoName()
176  {
177  return rhoName_;
178  }
179 
180  //- Return the name of phi
181  const word& phiName() const
182  {
183  return phiName_;
184  }
185 
186  //- Return reference to the name of phi to allow adjustment
187  word& phiName()
188  {
189  return phiName_;
190  }
191 
192 
193  // Mapping functions
194 
195  //- Map the given fvPatchField onto this fvPatchField
196  virtual void map
197  (
198  const fvPatchVectorField&,
199  const fvPatchFieldMapper&
200  );
201 
202  //- Reset the fvPatchField to the given fvPatchField
203  // Used for mesh to mesh mapping
204  virtual void reset(const fvPatchVectorField&);
205 
206 
207  //- Update the coefficients associated with the patch field
208  virtual void updateCoeffs();
209 
210  //- Write
211  virtual void write(Ostream&) const;
212 
213 
214  // Member Operators
215 
216  virtual void operator=(const fvPatchField<vector>& pvf);
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is...
virtual tmp< fvPatchVectorField > clone(const DimensionedField< vector, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void map(const fvPatchVectorField &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
TypeName("pressureDirectedInletOutletVelocity")
Runtime type information.
pressureDirectedInletOutletVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void reset(const fvPatchVectorField &)
Reset the fvPatchField to the given fvPatchField.
virtual bool assignable() const
Return true: this patch field is altered by assignment.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
Field< vector > vectorField
Specialisation of Field<T> for vector.