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-2020 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/s^2]
42  \endtable
43 
44 Usage
45  \table
46  Property | Description | Required | Default value
47  rhoRef | Uniform density [kg/m^3] | 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  //- Disallow copy without setting internal field reference
137  (
139  ) = delete;
140 
141  //- Copy constructor setting internal field reference
143  (
146  );
147 
148  //- Construct and return a clone setting internal field reference
150  (
152  ) const
153  {
155  (
157  (
158  *this,
159  iF
160  )
161  );
162  }
163 
164 
165  // Member Functions
166 
167  // Access
168 
169  //- Return the constant density in the far-field
170  scalar rho() const
171  {
172  return rho_;
173  }
174 
175  //- Return reference to the constant density in the far-field
176  // to allow adjustment
177  scalar& rho()
178  {
179  return rho_;
180  }
181 
182  //- Return the reference pressure
183  scalar pRef() const
184  {
185  return pRef_;
186  }
187 
188  //- Return reference to the reference pressure to allow adjustment
189  scalar& pRef()
190  {
191  return pRef_;
192  }
193 
194  //- Return the pressure reference location
195  const vector& pRefPoint() const
196  {
197  return pRefPoint_;
198  }
199 
200  //- Return reference to the pressure reference location
201  // to allow adjustment
202  vector& pRefPoint()
203  {
204  return pRefPoint_;
205  }
206 
207 
208  // Evaluation functions
209 
210  //- Update the coefficients associated with the patch field
211  virtual void updateCoeffs();
212 
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
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:62
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:54
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
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.