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-2023 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 \*---------------------------------------------------------------------------*/
126 
127 class rotorDiskSource
128 :
129  public fvModel
130 {
131 public:
132 
133  enum geometryModeType
134  {
135  automatic,
137  };
139 
140  enum inletFlowType
141  {
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 fvMesh& mesh,
270  const dictionary& dict
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 changes
340 
341  //- Update for mesh motion
342  virtual bool movePoints();
343 
344  //- Update topology using the given map
345  virtual void topoChange(const polyTopoChangeMap&);
346 
347  //- Update from another mesh using the given map
348  virtual void mapMesh(const polyMeshMap&);
349 
350  //- Redistribute or update using the given distribution map
351  virtual void distribute(const polyDistributionMap&);
352 
353 
354  // IO
355 
356  //- Read source dictionary
357  virtual bool read(const dictionary& dict);
358 };
359 
360 
361 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
362 
363 } // End namespace fv
364 } // End namespace Foam
365 
366 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
367 
368 #include "rotorDiskSourceI.H"
369 
370 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
371 
372 #ifdef NoRepository
373  #include "rotorDiskSourceTemplates.C"
374 #endif
375 
376 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
377 
378 #endif
379 
380 // ************************************************************************* //
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:160
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:101
Finite volume model abstract base class.
Definition: fvModel.H:59
virtual void correct()
Correct the fvModel.
Definition: fvModel.C:199
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
Cell based momentum source which approximates the mean effects of rotor forces on a cylindrical regio...
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
scalar rhoRef() const
Return the reference density for incompressible case.
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
rotorDiskSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
const List< point > & x() const
Return the cell centre positions in local rotor frame.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void addSup(fvMatrix< vector > &eqn, const word &fieldName) const
Source term to momentum equation.
scalar omega() const
Return the rotational speed [rad/s].
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
TypeName("rotorDisk")
Runtime type information.
const coordinateSystems::cylindrical & coordSys() const
Return the rotor co-ordinate system (r, theta, z)
const fvCellSet & set() const
virtual ~rotorDiskSource()
Destructor.
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
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