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