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