All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
waveVelocityFvPatchVectorField.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::waveVelocityFvPatchVectorField
26 
27 Description
28  This boundary condition provides a waveVelocity condition. This sets the
29  velocity 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, and inletOutlet is false,
39  then this is a standard fixed value condition, with the value supplied by
40  the wave model. If flow reversal occurs this state may be unstable. The
41  corresponding pressure condition should be fixedFluxPressure.
42 
43  If a wave pressure condition is not being used, and inletOutlet is true or
44  not specified then the proportion of the patch over which the flow is
45  reversed functions in a manner similar to the flowRateOutletVelocity
46  condition; i.e., the velocity is extrapolated and then scaled to match the
47  required outlet flow rate. Numerically, this is still a fixedValue
48  constraint on the normal velocity, just one which tends to avoid
49  instability. Again, the corresponding pressure condition should be
50  fixedFluxPressure.
51 
52  If a wave pressure condition is being used, then the normal velocity
53  condition becomes fixedGradient on outlet faces. This gradient is
54  calculated numerically by evaluating the wave model on both the patch face
55  and the adjacent cell. The pressure boundary in this case should be a
56  wavePressure condition. This will do the opposite; it will fix the pressure
57  value on outlet faces, and the gradient otherwise.
58 
59 Usage
60  \table
61  Property | Description | Req'd? | Default
62  phi | Name of the flux field | no | phi
63  p | Name of the pressure field | no | p
64  inletOutlet | does the condition behave like inletOutlet | no | true
65  ramp | ramping function for the mean flow speed | no | None
66  \endtable
67 
68  Example of the boundary condition specification:
69  \verbatim
70  <patchName>
71  {
72  type waveVelocity;
73  phi phi;
74  p p;
75  inletOutlet yes;
76  ramp constant 1;
77  }
78  \endverbatim
79 
80 See also
81  Foam::waveSuperposition
82 
83 SourceFiles
84  waveVelocityFvPatchVectorField.C
85 
86 \*---------------------------------------------------------------------------*/
87 
88 #ifndef waveVelocityFvPatchVectorField_H
89 #define waveVelocityFvPatchVectorField_H
90 
92 #include "waveSuperposition.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 
99 class fvMeshSubset;
100 
101 /*---------------------------------------------------------------------------*\
102  Class waveVelocityFvPatchVectorField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class waveVelocityFvPatchVectorField
106 :
107  public directionMixedFvPatchVectorField
108 {
109  // Private Data
110 
111  //- Name of the flux field
112  const word phiName_;
113 
114  //- Name of the pressure field
115  const word pName_;
116 
117  //- Act as an inlet/outlet patch?
118  const Switch inletOutlet_;
119 
120  //- Mesh subset corresponding to the patch adjacent cells
121  mutable autoPtr<fvMeshSubset> faceCellSubset_;
122 
123  //- Time index for keeping the subset up to date
124  mutable label faceCellSubsetTimeIndex_;
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("waveVelocity");
131 
132 
133  // Constructors
134 
135  //- Construct from patch and internal field
137  (
138  const fvPatch&,
140  );
141 
142  //- Construct from patch, internal field and dictionary
144  (
145  const fvPatch&,
147  const dictionary&
148  );
149 
150  //- Construct by mapping given mixedTypeFvPatchField onto a new patch
152  (
154  const fvPatch&,
156  const fvPatchFieldMapper&
157  );
158 
159  //- Copy constructor
161  (
163  );
164 
165  //- Construct and return a clone
166  virtual tmp<fvPatchVectorField> clone() const
167  {
169  (
171  );
172  }
173 
174  //- Copy constructor setting internal field reference
176  (
179  );
180 
181  //- Construct and return a clone setting internal field reference
183  (
185  ) const
186  {
188  (
189  new waveVelocityFvPatchVectorField(*this, iF)
190  );
191  }
192 
193 
194  // Member Functions
195 
196  // Access
197 
198  //- Access the name of the pressure field
199  const word& pName() const
200  {
201  return pName_;
202  }
203 
204  //- Access the face-cell subset
205  const fvMeshSubset& faceCellSubset() const;
206 
208  // Evaluation functions
209 
210  //- Return the current modelled velocity field on the patch faces
211  tmp<vectorField> U() const;
212 
213  //- Return the current modelled velocity field in the neighbour cell
214  tmp<vectorField> Un() const;
215 
216  //- Update the coefficients associated with the patch field
217  virtual void updateCoeffs();
218 
219 
220  //- Write
221  virtual void write(Ostream&) const;
222 };
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 
232 #endif
233 
234 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
waveVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
const fvMeshSubset & faceCellSubset() const
Access the face-cell subset.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void write(Ostream &) const
Write.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
const word & pName() const
Access the name of the pressure field.
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
TypeName("waveVelocity")
Runtime type information.
This boundary condition provides a waveVelocity condition. This sets the velocity to that specified b...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
Definition: fvMeshSubset.H:73
tmp< vectorField > Un() const
Return the current modelled velocity field in the neighbour cell.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
tmp< vectorField > U() const
Return the current modelled velocity field on the patch faces.