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