rotorDisk.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-2024 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::rotorDisk
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  rotorDisk1
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  rotorDisk.C
96  rotorDiskTemplates.C
97 
98 \*---------------------------------------------------------------------------*/
99 
100 #ifndef rotorDisk_H
101 #define rotorDisk_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 "trimModel.H"
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 namespace Foam
115 {
116 namespace fv
117 {
118 
119 /*---------------------------------------------------------------------------*\
120  Class rotorDisk Declaration
121 \*---------------------------------------------------------------------------*/
122 
123 class rotorDisk
124 :
125  public fvModel
126 {
127 public:
128 
129  enum geometryModeType
130  {
131  automatic,
133  };
135 
136  enum inletFlowType
137  {
141  };
143 
144 
145 private:
146 
147  // Helper structures to encapsulate flap and trim data
148  // Note: all input in degrees (converted to radians internally)
149 
150  struct flapData
151  {
152  scalar beta0; // coning angle
153  scalar beta1c; // lateral flapping coeff (cos coeff)
154  scalar beta2s; // longitudinal flapping coeff (sin coeff)
155  };
156 
157 
158  // Private data
159 
160  //- The set of cells the fvConstraint applies to
161  fvCellSet set_;
162 
163  //- Name of the velocity field
164  word UName_;
165 
166  //- Rotational speed [rad/s]
167  // Positive anti-clockwise when looking along -ve lift direction
168  scalar omega_;
169 
170  //- Number of blades
171  label nBlades_;
172 
173  //- Inlet flow type
174  inletFlowType inletFlow_;
175 
176  //- Inlet velocity for specified inflow
177  vector inletVelocity_;
178 
179  //- Tip effect [0-1]
180  // Ratio of blade radius beyond which lift=0
181  scalar tipEffect_;
182 
183  //- Blade flap coefficients [rad/s]
184  flapData flap_;
185 
186  //- Cell centre positions in local rotor frame
187  // (Cylindrical r, theta, z)
188  List<point> x_;
189 
190  //- Rotation tensor for flap angle
191  List<tensor> R_;
192 
193  //- Inverse rotation tensor for flap angle
194  List<tensor> invR_;
195 
196  //- Area [m^2]
197  List<scalar> area_;
198 
199  //- Rotor local cylindrical co-ordinate system (r, theta, z)
201 
202  //- Rotor transformation co-ordinate system
203  autoPtr<cylindrical> cylindrical_;
204 
205  //- Maximum radius
206  scalar rMax_;
207 
208  //- Trim model
209  autoPtr<trimModel> trim_;
210 
211  //- Blade data
212  bladeModel blade_;
213 
214  //- Profile data
215  profileModelList profiles_;
216 
217  //- Reference density for incompressible case
218  mutable scalar rhoRef_;
219 
220 
221  // Protected Member Functions
222 
223  //- Non-virtual read
224  void readCoeffs();
225 
226  //- Check data
227  void checkData();
228 
229  //- Set the face areas per cell, and optionally correct the rotor axis
230  void setFaceArea(vector& axis, const bool correct);
231 
232  //- Create the co-ordinate system
233  void createCoordinateSystem();
234 
235  //- Construct geometry
236  void constructGeometry();
237 
238  //- Return the inlet flow field
239  tmp<vectorField> inflowVelocity(const volVectorField& U) const;
240 
241  //- Helper function to write rotor data
242  template<class Type>
243  void writeField(const word& name, const List<Type>& values) const;
244 
245 
246 public:
247 
248  //- Runtime type information
249  TypeName("rotorDisk");
250 
251 
252  // Constructors
253 
254 
255  //- Construct from components
256  rotorDisk
257  (
258  const word& name,
259  const word& modelType,
260  const fvMesh& mesh,
261  const dictionary& dict
262  );
263 
264 
265  //- Destructor
266  virtual ~rotorDisk();
267 
268 
269  // Member Functions
270 
271  // Access
272 
273  //- Return the reference density for incompressible case
274  inline scalar rhoRef() const;
275 
276  //- Return the rotational speed [rad/s]
277  // Positive anti-clockwise when looking along -ve lift direction
278  inline scalar omega() const;
279 
280  inline const fvCellSet& set() const;
281 
282  //- Return the cell centre positions in local rotor frame
283  // (Cylindrical r, theta, z)
284  inline const List<point>& x() const;
285 
286  //- Return the rotor co-ordinate system (r, theta, z)
287  inline const coordinateSystems::cylindrical& coordSys() const;
288 
289 
290  // Checks
291 
292  //- Return the list of fields for which the fvModel adds source term
293  // to the transport equation
294  virtual wordList addSupFields() const;
295 
296 
297  // Evaluation
298 
299  //- Calculate forces
300  template<class RhoFieldType>
301  void calculate
302  (
303  const RhoFieldType& rho,
304  const vectorField& U,
305  const scalarField& thetag,
306  vectorField& force,
307  const bool divideVolume = true,
308  const bool output = true
309  ) const;
310 
311 
312  // Source term addition
313 
314  //- Source term to momentum equation
315  virtual void addSup
316  (
317  const volVectorField& U,
318  fvMatrix<vector>& eqn
319  ) const;
320 
321  //- Source term to compressible momentum equation
322  virtual void addSup
323  (
324  const volScalarField& rho,
325  const volVectorField& U,
326  fvMatrix<vector>& eqn
327  ) const;
328 
329 
330  // Mesh changes
331 
332  //- Update for mesh motion
333  virtual bool movePoints();
334 
335  //- Update topology using the given map
336  virtual void topoChange(const polyTopoChangeMap&);
337 
338  //- Update from another mesh using the given map
339  virtual void mapMesh(const polyMeshMap&);
340 
341  //- Redistribute or update using the given distribution map
342  virtual void distribute(const polyDistributionMap&);
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 "rotorDiskI.H"
360 
361 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
362 
363 #ifdef NoRepository
364  #include "rotorDiskTemplates.C"
365 #endif
366 
367 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
368 
369 #endif
370 
371 // ************************************************************************* //
Generic GeometricField class.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Blade model class calculates: Linear interpolated blade twist and chord based on radial position Inte...
Definition: bladeModel.H:65
Cylindrical coordinate system.
Definition: cylindricalCS.H:53
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
General run-time selected cell set selection class for fvMesh.
Definition: fvCellSet.H:88
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Finite volume model abstract base class.
Definition: fvModel.H:59
virtual void correct()
Correct the fvModel.
Definition: fvModel.C:195
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Cell based momentum source which approximates the mean effects of rotor forces on a cylindrical regio...
Definition: rotorDisk.H:125
virtual bool movePoints()
Update for mesh motion.
Definition: rotorDisk.C:631
virtual void addSup(const volVectorField &U, fvMatrix< vector > &eqn) const
Source term to momentum equation.
Definition: rotorDisk.C:554
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: rotorDisk.C:547
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
rotorDisk(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Definition: rotorDisk.C:507
scalar rhoRef() const
Return the reference density for incompressible case.
Definition: rotorDiskI.H:30
const List< point > & x() const
Return the cell centre positions in local rotor frame.
Definition: rotorDiskI.H:48
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
Definition: rotorDisk.H:141
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
Definition: rotorDisk.H:133
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
Definition: rotorDisk.C:638
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
Definition: rotorDisk.C:650
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: rotorDisk.C:656
scalar omega() const
Return the rotational speed [rad/s].
Definition: rotorDiskI.H:36
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Definition: rotorDisk.C:644
TypeName("rotorDisk")
Runtime type information.
const coordinateSystems::cylindrical & coordSys() const
Return the rotor co-ordinate system (r, theta, z)
Definition: rotorDiskI.H:55
virtual ~rotorDisk()
Destructor.
Definition: rotorDisk.C:541
const fvCellSet & set() const
Definition: rotorDiskI.H:42
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
List of profile models.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
U
Definition: pEqn.H:72
Namespace for OpenFOAM.
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
labelList fv(nPoints)
dictionary dict