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-2023 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, internal field and dictionary
112  (
113  const fvPatch&,
114  const DimensionedField<scalar, volMesh>&,
115  const dictionary&
116  );
117 
118  //- Construct by mapping given
119  // uniformDensityHydrostaticPressureFvPatchScalarField onto a new patch
121  (
123  const fvPatch&,
124  const DimensionedField<scalar, volMesh>&,
125  const fieldMapper&
126  );
127 
128  //- Disallow copy without setting internal field reference
130  (
132  ) = delete;
133 
134  //- Copy constructor setting internal field reference
136  (
139  );
140 
141  //- Construct and return a clone setting internal field reference
143  (
145  ) const
146  {
148  (
150  (
151  *this,
152  iF
153  )
154  );
155  }
156 
157 
158  // Member Functions
159 
160  // Access
161 
162  //- Return the constant density in the far-field
163  scalar rho() const
164  {
165  return rho_;
166  }
167 
168  //- Return reference to the constant density in the far-field
169  // to allow adjustment
170  scalar& rho()
171  {
172  return rho_;
173  }
174 
175  //- Return the reference pressure
176  scalar pRef() const
177  {
178  return pRef_;
179  }
180 
181  //- Return reference to the reference pressure to allow adjustment
182  scalar& pRef()
183  {
184  return pRef_;
185  }
186 
187  //- Return the pressure reference location
188  const vector& pRefPoint() const
189  {
190  return pRefPoint_;
191  }
192 
193  //- Return reference to the pressure reference location
194  // to allow adjustment
195  vector& pRefPoint()
196  {
197  return pRefPoint_;
198  }
199 
200 
201  // Evaluation functions
202 
203  //- Update the coefficients associated with the patch field
204  virtual void updateCoeffs();
205 
206 
207  //- Write
208  virtual void write(Ostream&) const;
209 };
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A class for managing temporary objects.
Definition: tmp.H:55
This boundary condition provides a hydrostatic pressure condition, calculated as:
uniformDensityHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("uniformDensityHydrostaticPressure")
Runtime type information.
Namespace for OpenFOAM.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49