rotorDiskSource.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) 2011-2021 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::fv::rotorDiskSource
26 
27 Description
28  Cell based momentum source which approximates the mean effects of
29  rotor forces on a cylindrical region within the domain.
30 
31 Usage
32  Example usage:
33  \verbatim
34  rotorDiskSource1
35  {
36  type rotorDisk;
37 
38  U U; // Name of the velocity field
39 
40  nBlades 3; // Number of blades
41  tipEffect 0.96; // Normalised radius above which lift = 0
42  inletFlowType local; // Inlet flow type specification
43  geometryMode auto; // Geometry specification
44  refDirection (-1 0 0); // Reference direction for psi angle
45 
46  trimModel fixed; // Trim model; fixed or targetCoeff
47  // see fixedTrim.H or targetCoeffTrim.H for documentation
48 
49  flapCoeffs
50  {
51  beta0 0; // Coning angle [deg]
52  beta1c 0; // Lateral flapping coeff (cos coeff)
53  beta2s 0; // Longitudinal flapping coeff (sin coeff)
54  }
55 
56  blade
57  {
58  // see bladeModel.H for documentation
59  }
60 
61  profiles
62  {
63  profile1
64  {
65  type lookup; // Profile model; lookup or series
66 
67  ...
68 
69  // see lookupProfile.H or seriesProfile.H for documentation
70  }
71  profile2
72  {
73  ...
74  }
75  }
76  }
77  \endverbatim
78 
79  Where:
80  Valid fvModels for the \c geometryMode entry include:
81  - auto : determine rotor coordinate system from cells
82  - specified : specified coordinate system
83 
84  Valid fvModels for the \c inletFlowType entry include:
85  - fixed : specified velocity
86  - local : use local flow conditions
87  - surfaceNormal : specified normal velocity (positive towards rotor)
88 
89 See also
90  Foam::bladeModel
91  Foam::lookupProfile
92  Foam::seriesProfile
93 
94 SourceFiles
95  rotorDiskSource.C
96  rotorDiskSourceTemplates.C
97 
98 \*---------------------------------------------------------------------------*/
99 
100 #ifndef rotorDiskSource_H
101 #define rotorDiskSource_H
102 
103 #include "fvModel.H"
104 #include "fvCellSet.H"
105 #include "cylindricalCS.H"
106 #include "cylindrical.H"
107 #include "NamedEnum.H"
108 #include "bladeModel.H"
109 #include "profileModelList.H"
110 #include "volFieldsFwd.H"
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 namespace Foam
115 {
116 
117 // Forward declaration of classes
118 class trimModel;
119 
120 namespace fv
121 {
122 
123 /*---------------------------------------------------------------------------*\
124  Class rotorDiskSource Declaration
125 \*---------------------------------------------------------------------------*/
127 class rotorDiskSource
128 :
129  public fvModel
130 {
131 public:
133  enum geometryModeType
134  {
136  specified
137  };
140  enum inletFlowType
141  {
144  local
145  };
147 
148 
149 private:
150 
151  // Helper structures to encapsulate flap and trim data
152  // Note: all input in degrees (converted to radians internally)
153 
154  struct flapData
155  {
156  scalar beta0; // coning angle
157  scalar beta1c; // lateral flapping coeff (cos coeff)
158  scalar beta2s; // longitudinal flapping coeff (sin coeff)
159  };
160 
161 
162  // Private data
163 
164  //- The set of cells the fvConstraint applies to
165  fvCellSet set_;
166 
167  //- Name of the velocity field
168  word UName_;
169 
170  //- Rotational speed [rad/s]
171  // Positive anti-clockwise when looking along -ve lift direction
172  scalar omega_;
173 
174  //- Number of blades
175  label nBlades_;
176 
177  //- Inlet flow type
178  inletFlowType inletFlow_;
179 
180  //- Inlet velocity for specified inflow
181  vector inletVelocity_;
182 
183  //- Tip effect [0-1]
184  // Ratio of blade radius beyond which lift=0
185  scalar tipEffect_;
186 
187  //- Blade flap coefficients [rad/s]
188  flapData flap_;
189 
190  //- Cell centre positions in local rotor frame
191  // (Cylindrical r, theta, z)
192  List<point> x_;
193 
194  //- Rotation tensor for flap angle
195  List<tensor> R_;
196 
197  //- Inverse rotation tensor for flap angle
198  List<tensor> invR_;
199 
200  //- Area [m^2]
201  List<scalar> area_;
202 
203  //- Rotor local cylindrical co-ordinate system (r, theta, z)
205 
206  //- Rotor transformation co-ordinate system
207  autoPtr<cylindrical> cylindrical_;
208 
209  //- Maximum radius
210  scalar rMax_;
211 
212  //- Trim model
213  autoPtr<trimModel> trim_;
214 
215  //- Blade data
216  bladeModel blade_;
217 
218  //- Profile data
219  profileModelList profiles_;
220 
221  //- Reference density for incompressible case
222  mutable scalar rhoRef_;
223 
224 
225  // Protected Member Functions
226 
227  //- Non-virtual read
228  void readCoeffs();
229 
230  //- Check data
231  void checkData();
232 
233  //- Set the face areas per cell, and optionally correct the rotor axis
234  void setFaceArea(vector& axis, const bool correct);
235 
236  //- Create the co-ordinate system
237  void createCoordinateSystem();
238 
239  //- Construct geometry
240  void constructGeometry();
241 
242  //- Return the inlet flow field
243  tmp<vectorField> inflowVelocity(const volVectorField& U) const;
244 
245  //- Helper function to write rotor values
246  template<class Type>
247  void writeField
248  (
249  const word& name,
250  const List<Type>& values,
251  const bool writeNow = false
252  ) const;
253 
254 
255 public:
256 
257  //- Runtime type information
258  TypeName("rotorDisk");
259 
260 
261  // Constructors
262 
263 
264  //- Construct from components
266  (
267  const word& name,
268  const word& modelType,
269  const dictionary& dict,
270  const fvMesh& mesh
271  );
272 
273 
274  //- Destructor
275  virtual ~rotorDiskSource();
276 
277 
278  // Member Functions
279 
280  // Access
281 
282  //- Return the reference density for incompressible case
283  inline scalar rhoRef() const;
284 
285  //- Return the rotational speed [rad/s]
286  // Positive anti-clockwise when looking along -ve lift direction
287  inline scalar omega() const;
288 
289  inline const fvCellSet& set() const;
290 
291  //- Return the cell centre positions in local rotor frame
292  // (Cylindrical r, theta, z)
293  inline const List<point>& x() const;
294 
295  //- Return the rotor co-ordinate system (r, theta, z)
296  inline const coordinateSystems::cylindrical& coordSys() const;
297 
298 
299  // Checks
300 
301  //- Return the list of fields for which the fvModel adds source term
302  // to the transport equation
303  virtual wordList addSupFields() const;
304 
305 
306  // Evaluation
307 
308  //- Calculate forces
309  template<class RhoFieldType>
310  void calculate
311  (
312  const RhoFieldType& rho,
313  const vectorField& U,
314  const scalarField& thetag,
315  vectorField& force,
316  const bool divideVolume = true,
317  const bool output = true
318  ) const;
319 
320 
321  // Source term addition
322 
323  //- Source term to momentum equation
324  virtual void addSup
325  (
326  fvMatrix<vector>& eqn,
327  const word& fieldName
328  ) const;
329 
330  //- Source term to compressible momentum equation
331  virtual void addSup
332  (
333  const volScalarField& rho,
334  fvMatrix<vector>& eqn,
335  const word& fieldName
336  ) const;
337 
338 
339  // Mesh motion
340 
341  //- Update for mesh changes
342  virtual void updateMesh(const mapPolyMesh&);
343 
344 
345  // IO
346 
347  //- Read source dictionary
348  virtual bool read(const dictionary& dict);
349 };
350 
351 
352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
353 
354 } // End namespace fv
355 } // End namespace Foam
356 
357 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358 
359 #include "rotorDiskSourceI.H"
360 
361 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
362 
363 #ifdef NoRepository
364  #include "rotorDiskSourceTemplates.C"
365 #endif
366 
367 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
368 
369 #endif
370 
371 // ************************************************************************* //
Blade model class calculates: Linear interpolated blade twist and chord based on radial position Inte...
Definition: bladeModel.H:64
dictionary dict
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
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
Cell-set fvConstraint abstract base class. Provides a base set of controls regarding the location whe...
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
const List< point > & x() const
Return the cell centre positions in local rotor frame.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual ~rotorDiskSource()
Destructor.
Finite volume model abstract base class.
Definition: fvModel.H:55
Cylindrical coordinate system.
Definition: cylindricalCS.H:50
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
List of profile models.
scalar omega() const
Return the rotational speed [rad/s].
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Cell based momentum source which approximates the mean effects of rotor forces on a cylindrical regio...
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
scalar rhoRef() const
Return the reference density for incompressible case.
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
U
Definition: pEqn.H:72
virtual void updateMesh(const mapPolyMesh &)
Update for mesh changes.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
virtual void correct()
Correct the fvModel.
Definition: fvModel.C:180
const coordinateSystems::cylindrical & coordSys() const
Return the rotor co-ordinate system (r, theta, z)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
TypeName("rotorDisk")
Runtime type information.
Namespace for OpenFOAM.