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  }
220 
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
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 } // End namespace Foam
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #endif
261 
262 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Foam::fvPatchScalarField
fvPatchField< scalar > fvPatchScalarField
Definition: fvPatchFieldsFwd.H:38
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::phaseHydrostaticPressureFvPatchScalarField::TypeName
TypeName("phaseHydrostaticPressure")
Runtime type information.
Foam::phaseHydrostaticPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:202
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefPoint
const vector & pRefPoint() const
Return the pressure reference location.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:272
Foam::phaseHydrostaticPressureFvPatchScalarField::rho
scalar rho() const
Return the constant density in the far-field.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:247
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefPoint_
vector pRefPoint_
Reference pressure location.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:159
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseName
word & phaseName()
Return reference to the phaseName to allow adjustment.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:241
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefValue
scalar pRefValue() const
Return the reference pressure.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:260
Foam::phaseHydrostaticPressureFvPatchScalarField
This boundary condition provides a phase-based hydrostatic pressure condition, calculated as:
Definition: phaseHydrostaticPressureFvPatchScalarField.H:140
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefValue
scalar & pRefValue()
Return reference to the reference pressure to allow adjustment.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:266
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseHydrostaticPressureFvPatchScalarField
phaseHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: phaseHydrostaticPressureFvPatchScalarField.C:37
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
mixedFvPatchFields.H
Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: phaseHydrostaticPressureFvPatchScalarField.C:132
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseName
const word & phaseName() const
Return the phaseName.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:235
Foam::Vector< scalar >
Foam::phaseHydrostaticPressureFvPatchScalarField::rho_
scalar rho_
Constant density in the far-field.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:153
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefValue_
scalar pRefValue_
Reference pressure.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:156
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseName_
word phaseName_
Name of phase-fraction field.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:150
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::phaseHydrostaticPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: phaseHydrostaticPressureFvPatchScalarField.C:161
Foam::phaseHydrostaticPressureFvPatchScalarField::operator=
virtual void operator=(const fvPatchScalarField &pvf)
Definition: phaseHydrostaticPressureFvPatchScalarField.C:179
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51