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-2020 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  //- Disallow copy without setting internal field reference
139  (
141  ) = delete;
142 
143  //- Copy constructor setting internal field reference
145  (
148  );
149 
150  //- Construct and return a clone setting internal field reference
152  (
154  ) const
155  {
157  (
158  new waveAlphaFvPatchScalarField(*this, iF)
159  );
160  }
161 
162 
163  // Member Functions
164 
165  // Access
166 
167  //- Access the liquid flag
168  bool liquid() const
169  {
170  return liquid_;
171  }
172 
173 
174  // Evaluation functions
175 
176  //- Return the current modelled phase fraction field
177  tmp<scalarField> alpha() const;
178 
179  //- Return the current modelled phase fraction field in the
180  // neighbour cell
181  tmp<scalarField> alphan() const;
182 
183  //- Update the coefficients associated with the patch field
184  virtual void updateCoeffs();
185 
186 
187  //- Write
188  virtual void write(Ostream&) const;
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 
199 #endif
200 
201 // ************************************************************************* //
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:156
This boundary condition provides a waveAlpha condition. This sets the phase fraction to that specifie...
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:62
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:54
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.