waveAlphaFvPatchScalarField.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) 2017-2018 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::waveAlphaFvPatchScalarField
26 
27 Description
28  This boundary condition provides a waveAlpha condition. This sets the phase
29  fraction to that specified by a superposition of wave models. All the
30  parameters are looked up from the corresponding velocity condition.
31 
32  Flow reversal will occur in the event that the amplitude of the velocity
33  oscillation is greater than the mean flow. This triggers special handling,
34  the form of which depends on the inletOutlet flag and whether a wave
35  pressure condition is being used.
36 
37  If a wave pressure condition is not being used, the inletOutlet switches
38  between a fixedValue and an inletOutlet condition, with the value given by
39  the wave model. If fixedValue, the result may be more accurate, but it
40  might also be unstable.
41 
42  If a wave pressure condition is being used, then the normal phase fraction
43  condition becomes fixedGradient on outlet faces. This gradient is
44  calculated numerically by evaluating the wave model on both the patch face
45  and the adjacent cell.
46 
47 Usage
48  \table
49  Property | Description | Req'd? | Default
50  U | name of the velocity field | no | U
51  liquid | is the alpha field that of the liquid | no | true
52  inletOutlet | does the condition behave like inletOutlet | no | true
53  \endtable
54 
55  Example of the boundary condition specification:
56  \verbatim
57  <patchName>
58  {
59  type waveAlpha;
60  U U;
61  inletOutlet true;
62  }
63  \endverbatim
64 
65 SourceFiles
66  waveAlphaFvPatchScalarField.C
67 
68 \*---------------------------------------------------------------------------*/
69 
70 #ifndef waveAlphaFvPatchScalarField_H
71 #define waveAlphaFvPatchScalarField_H
72 
73 #include "mixedFvPatchFields.H"
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 
80 /*---------------------------------------------------------------------------*\
81  Class waveAlphaFvPatchScalarField Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 class waveAlphaFvPatchScalarField
85 :
86  public mixedFvPatchScalarField
87 {
88  // Private data
89 
90  //- Name of the velocity field
91  const word UName_;
92 
93  //- Is this alpha field that of the liquid under the wave?
94  const Switch liquid_;
95 
96  //- Act as an inlet/outlet patch?
97  const Switch inletOutlet_;
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("waveAlpha");
104 
105 
106  // Constructors
107 
108  //- Construct from patch and internal field
110  (
111  const fvPatch&,
113  );
114 
115  //- Construct from patch, internal field and dictionary
117  (
118  const fvPatch&,
120  const dictionary&
121  );
122 
123  //- Construct by mapping given mixedTypeFvPatchField onto a new patch
125  (
127  const fvPatch&,
129  const fvPatchFieldMapper&
130  );
131 
132  //- Construct as copy
134  (
136  );
137 
138  //- Construct and return a clone
139  virtual tmp<fvPatchScalarField> clone() const
140  {
142  (
143  new waveAlphaFvPatchScalarField(*this)
144  );
145  }
146 
147  //- Construct as copy setting internal field reference
149  (
152  );
153 
154  //- Construct and return a clone setting internal field reference
156  (
158  ) const
159  {
161  (
162  new waveAlphaFvPatchScalarField(*this, iF)
163  );
164  }
165 
166 
167  // Member functions
168 
169  // Access
170 
171  //- Access the liquid flag
172  bool liquid() const
173  {
174  return liquid_;
175  }
176 
177 
178  // Evaluation functions
179 
180  //- Return the current modelled phase fraction field
181  tmp<scalarField> alpha() const;
182 
183  //- Return the current modelled phase fraction field in the
184  // neighbour cell
185  tmp<scalarField> alphan() const;
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 
203 #endif
204 
205 // ************************************************************************* //
tmp< scalarField > alpha() const
Return the current modelled phase fraction field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
This boundary condition provides a waveAlpha condition. This sets the phase fraction to that specifie...
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
bool liquid() const
Access the liquid flag.
virtual void write(Ostream &) const
Write.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
waveAlphaFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
tmp< scalarField > alphan() const
Return the current modelled phase fraction field in the.
TypeName("waveAlpha")
Runtime type information.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.