pressureDirectedInletOutletVelocityFvPatchVectorField.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) 2011-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::pressureDirectedInletOutletVelocityFvPatchVectorField
28 
29 Group
30  grpInletBoundaryConditions grpOutletBoundaryConditions
31 
32 Description
33  This velocity inlet/outlet boundary condition is applied to velocity
34  boundaries where the pressure is specified. A zero-gradient condition is
35  applied for outflow (as defined by the flux); for inflow, the velocity
36  is obtained from the flux with the specified inlet direction.
37 
38 Usage
39  \table
40  Property | Description | Required | Default value
41  phi | flux field name | no | phi
42  rho | density field name | no | rho
43  inletDirection | inlet direction per patch face | yes |
44  \endtable
45 
46  Example of the boundary condition specification:
47  \verbatim
48  <patchName>
49  {
50  type pressureDirectedInletOutletVelocity;
51  phi phi;
52  rho rho;
53  inletDirection uniform (1 0 0);
54  value uniform 0;
55  }
56  \endverbatim
57 
58 Note
59  Sign conventions:
60  - positive flux (out of domain): apply zero-gradient condition
61  - negative flux (into of domain): derive from the flux with specified
62  direction
63 
64 See also
65  Foam::mixedFvPatchVectorField
66 
67 SourceFiles
68  pressureDirectedInletOutletVelocityFvPatchVectorField.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef pressureDirectedInletOutletVelocityFvPatchVectorField_H
73 #define pressureDirectedInletOutletVelocityFvPatchVectorField_H
74 
75 #include "fvPatchFields.H"
76 #include "mixedFvPatchFields.H"
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 
83 /*---------------------------------------------------------------------------*\
84  Class pressureDirectedInletOutletVelocityFvPatchVectorField Declaration
85 \*---------------------------------------------------------------------------*/
86 
87 class pressureDirectedInletOutletVelocityFvPatchVectorField
88 :
89  public mixedFvPatchVectorField
90 {
91  // Private data
92 
93  //- Flux field name
94  word phiName_;
95 
96  //- Density field name
97  word rhoName_;
98 
99  //- Inlet direction
100  vectorField inletDir_;
101 
103 public:
104 
105  //- Runtime type information
106  TypeName("pressureDirectedInletOutletVelocity");
107 
108 
109  // Constructors
110 
111  //- Construct from patch and internal field
113  (
114  const fvPatch&,
116  );
117 
118  //- Construct from patch, internal field and dictionary
120  (
121  const fvPatch&,
123  const dictionary&
124  );
125 
126  //- Construct by mapping given
127  // pressureDirectedInletOutletVelocityFvPatchVectorField
128  // onto a new patch
130  (
132  const fvPatch&,
134  const fvPatchFieldMapper&
135  );
136 
137  //- Construct as copy
139  (
141  );
142 
143  //- Construct and return a clone
144  virtual tmp<fvPatchVectorField> clone() const
145  {
147  (
149  (
150  *this
151  )
152  );
153  }
154 
155  //- Construct as copy setting internal field reference
157  (
160  );
161 
162  //- Construct and return a clone setting internal field reference
164  (
166  ) const
167  {
169  (
171  (
172  *this,
173  iF
174  )
175  );
176  }
177 
179  // Member Functions
180 
181  //- True: this patch field is altered by assignment
182  virtual bool assignable() const { return true; }
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  }
198 
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
213 
214  //- Map (and resize as needed) from self given a mapping object
215  virtual void autoMap
216  (
217  const fvPatchFieldMapper&
218  );
219 
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();
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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 a number of values (eg...
Definition: dictionary.H:120
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:70
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A class for handling words, derived from Foam::string.
Definition: word.H:63
A FieldMapper for finite-volume patch fields.
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:55
This velocity inlet/outlet boundary condition is applied to velocity boundaries where the pressure is...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual bool assignable() const
True: this patch field is altered by assignment.
TypeName("pressureDirectedInletOutletVelocity")
Runtime type information.
Namespace for OpenFOAM.