SRFVelocityFvPatchVectorField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::SRFVelocityFvPatchVectorField
29 
30 Group
31  grpInletBoundaryConditions grpWallBoundaryConditions
32 
33 Description
34  Velocity condition to be used in conjunction with the single
35  rotating frame (SRF) model (see: SRFModel class)
36 
37  Given the free stream velocity in the absolute frame, the condition
38  applies the appropriate rotation transformation in time and space to
39  determine the local velocity.
40 
41  The optional \c relative flag switches the behaviour of the patch
42  such that:
43 
44  - relative = yes: inlet velocity applied 'as is':
45 
46  \f[
47  U_p = U_{in}
48  \f]
49 
50  - relative = no : SRF velocity is subtracted from the inlet velocity:
51 
52  \f[
53  U_p = U_{in} - U_{p,srf}
54  \f]
55 
56  where
57  \vartable
58  U_p | patch velocity [m/s]
59  U_{in} | user-specified inlet velocity
60  U_{p,srf} | SRF velocity
61  \endvartable
62 
63 Usage
64  \table
65  Property | Description | Required | Default value
66  inletValue | inlet velocity | yes |
67  relative | inletValue relative motion to the SRF? | yes |
68  \endtable
69 
70  Example of the boundary condition specification:
71  \verbatim
72  <patchName>
73  {
74  type SRFVelocity;
75  inletValue uniform (0 0 0);
76  relative yes;
77  value uniform (0 0 0); // initial value
78  }
79  \endverbatim
80 
81 See also
82  Foam::fixedValueFvPatchField
83 
84 SourceFiles
85  SRFVelocityFvPatchVectorField.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef SRFVelocityFvPatchVectorField_H
90 #define SRFVelocityFvPatchVectorField_H
91 
92 #include "fvPatchFields.H"
94 #include "Switch.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class SRFVelocityFvPatchVectorField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class SRFVelocityFvPatchVectorField
106 :
107  public fixedValueFvPatchVectorField
108 {
109  // Private data
110 
111  //- Is the supplied inlet value relative to the SRF
112  Switch relative_;
113 
114  //- Inlet value [m/s]
115  vectorField inletValue_;
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("SRFVelocity");
122 
123 
124  // Constructors
125 
126  //- Construct from patch and internal field
128  (
129  const fvPatch&,
130  const DimensionedField<vector, volMesh>&
131  );
132 
133  //- Construct from patch, internal field and dictionary
135  (
136  const fvPatch&,
138  const dictionary&
139  );
140 
141  //- Construct by mapping given SRFVelocityFvPatchVectorField
142  // onto a new patch
144  (
146  const fvPatch&,
148  const fvPatchFieldMapper&
149  );
150 
151  //- Construct as copy
153  (
155  );
156 
157  //- Construct and return a clone
158  virtual tmp<fvPatchVectorField> clone() const
159  {
161  (
163  );
164  }
165 
166  //- Construct as copy setting internal field reference
168  (
171  );
172 
173  //- Construct and return a clone setting internal field reference
175  (
177  ) const
178  {
180  (
181  new SRFVelocityFvPatchVectorField(*this, iF)
182  );
183  }
184 
185 
186  // Member functions
187 
188  // Access
189 
190  //- Is supplied inlet value relative to the SRF?
191  bool relative() const
192  {
193  return relative_;
194  }
195 
196 
197  // Mapping functions
198 
199  //- Map (and resize as needed) from self given a mapping object
200  virtual void autoMap
201  (
202  const fvPatchFieldMapper&
203  );
204 
205  //- Reverse map the given fvPatchField onto this fvPatchField
206  virtual void rmap
207  (
208  const fvPatchVectorField&,
209  const labelList&
210  );
211 
212 
213  // Evaluation functions
214 
215  //- Update the coefficients associated with the patch field
216  virtual void updateCoeffs();
217 
218 
219  // I-O
220 
221  //- Write
222  virtual void write(Ostream&) const;
223 };
224 
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 } // End namespace Foam
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
Foam::fvPatchField< vector >
Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
SRFVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: SRFVelocityFvPatchVectorField.C:37
Foam::SRFVelocityFvPatchVectorField::TypeName
TypeName("SRFVelocity")
Runtime type information.
Foam::SRFVelocityFvPatchVectorField::rmap
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: SRFVelocityFvPatchVectorField.C:111
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::SRFVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: SRFVelocityFvPatchVectorField.C:125
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::SRFVelocityFvPatchVectorField::relative
bool relative() const
Is supplied inlet value relative to the SRF?
Definition: SRFVelocityFvPatchVectorField.H:217
Foam::Field< vector >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::SRFVelocityFvPatchVectorField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: SRFVelocityFvPatchVectorField.C:101
Switch.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SRFVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: SRFVelocityFvPatchVectorField.H:184
fvPatchFields.H
Foam::List< label >
Foam::SRFVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: SRFVelocityFvPatchVectorField.C:155
fixedValueFvPatchFields.H
Foam::SRFVelocityFvPatchVectorField
Velocity condition to be used in conjunction with the single rotating frame (SRF) model (see: SRFMode...
Definition: SRFVelocityFvPatchVectorField.H:131
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54