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-2023 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, the value of which is calculated as
29  the hydrostatic pressure based on a given displacement:
30 
31  \f[
32  p_rgh = pref - \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; // Initial value
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, internal field and dictionary
134  (
135  const fvPatch&,
137  const dictionary&
138  );
139 
140  //- Construct by mapping given waveSurfacePressureFvPatchScalarField
141  // onto a new patch
143  (
145  const fvPatch&,
147  const fvPatchFieldMapper&
148  );
149 
150  //- Disallow copy without setting internal field reference
152  (
154  ) = delete;
155 
156  //- Copy constructor setting internal field reference
158  (
161  );
162 
163  //- Construct and return a clone setting internal field reference
165  (
167  ) const
168  {
170  (
172  );
173  }
174 
175 
176  // Member Functions
177 
178  // Evaluation functions
179 
180  //- Update the coefficients associated with the patch field
181  virtual void updateCoeffs();
182 
183 
184  //- Write
185  virtual void write(Ostream&) const;
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
This is a pressure boundary condition, the value of which is calculated as the hydrostatic pressure b...
TypeName("waveSurfacePressure")
Runtime type information.
waveSurfacePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
ddtSchemeType
Enumeration defining the available ddt schemes.
Namespace for OpenFOAM.