uniformDensityHydrostaticPressureFvPatchScalarField.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 | Copyright (C) 2011-2016 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::uniformDensityHydrostaticPressureFvPatchScalarField
26 
27 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  This boundary condition provides a hydrostatic pressure condition,
32  calculated as:
33 
34  \f[
35  p_{hyd} = p_{ref} + \rho g (x - x_{ref})
36  \f]
37 
38  where
39  \vartable
40  p_{hyd} | hyrostatic pressure [Pa]
41  p_{ref} | reference pressure [Pa]
42  x_{ref} | reference point in Cartesian co-ordinates
43  \rho | density (assumed uniform)
44  g | acceleration due to gravity [m/s2]
45  \endtable
46 
47 Usage
48  \table
49  Property | Description | Required | Default value
50  rho | uniform density [kg/m3] | yes |
51  pRefValue | reference pressure [Pa] | yes |
52  pRefPoint | reference pressure location | yes |
53  \endtable
54 
55  Example of the boundary condition specification:
56  \verbatim
57  <patchName>
58  {
59  type uniformDensityHydrostaticPressure;
60  rho rho;
61  pRefValue 1e5;
62  pRefPoint (0 0 0);
63  value uniform 0; // optional initial value
64  }
65  \endverbatim
66 
67 SourceFiles
68  uniformDensityHydrostaticPressureFvPatchScalarField.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef uniformDensityHydrostaticPressureFvPatchScalarField_H
73 #define uniformDensityHydrostaticPressureFvPatchScalarField_H
74 
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class uniformDensityHydrostaticPressureFvPatchScalarField Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 class uniformDensityHydrostaticPressureFvPatchScalarField
87 :
88  public fixedValueFvPatchScalarField
89 {
90  // Private data
91 
92  //- Constant density in the far-field
93  scalar rho_;
94 
95  //- Reference pressure
96  scalar pRefValue_;
97 
98  //- Reference pressure location
99  vector pRefPoint_;
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("uniformDensityHydrostaticPressure");
106 
107 
108  // Constructors
109 
110  //- Construct from patch and internal field
112  (
113  const fvPatch&,
114  const DimensionedField<scalar, volMesh>&
115  );
116 
117  //- Construct from patch, internal field and dictionary
119  (
120  const fvPatch&,
121  const DimensionedField<scalar, volMesh>&,
122  const dictionary&
123  );
124 
125  //- Construct by mapping given
126  // uniformDensityHydrostaticPressureFvPatchScalarField onto a new patch
128  (
130  const fvPatch&,
132  const fvPatchFieldMapper&
133  );
134 
135  //- Construct as copy
137  (
139  );
140 
141  //- Construct and return a clone
142  virtual tmp<fvPatchScalarField> clone() const
143  {
145  (
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  // Access
177 
178  //- Return the constant density in the far-field
179  scalar rho() const
180  {
181  return rho_;
182  }
183 
184  //- Return reference to the constant density in the far-field
185  // to allow adjustment
186  scalar& rho()
187  {
188  return rho_;
189  }
190 
191  //- Return the reference pressure
192  scalar pRefValue() const
193  {
194  return pRefValue_;
195  }
196 
197  //- Return reference to the reference pressure to allow adjustment
198  scalar& pRefValue()
199  {
200  return pRefValue_;
201  }
202 
203  //- Return the pressure reference location
204  const vector& pRefPoint() const
205  {
206  return pRefPoint_;
207  }
208 
209  //- Return reference to the pressure reference location
210  // to allow adjustment
211  vector& pRefPoint()
212  {
213  return pRefPoint_;
214  }
215 
216 
217  // Evaluation functions
219  //- Update the coefficients associated with the patch field
220  virtual void updateCoeffs();
221 
222 
223  //- Write
224  virtual void write(Ostream&) const;
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
TypeName("uniformDensityHydrostaticPressure")
Runtime type information.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
This boundary condition provides a hydrostatic pressure condition, calculated as: ...
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
uniformDensityHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:54
const vector & pRefPoint() const
Return the pressure reference location.
Namespace for OpenFOAM.