freeSurfacePressureFvPatchScalarField.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) 2019 Zeljko Tukovic, FSB Zagreb.
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::freeSurfacePressureFvPatchScalarField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This boundary condition provides static pressure condition for p_rgh,
34  calculated as:
35 
36  \f[
37  p = pa - \vec{g} \cdot \vec{r}
38  \f]
39 
40  where
41  \vartable
42  p | Free surface modified pressure
43  pa | Free surface ambient pressure
44  g | acceleration due to gravity [m/s^2]
45  \endtable
46 
47 Usage
48  \table
49  Property | Description | Required | Default value
50  pa | static ambient pressure | yes | 0
51  \endtable
52 
53  Example of the boundary condition specification:
54  \verbatim
55  <patchName>
56  {
57  type freeSurfacePressure;
58  pa uniform 0;
59  value uniform 0; // optional initial value
60  }
61  \endverbatim
62 
63 See also
64  Foam::fixedValueFvPatchScalarField
65 
66 SourceFiles
67  freeSurfacePressureFvPatchScalarField.C
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef freeSurfacePressureFvPatchScalarField_H
72 #define freeSurfacePressureFvPatchScalarField_H
73 
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 namespace Foam
79 {
80 
81 /*---------------------------------------------------------------------------*\
82  Class freeSurfacePressureFvPatchScalarField Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class freeSurfacePressureFvPatchScalarField
86 :
87  public fixedValueFvPatchScalarField
88 {
89 protected:
90 
91  // Protected data
92 
93  //- Ambient pressure
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("freeSurfacePressure");
100 
101 
102  // Constructors
103 
104  //- Construct from patch and internal field
106  (
107  const fvPatch&,
109  );
110 
111  //- Construct from patch, internal field and dictionary
113  (
114  const fvPatch&,
116  const dictionary&
117  );
118 
119  //- Construct by mapping given
120  // freeSurfacePressureFvPatchScalarField onto a new patch
122  (
124  const fvPatch&,
126  const fvPatchFieldMapper&
127  );
128 
129  //- Construct as copy
131  (
133  );
134 
135  //- Construct as copy setting internal field reference
137  (
140  );
141 
142  //- Return a clone
143  virtual tmp<fvPatchField<scalar>> clone() const
144  {
145  return fvPatchField<scalar>::Clone(*this);
146  }
147 
148  //- Clone with an internal field reference
150  (
152  ) const
153  {
154  return fvPatchField<scalar>::Clone(*this, iF);
155  }
156 
157 
158  // Member functions
159 
160  // Access
161 
162  //- Return the ambient pressure
163  const scalarField& pa() const
164  {
165  return pa_;
166  }
167 
168  //- Return reference to the ambient pressure to allow adjustment
169  scalarField& pa()
170  {
171  return pa_;
172  }
173 
174 
175  // Mapping functions
176 
177  //- Map (and resize as needed) from self given a mapping object
178  virtual void autoMap
179  (
180  const fvPatchFieldMapper&
181  );
182 
183  //- Reverse map the given fvPatchField onto this fvPatchField
184  virtual void rmap
185  (
187  const labelList&
188  );
189 
190 
191  // Evaluation functions
192 
193  //- Update the coefficients associated with the patch field
194  virtual void updateCoeffs();
195 
196 
197  //- Write
198  virtual void write(Ostream&) const;
199 };
200 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
210 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
TypeName("freeSurfacePressure")
Runtime type information.
This boundary condition provides static pressure condition for p_rgh, calculated as: ...
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
freeSurfacePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
const scalarField & pa() const
Return the ambient pressure.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
Namespace for OpenFOAM.