phaseHydrostaticPressureFvPatchScalarField.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::phaseHydrostaticPressureFvPatchScalarField
26 
27 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  This boundary condition provides a phase-based hydrostatic pressure
32  condition, 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  The values are assigned according to the phase-fraction field:
48  - 1: apply \$fp_{hyd}\$f
49  - 0: apply a zero-gradient condition
50 
51  \heading Patch usage
52 
53  \table
54  Property | Description | Required | Default value
55  phaseName | phase field name | no | alpha
56  rho | density field name | no | rho
57  pRefValue | reference pressure [Pa] | yes |
58  pRefPoint | reference pressure location | yes |
59  \endtable
60 
61  Example of the boundary condition specification:
62  \verbatim
63  myPatch
64  {
65  type phaseHydrostaticPressure;
66  phaseName alpha1;
67  rho rho;
68  pRefValue 1e5;
69  pRefPoint (0 0 0);
70  value uniform 0; // optional initial value
71  }
72  \endverbatim
73 
74 SeeAlso
75  Foam::mixedFvPatchScalarField
76 
77 SourceFiles
78  phaseHydrostaticPressureFvPatchScalarField.C
79 
80 \*---------------------------------------------------------------------------*/
81 
82 #ifndef phaseHydrostaticPressureFvPatchScalarField_H
83 #define phaseHydrostaticPressureFvPatchScalarField_H
84 
85 #include "mixedFvPatchFields.H"
86 
87 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89 namespace Foam
90 {
91 
92 /*---------------------------------------------------------------------------*\
93  Class phaseHydrostaticPressureFvPatchScalarField Declaration
94 \*---------------------------------------------------------------------------*/
95 
96 class phaseHydrostaticPressureFvPatchScalarField
97 :
98  public mixedFvPatchScalarField
99 {
100 
101 protected:
102 
103  // Protected data
104 
105  //- Name of phase-fraction field
106  word phaseName_;
107 
108  //- Constant density in the far-field
109  scalar rho_;
110 
111  //- Reference pressure
112  scalar pRefValue_;
113 
114  //- Reference pressure location
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("phaseHydrostaticPressure");
122 
123 
124  // Constructors
125 
126  //- Construct from patch and internal field
128  (
129  const fvPatch&,
130  const DimensionedField<scalar, volMesh>&
131  );
132 
133  //- Construct from patch, internal field and dictionary
135  (
136  const fvPatch&,
137  const DimensionedField<scalar, volMesh>&,
138  const dictionary&
139  );
140 
141  //- Construct by mapping given
142  // phaseHydrostaticPressureFvPatchScalarField onto a new patch
144  (
146  const fvPatch&,
148  const fvPatchFieldMapper&
149  );
150 
151  //- Construct as copy
153  (
155  );
156 
157  //- Construct and return a clone
158  virtual tmp<fvPatchScalarField> clone() const
159  {
161  (
163  );
164  }
165 
166  //- Construct as copy setting internal field reference
168  (
171  );
172 
173  //- Construct and return a clone setting internal field reference
175  (
177  ) const
178  {
180  (
182  );
183  }
184 
185 
186  // Member functions
187 
188  // Access
189 
190  //- Return the phaseName
191  const word& phaseName() const
192  {
193  return phaseName_;
194  }
195 
196  //- Return reference to the phaseName to allow adjustment
197  word& phaseName()
198  {
199  return phaseName_;
200  }
201 
202  //- Return the constant density in the far-field
203  scalar rho() const
204  {
205  return rho_;
206  }
207 
208  //- Return reference to the constant density in the far-field
209  // to allow adjustment
210  scalar& rho()
211  {
212  return rho_;
213  }
214 
215  //- Return the reference pressure
216  scalar pRefValue() const
217  {
218  return pRefValue_;
219  }
221  //- Return reference to the reference pressure to allow adjustment
222  scalar& pRefValue()
223  {
224  return pRefValue_;
225  }
226 
227  //- Return the pressure reference location
228  const vector& pRefPoint() const
229  {
230  return pRefPoint_;
231  }
232 
233  //- Return reference to the pressure reference location
234  // to allow adjustment
235  vector& pRefPoint()
236  {
237  return pRefPoint_;
238  }
239 
240 
241  //- Update the coefficients associated with the patch field
242  virtual void updateCoeffs();
243 
244  //- Write
245  virtual void write(Ostream&) const;
246 
247 
248  // Member operators
249 
250  virtual void operator=(const fvPatchScalarField& pvf);
251 };
252 
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 } // End namespace Foam
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #endif
262 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
fvPatchField< scalar > fvPatchScalarField
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
A class for managing temporary objects.
Definition: PtrList.H:90
This boundary condition provides a phase-based hydrostatic pressure condition, calculated as: ...
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
scalar rho() const
Return the constant density in the far-field.
phaseHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
TypeName("phaseHydrostaticPressure")
Runtime type information.
const vector & pRefPoint() const
Return the pressure reference location.
Foam::fvPatchFieldMapper.