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 and return a clone
136  virtual tmp<fvPatchScalarField> clone() const
137  {
139  (
141  );
142  }
143 
144  //- Construct as copy setting internal field reference
146  (
149  );
150 
151  //- Construct and return a clone setting internal field reference
153  (
155  ) const
156  {
158  (
160  );
161  }
162 
163 
164  // Member functions
165 
166  // Access
167 
168  //- Return the ambient pressure
169  const scalarField& pa() const
170  {
171  return pa_;
172  }
173 
174  //- Return reference to the ambient pressure to allow adjustment
175  scalarField& pa()
176  {
177  return pa_;
178  }
179 
180 
181  // Mapping functions
182 
183  //- Map (and resize as needed) from self given a mapping object
184  virtual void autoMap
185  (
186  const fvPatchFieldMapper&
187  );
188 
189  //- Reverse map the given fvPatchField onto this fvPatchField
190  virtual void rmap
191  (
192  const fvPatchScalarField&,
193  const labelList&
194  );
195 
196 
197  // Evaluation functions
198 
199  //- Update the coefficients associated with the patch field
200  virtual void updateCoeffs();
201 
202 
203  //- Write
204  virtual void write(Ostream&) const;
205 };
206 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
216 // ************************************************************************* //
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 tmp< fvPatchScalarField > clone() const
Construct and return a clone.
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: ...
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...
Definition: areaFieldsFwd.H:42
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.