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 as copy setting internal field reference
145  (
148  );
149 
150  //- Return a clone
151  virtual tmp<fvPatchField<vector>> clone() const
152  {
153  return fvPatchField<vector>::Clone(*this);
154  }
155 
156  //- Clone with an internal field reference
158  (
160  ) const
161  {
162  return fvPatchField<vector>::Clone(*this, iF);
163  }
164 
165 
166  // Member Functions
167 
168  //- True: this patch field is altered by assignment
169  virtual bool assignable() const { return true; }
170 
171 
172  // Access
173 
174  //- Return the name of rho
175  const word& rhoName() const
176  {
177  return rhoName_;
178  }
179 
180  //- Return reference to the name of rho to allow adjustment
181  word& rhoName()
182  {
183  return rhoName_;
184  }
185 
186  //- Return the name of phi
187  const word& phiName() const
188  {
189  return phiName_;
190  }
191 
192  //- Return reference to the name of phi to allow adjustment
193  word& phiName()
194  {
195  return phiName_;
196  }
197 
198 
199  // Mapping functions
200 
201  //- Map (and resize as needed) from self given a mapping object
202  virtual void autoMap
203  (
204  const fvPatchFieldMapper&
205  );
206 
207  //- Reverse map the given fvPatchField onto this fvPatchField
208  virtual void rmap
209  (
210  const fvPatchVectorField&,
211  const labelList&
212  );
213 
214 
215  //- Update the coefficients associated with the patch field
216  virtual void updateCoeffs();
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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 a number of values (eg...
Definition: dictionary.H:129
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.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
A class for handling words, derived from Foam::string.
Definition: word.H:63
A FieldMapper for finite-volume patch fields.
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:56
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...
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.