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&,
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 as copy setting internal field reference
159  (
162  );
163 
164  //- Return a clone
165  virtual tmp<fvPatchField<vector>> clone() const
166  {
167  return fvPatchField<vector>::Clone(*this);
168  }
169 
170  //- Clone with an internal field reference
172  (
174  ) const
175  {
176  return fvPatchField<vector>::Clone(*this, iF);
177  }
178 
179 
180  // Member functions
181 
182  // Access
183 
184  //- Is supplied inlet value relative to the SRF?
185  bool relative() const
186  {
187  return relative_;
188  }
189 
190 
191  // Mapping functions
192 
193  //- Map (and resize as needed) from self given a mapping object
194  virtual void autoMap
195  (
196  const fvPatchFieldMapper&
197  );
198 
199  //- Reverse map the given fvPatchField onto this fvPatchField
200  virtual void rmap
201  (
202  const fvPatchVectorField&,
203  const labelList&
204  );
205 
207  // Evaluation functions
208 
209  //- Update the coefficients associated with the patch field
210  virtual void updateCoeffs();
211 
212 
213  // I-O
214 
215  //- Write
216  virtual void write(Ostream&) const;
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual tmp< fvPatchField< vector > > clone() const
Return a clone.
SRFVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
fvPatchField< vector > fvPatchVectorField
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
bool relative() const
Is supplied inlet value relative to the SRF?
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
TypeName("SRFVelocity")
Runtime type information.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual void write(Ostream &) const
Write.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.
Velocity condition to be used in conjunction with the single rotating frame (SRF) model (see: SRFMode...