waveSurfacePressureFvPatchScalarField.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-2016 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::waveSurfacePressureFvPatchScalarField
26 
27 Group
28  grpInletBoundaryConditions
29 
30 Description
31  This is a pressure boundary condition, whose value is calculated as
32  the hydrostatic pressure based on a given displacement:
33 
34  \f[
35  p = -\rho*g*\zeta
36  \f]
37 
38  \vartable
39  \rho | density [kg/m3]
40  g | acceleration due to gravity [m/s2]
41  \zeta | wave amplitude [m]
42  \endvartable
43 
44  The wave amplitude is updated as part of the calculation, derived from the
45  local volumetric flux.
46 
47 Usage
48  \table
49  Property | Description | Required | Default value
50  phi | flux field name | no | phi
51  rho | density field name | no | rho
52  zeta | wave amplitude field name | no | zeta
53  \endtable
54 
55  Example of the boundary condition specification:
56  \verbatim
57  <patchName>
58  {
59  type waveSurfacePressure;
60  phi phi;
61  rho rho;
62  zeta zeta;
63  value uniform 0; // place holder
64  }
65  \endverbatim
66 
67  The density field is only required if the flux is mass-based as opposed to
68  volumetric-based.
69 
70 See also
71  Foam::fixedValueFvPatchField
72 
73 SourceFiles
74  waveSurfacePressureFvPatchScalarField.C
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef waveSurfacePressureFvPatchScalarField_H
79 #define waveSurfacePressureFvPatchScalarField_H
80 
82 #include "NamedEnum.H"
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 namespace Foam
87 {
88 
89 /*---------------------------------------------------------------------------*\
90  Class waveSurfacePressureFvPatchScalarField Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 class waveSurfacePressureFvPatchScalarField
94 :
95  public fixedValueFvPatchScalarField
96 {
97 public:
98 
99  // Public data
100 
101  //- Enumeration defining the available ddt schemes
102  enum ddtSchemeType
103  {
104  tsEuler,
106  tsBackward
107  };
108 
109 
110 private:
111 
112  // Private data
113 
114  //- Flux field name
115  word phiName_;
116 
117  //- Wave height field name
118  word zetaName_;
119 
120  //- Density field for mass-based flux evaluations
121  word rhoName_;
122 
123  //- Time scheme type names
124  static const NamedEnum<ddtSchemeType, 3> ddtSchemeTypeNames_;
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("waveSurfacePressure");
131 
132 
133  // Constructors
134 
135  //- Construct from patch and internal field
137  (
138  const fvPatch&,
140  );
141 
142  //- Construct from patch, internal field and dictionary
144  (
145  const fvPatch&,
147  const dictionary&
148  );
149 
150  //- Construct by mapping given waveSurfacePressureFvPatchScalarField
151  // onto a new patch
153  (
155  const fvPatch&,
157  const fvPatchFieldMapper&
158  );
159 
160  //- Construct as copy
162  (
164  );
165 
166  //- Construct and return a clone
167  virtual tmp<fvPatchScalarField> clone() const
168  {
170  (
172  );
173  }
174 
175  //- Construct as copy setting internal field reference
177  (
180  );
181 
182  //- Construct and return a clone setting internal field reference
184  (
186  ) const
187  {
189  (
191  );
192  }
193 
194 
195  // Member functions
196 
197  // Evaluation functions
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 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
216 // ************************************************************************* //
waveSurfacePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
ddtSchemeType
Enumeration defining the available ddt schemes.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
This is a pressure boundary condition, whose value is calculated as the hydrostatic pressure based on...
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...
A class for managing temporary objects.
Definition: PtrList.H:54
TypeName("waveSurfacePressure")
Runtime type information.
Namespace for OpenFOAM.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.