waveSurfacePressureFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 Description
28  This is a pressure boundary condition, whose value is calculated as
29  the hydrostatic pressure based on a given displacement:
30 
31  \f[
32  p = -\rho*g*\zeta
33  \f]
34 
35  \vartable
36  \rho | density [kg/m^3]
37  g | acceleration due to gravity [m/s^2]
38  \zeta | wave amplitude [m]
39  \endvartable
40 
41  The wave amplitude is updated as part of the calculation, derived from the
42  local volumetric flux.
43 
44 Usage
45  \table
46  Property | Description | Required | Default value
47  phi | flux field name | no | phi
48  rho | density field name | no | rho
49  zeta | wave amplitude field name | no | zeta
50  \endtable
51 
52  Example of the boundary condition specification:
53  \verbatim
54  <patchName>
55  {
56  type waveSurfacePressure;
57  phi phi;
58  rho rho;
59  zeta zeta;
60  value uniform 0; // place holder
61  }
62  \endverbatim
63 
64  The density field is only required if the flux is mass-based as opposed to
65  volumetric-based.
66 
67 See also
68  Foam::fixedValueFvPatchField
69 
70 SourceFiles
71  waveSurfacePressureFvPatchScalarField.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef waveSurfacePressureFvPatchScalarField_H
76 #define waveSurfacePressureFvPatchScalarField_H
77 
79 #include "NamedEnum.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class waveSurfacePressureFvPatchScalarField Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class waveSurfacePressureFvPatchScalarField
91 :
92  public fixedValueFvPatchScalarField
93 {
94 public:
95 
96  // Public data
97 
98  //- Enumeration defining the available ddt schemes
99  enum ddtSchemeType
100  {
101  tsEuler,
103  tsBackward
104  };
105 
106 
107 private:
108 
109  // Private Data
110 
111  //- Flux field name
112  word phiName_;
113 
114  //- Wave height field name
115  word zetaName_;
116 
117  //- Density field for mass-based flux evaluations
118  word rhoName_;
119 
120  //- Time scheme type names
121  static const NamedEnum<ddtSchemeType, 3> ddtSchemeTypeNames_;
122 
123 
124 public:
125 
126  //- Runtime type information
127  TypeName("waveSurfacePressure");
128 
129 
130  // Constructors
131 
132  //- Construct from patch and internal field
134  (
135  const fvPatch&,
137  );
138 
139  //- Construct from patch, internal field and dictionary
141  (
142  const fvPatch&,
144  const dictionary&
145  );
146 
147  //- Construct by mapping given waveSurfacePressureFvPatchScalarField
148  // onto a new patch
150  (
152  const fvPatch&,
154  const fvPatchFieldMapper&
155  );
156 
157  //- Disallow copy without setting internal field reference
159  (
161  ) = delete;
162 
163  //- Copy constructor setting internal field reference
165  (
168  );
169 
170  //- Construct and return a clone setting internal field reference
172  (
174  ) const
175  {
177  (
179  );
180  }
181 
182 
183  // Member Functions
184 
185  // Evaluation functions
186 
187  //- Update the coefficients associated with the patch field
188  virtual void updateCoeffs();
189 
190 
191  //- Write
192  virtual void write(Ostream&) const;
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #endif
204 // ************************************************************************* //
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:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Foam::fvPatchFieldMapper.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
This is a pressure boundary condition, whose value is calculated as the hydrostatic pressure based on...
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:53
TypeName("waveSurfacePressure")
Runtime type information.
Namespace for OpenFOAM.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.