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-2019 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  wave modelling parameters are obtained from a centrally registered
31  waveSuperposition class.
32 
33  Flow reversal will occur in the event that the amplitude of the velocity
34  oscillation is greater than the mean flow. This triggers special handling,
35  the form of which depends on the inletOutlet flag and whether a wave
36  pressure condition is being used.
37 
38  If a wave pressure condition is not being used, the inletOutlet switches
39  between a fixedValue and an inletOutlet condition, with the value given by
40  the wave model. If fixedValue, the result may be more accurate, but it
41  might also be unstable.
42 
43  If a wave pressure condition is being used, then the normal phase fraction
44  condition becomes fixedGradient on outlet faces. This gradient is
45  calculated numerically by evaluating the wave model on both the patch face
46  and the adjacent cell.
47 
48 Usage
49  \table
50  Property | Description | Req'd? | Default
51  U | name of the velocity field | no | U
52  liquid | is the alpha field that of the liquid | no | true
53  inletOutlet | does the condition behave like inletOutlet | no | true
54  \endtable
55 
56  Example of the boundary condition specification:
57  \verbatim
58  <patchName>
59  {
60  type waveAlpha;
61  U U;
62  liquid true;
63  inletOutlet true;
64  }
65  \endverbatim
66 
67 See also
68  Foam::waveSuperposition
69 
70 SourceFiles
71  waveAlphaFvPatchScalarField.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef waveAlphaFvPatchScalarField_H
76 #define waveAlphaFvPatchScalarField_H
77 
78 #include "mixedFvPatchFields.H"
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class waveAlphaFvPatchScalarField Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class waveAlphaFvPatchScalarField
90 :
91  public mixedFvPatchScalarField
92 {
93  // Private Data
94 
95  //- Name of the velocity field
96  const word UName_;
97 
98  //- Is this alpha field that of the liquid under the wave?
99  const Switch liquid_;
100 
101  //- Act as an inlet/outlet patch?
102  const Switch inletOutlet_;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("waveAlpha");
109 
110 
111  // Constructors
112 
113  //- Construct from patch and internal field
115  (
116  const fvPatch&,
118  );
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
125  const dictionary&
126  );
127 
128  //- Construct by mapping given mixedTypeFvPatchField onto a new patch
130  (
132  const fvPatch&,
134  const fvPatchFieldMapper&
135  );
136 
137  //- Copy constructor
139  (
141  );
142 
143  //- Construct and return a clone
144  virtual tmp<fvPatchScalarField> clone() const
145  {
147  (
148  new waveAlphaFvPatchScalarField(*this)
149  );
150  }
151 
152  //- Copy constructor setting internal field reference
154  (
157  );
158 
159  //- Construct and return a clone setting internal field reference
161  (
163  ) const
164  {
166  (
167  new waveAlphaFvPatchScalarField(*this, iF)
168  );
169  }
170 
171 
172  // Member Functions
173 
174  // Access
175 
176  //- Access the liquid flag
177  bool liquid() const
178  {
179  return liquid_;
180  }
181 
182 
183  // Evaluation functions
184 
185  //- Return the current modelled phase fraction field
186  tmp<scalarField> alpha() const;
187 
188  //- Return the current modelled phase fraction field in the
189  // neighbour cell
190  tmp<scalarField> alphan() const;
191 
192  //- Update the coefficients associated with the patch field
193  virtual void updateCoeffs();
194 
195 
196  //- Write
197  virtual void write(Ostream&) const;
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 
208 #endif
209 
210 // ************************************************************************* //
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:158
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.