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-2015 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  \heading Patch usage
48 
49  \table
50  Property | Description | Required | Default value
51  phi | flux field name | no | phi
52  rho | density field name | no | rho
53  zeta | wave amplitude field name | no | zeta
54  \endtable
55 
56  Example of the boundary condition specification:
57  \verbatim
58  myPatch
59  {
60  type waveSurfacePressure;
61  phi phi;
62  rho rho;
63  zeta zeta;
64  value uniform 0; // place holder
65  }
66  \endverbatim
67 
68  The density field is only required if the flux is mass-based as opposed to
69  volumetric-based.
70 
71 SeeAlso
72  Foam::fixedValueFvPatchField
73 
74 SourceFiles
75  waveSurfacePressureFvPatchScalarField.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef waveSurfacePressureFvPatchScalarField_H
80 #define waveSurfacePressureFvPatchScalarField_H
81 
83 #include "NamedEnum.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class waveSurfacePressureFvPatchScalarField Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class waveSurfacePressureFvPatchScalarField
95 :
96  public fixedValueFvPatchScalarField
97 {
98 public:
99 
100  // Public data
101 
102  //- Enumeration defining the available ddt schemes
103  enum ddtSchemeType
104  {
105  tsEuler,
107  tsBackward
108  };
109 
110 
111 private:
112 
113  // Private data
114 
115  //- Flux field name
116  word phiName_;
117 
118  //- Wave height field name
119  word zetaName_;
120 
121  //- Density field for mass-based flux evaluations
122  word rhoName_;
123 
124  //- Time scheme type names
126 
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("waveSurfacePressure");
132 
133 
134  // Constructors
135 
136  //- Construct from patch and internal field
138  (
139  const fvPatch&,
141  );
142 
143  //- Construct from patch, internal field and dictionary
145  (
146  const fvPatch&,
148  const dictionary&
149  );
150 
151  //- Construct by mapping given waveSurfacePressureFvPatchScalarField
152  // onto a new patch
154  (
156  const fvPatch&,
158  const fvPatchFieldMapper&
159  );
160 
161  //- Construct as copy
163  (
165  );
166 
167  //- Construct and return a clone
168  virtual tmp<fvPatchScalarField> clone() const
169  {
171  (
173  );
174  }
175 
176  //- Construct as copy setting internal field reference
178  (
181  );
182 
183  //- Construct and return a clone setting internal field reference
185  (
187  ) const
188  {
190  (
192  );
193  }
194 
195 
196  // Member functions
197 
198  // Evaluation functions
199 
200  //- Update the coefficients associated with the patch field
201  virtual void updateCoeffs();
202 
203 
204  //- Write
205  virtual void write(Ostream&) const;
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
Foam::waveSurfacePressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: waveSurfacePressureFvPatchScalarField.H:199
Foam::waveSurfacePressureFvPatchScalarField::TypeName
TypeName("waveSurfacePressure")
Runtime type information.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeTypeNames_
static const NamedEnum< ddtSchemeType, 3 > ddtSchemeTypeNames_
Time scheme type names.
Definition: waveSurfacePressureFvPatchScalarField.H:156
NamedEnum.H
Foam::waveSurfacePressureFvPatchScalarField::tsBackward
@ tsBackward
Definition: waveSurfacePressureFvPatchScalarField.H:138
Foam::waveSurfacePressureFvPatchScalarField::waveSurfacePressureFvPatchScalarField
waveSurfacePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: waveSurfacePressureFvPatchScalarField.C:65
Foam::waveSurfacePressureFvPatchScalarField::zetaName_
word zetaName_
Wave height field name.
Definition: waveSurfacePressureFvPatchScalarField.H:150
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::waveSurfacePressureFvPatchScalarField::phiName_
word phiName_
Flux field name.
Definition: waveSurfacePressureFvPatchScalarField.H:147
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::waveSurfacePressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: waveSurfacePressureFvPatchScalarField.C:234
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::waveSurfacePressureFvPatchScalarField::ddtSchemeType
ddtSchemeType
Enumeration defining the available ddt schemes.
Definition: waveSurfacePressureFvPatchScalarField.H:134
Foam::waveSurfacePressureFvPatchScalarField::tsEuler
@ tsEuler
Definition: waveSurfacePressureFvPatchScalarField.H:136
Foam::waveSurfacePressureFvPatchScalarField::rhoName_
word rhoName_
Density field for mass-based flux evaluations.
Definition: waveSurfacePressureFvPatchScalarField.H:153
fixedValueFvPatchFields.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::waveSurfacePressureFvPatchScalarField
This is a pressure boundary condition, whose value is calculated as the hydrostatic pressure based on...
Definition: waveSurfacePressureFvPatchScalarField.H:125
Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: waveSurfacePressureFvPatchScalarField.C:142
Foam::NamedEnum< ddtSchemeType, 3 >
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::waveSurfacePressureFvPatchScalarField::tsCrankNicolson
@ tsCrankNicolson
Definition: waveSurfacePressureFvPatchScalarField.H:137