uniformDensityHydrostaticPressureFvPatchScalarField.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-2018 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 Description
28  This boundary condition provides a hydrostatic pressure condition,
29  calculated as:
30 
31  \f[
32  p_{hyd} = p_{ref} + \rho_{ref} g (x - x_{ref})
33  \f]
34 
35  where
36  \vartable
37  p_{hyd} | Hydrostatic pressure [Pa]
38  p_{ref} | Reference pressure [Pa]
39  x_{ref} | Reference point in Cartesian co-ordinates
40  \rho_{ref} | Density (assumed uniform)
41  g | Acceleration due to gravity [m/s2]
42  \endtable
43 
44 Usage
45  \table
46  Property | Description | Required | Default value
47  rhoRef | Uniform density [kg/m3] | yes |
48  pRef | Reference pressure [Pa] | yes |
49  pRefPoint | Reference pressure location | no | hRef
50  value | Initial value | no | pRef
51  \endtable
52 
53  Example of the boundary condition specification:
54  \verbatim
55  <patchName>
56  {
57  type uniformDensityHydrostaticPressure;
58  rhoRef 1000;
59  pRef 1e5;
60  pRefPoint (0 0 0);
61  }
62  \endverbatim
63 
64 SourceFiles
65  uniformDensityHydrostaticPressureFvPatchScalarField.C
66 
67 \*---------------------------------------------------------------------------*/
68 
69 #ifndef uniformDensityHydrostaticPressureFvPatchScalarField_H
70 #define uniformDensityHydrostaticPressureFvPatchScalarField_H
71 
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
76 namespace Foam
77 {
78 
79 /*---------------------------------------------------------------------------*\
80  Class uniformDensityHydrostaticPressureFvPatchScalarField Declaration
81 \*---------------------------------------------------------------------------*/
82 
83 class uniformDensityHydrostaticPressureFvPatchScalarField
84 :
85  public fixedValueFvPatchScalarField
86 {
87  // Private data
88 
89  //- Constant density in the far-field
90  scalar rho_;
91 
92  //- Reference pressure
93  scalar pRef_;
94 
95  //- True if the reference pressure location is specified
96  bool pRefPointSpecified_;
97 
98  //- Optional 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 pRef() const
193  {
194  return pRef_;
195  }
196 
197  //- Return reference to the reference pressure to allow adjustment
198  scalar& pRef()
199  {
200  return pRef_;
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
218 
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
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #endif
235 
236 // ************************************************************************* //
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
TypeName("uniformDensityHydrostaticPressure")
Runtime type information.
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.
const vector & pRefPoint() const
Return the pressure reference location.
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:53
Namespace for OpenFOAM.