waveAlphaFvPatchScalarField.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) 2017 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 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  This boundary condition provides a waveAlpha condition. This sets the phase
32  fraction to that specified by a superposition of wave models. All the
33  parameters are looked up from the corresponding velocity condition.
34 
35 Usage
36  \table
37  Property | Description | Req'd? | Default
38  U | name of the velocity field | no | U
39  liquid | is the alpha field that of the liquid | no | true
40  inletOutlet | does the condition behave like inletOutlet | no | true
41  \endtable
42 
43  Example of the boundary condition specification:
44  \verbatim
45  <patchName>
46  {
47  type waveAlpha;
48  U U;
49  inletOutlet true;
50  }
51  \endverbatim
52 
53 SourceFiles
54  waveAlphaFvPatchScalarField.C
55 
56 \*---------------------------------------------------------------------------*/
57 
58 #ifndef waveAlphaFvPatchScalarField_H
59 #define waveAlphaFvPatchScalarField_H
60 
61 #include "mixedFvPatchFields.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class waveAlphaFvPatchScalarField Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class waveAlphaFvPatchScalarField
73 :
74  public mixedFvPatchScalarField
75 {
76  // Private data
77 
78  //- Name of the velocity field
79  word UName_;
80 
81  //- Is this alpha field that of the liquid under the wave?
82  const bool liquid_;
83 
84  //- Act as an inlet/outlet patch? If false, the alpha field will be set
85  // by the wave model even during outflow. This may apply the wave model
86  // more accurately, but it might also be unstable. If true, the alpha
87  // boundary condition will be zero gradient when the flow reverses, as
88  // is usual.
89  const bool inletOutlet_;
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("waveAlpha");
96 
97 
98  // Constructors
99 
100  //- Construct from patch and internal field
102  (
103  const fvPatch&,
105  );
106 
107  //- Construct from patch, internal field and dictionary
109  (
110  const fvPatch&,
112  const dictionary&
113  );
114 
115  //- Construct by mapping given mixedTypeFvPatchField onto a new patch
117  (
119  const fvPatch&,
121  const fvPatchFieldMapper&
122  );
123 
124  //- Construct as copy
126  (
128  );
129 
130  //- Construct and return a clone
131  virtual tmp<fvPatchScalarField> clone() const
132  {
134  (
135  new waveAlphaFvPatchScalarField(*this)
136  );
137  }
138 
139  //- Construct as copy setting internal field reference
141  (
144  );
145 
146  //- Construct and return a clone setting internal field reference
148  (
150  ) const
151  {
153  (
154  new waveAlphaFvPatchScalarField(*this, iF)
155  );
156  }
157 
158 
159  // Member functions
160 
161  // Access
162 
163  //- Access the liquid flag
164  bool liquid() const
165  {
166  return liquid_;
167  }
168 
169 
170  // Evaluation functions
171 
172  //- Return the current modelled phase fraction field
173  tmp<scalarField> alpha() const;
174 
175  //- Update the coefficients associated with the patch field
176  virtual void updateCoeffs();
177 
178 
179  //- Write
180  virtual void write(Ostream&) const;
181 };
182 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 
191 #endif
192 
193 // ************************************************************************* //
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...
TypeName("waveAlpha")
Runtime type information.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.