rotorDiskSource.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 | Copyright (C) 2011-2016 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  Rotor disk source
29 
30  Cell based momemtum source which approximates the mean effects of
31  rotor forces on a cylindrical region within the domain.
32 
33 Usage
34  Example usage:
35  \verbatim
36  rotorDiskSourceCoeffs
37  {
38  fields (U); // names of fields on which to apply source
39  nBlades 3; // number of blades
40  tipEffect 0.96; // normalised radius above which lift = 0
41 
42  inletFlowType local; // inlet flow type specification
43 
44  geometryMode auto; // geometry specification
45 
46  refDirection (-1 0 0); // reference direction
47  // - used as reference for psi angle
48 
49  trimModel fixed; // fixed || targetForce
50 
51  flapCoeffs
52  {
53  beta0 0; // coning angle [deg]
54  beta1c 0; // lateral flapping coeff (cos coeff)
55  beta2s 0; // longitudinal flapping coeff (sin coeff)
56  }
57 
58  blade
59  {
60  // see bladeModel.H for documentation
61  }
62 
63  profiles
64  {
65  profile1
66  {
67  type lookup; // lookup || series
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 options for the \c geometryMode entry include:
81  - auto : determine rototor co-ord system from cells
82  - specified : specified co-ord system
83 
84  Valid options 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 "cellSetOption.H"
104 #include "cylindricalCS.H"
105 #include "cylindrical.H"
106 #include "NamedEnum.H"
107 #include "bladeModel.H"
108 #include "profileModelList.H"
109 #include "volFieldsFwd.H"
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 namespace Foam
114 {
115 
116 // Forward declaration of classes
117 class trimModel;
118 
119 namespace fv
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class rotorDiskSource Declaration
124 \*---------------------------------------------------------------------------*/
126 class rotorDiskSource
127 :
128  public cellSetOption
129 {
130 public:
132  enum geometryModeType
133  {
136  };
139  enum inletFlowType
140  {
143  ifLocal
144  };
146 
147 
148 protected:
149 
150  // Helper structures to encapsulate flap and trim data
151  // Note: all input in degrees (converted to radians internally)
153  struct flapData
154  {
155  scalar beta0; // coning angle
156  scalar beta1c; // lateral flapping coeff (cos coeff)
157  scalar beta2s; // longitudinal flapping coeff (sin coeff)
158  };
159 
160 
161  // Protected data
162 
163  //- Reference density for incompressible case
164  scalar rhoRef_;
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
175 
176  //- Inlet velocity for specified iinflow
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
192 
193  //- Inverse rotation tensor for flap angle
195 
196  //- Area [m2]
198 
199  //- Rotor local cylindrical co-ordinate system (r, theta, z)
201 
202  //- Rotor transformation co-ordinate system
204 
205  //- Maximum radius
206  scalar rMax_;
207 
208  //- Trim model
210 
211  //- Blade data
213 
214  //- Profile data
216 
217 
218  // Protected Member Functions
219 
220  //- Check data
221  void checkData();
222 
223  //- Set the face areas per cell, and optionally correct the rotor axis
224  void setFaceArea(vector& axis, const bool correct);
225 
226  //- Create the co-ordinate system
227  void createCoordinateSystem();
228 
229  //- Construct geometry
230  void constructGeometry();
231 
232  //- Return the inlet flow field
234 
235  //- Helper function to write rotor values
236  template<class Type>
237  void writeField
238  (
239  const word& name,
240  const List<Type>& values,
241  const bool writeNow = false
242  ) const;
243 
244 
245 public:
246 
247  //- Runtime type information
248  TypeName("rotorDisk");
249 
250 
251  // Constructors
252 
253 
254  //- Construct from components
256  (
257  const word& name,
258  const word& modelType,
259  const dictionary& dict,
260  const fvMesh& mesh
261  );
262 
263 
264  //- Destructor
265  virtual ~rotorDiskSource();
266 
267 
268  // Member Functions
269 
270  // Access
271 
272  //- Return the reference density for incompressible case
273  inline scalar rhoRef() const;
274 
275  //- Return the rotational speed [rad/s]
276  // Positive anti-clockwise when looking along -ve lift direction
277  inline scalar omega() const;
278 
279  //- Return the cell centre positions in local rotor frame
280  // (Cylindrical r, theta, z)
281  inline const List<point>& x() const;
282 
283  //- Return the rotor co-ordinate system (r, theta, z)
284  inline const cylindricalCS& coordSys() const;
285 
286 
287  // Evaluation
288 
289  //- Calculate forces
290  template<class RhoFieldType>
291  void calculate
292  (
293  const RhoFieldType& rho,
294  const vectorField& U,
295  const scalarField& thetag,
296  vectorField& force,
297  const bool divideVolume = true,
298  const bool output = true
299  ) const;
300 
301 
302  // Source term addition
303 
304  //- Source term to momentum equation
305  virtual void addSup
306  (
307  fvMatrix<vector>& eqn,
308  const label fieldi
309  );
310 
311  //- Source term to compressible momentum equation
312  virtual void addSup
313  (
314  const volScalarField& rho,
315  fvMatrix<vector>& eqn,
316  const label fieldi
317  );
318 
319 
320  // IO
321 
322  //- Read source dictionary
323  virtual bool read(const dictionary& dict);
324 };
325 
326 
327 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
328 
329 } // End namespace fv
330 } // End namespace Foam
331 
332 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
333 
334 #include "rotorDiskSourceI.H"
335 
336 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
337 
338 #ifdef NoRepository
339  #include "rotorDiskSourceTemplates.C"
340 #endif
341 
342 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
343 
344 #endif
345 
346 // ************************************************************************* //
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
scalar tipEffect_
Tip effect [0-1].
List< scalar > area_
Area [m2].
Blade model class calculates: Linear interpolated blade twist and chord based on radial position Inte...
Definition: bladeModel.H:64
dictionary dict
U
Definition: pEqn.H:83
virtual void correct(volScalarField &field)
Definition: fvOption.C:299
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
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
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual ~rotorDiskSource()
Destructor.
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
autoPtr< cylindrical > cylindrical_
Rotor transformation co-ordinate system.
scalar rhoRef_
Reference density for incompressible case.
Base class for profile models.
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
void constructGeometry()
Construct geometry.
scalar omega_
Rotational speed [rad/s].
label nBlades_
Number of blades.
Rotor disk source.
List< tensor > R_
Rotation tensor for flap angle.
Cylindrical coordinate system.
Definition: cylindricalCS.H:48
scalar rMax_
Maximum radius.
vector inletVelocity_
Inlet velocity for specified iinflow.
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:71
const List< point > & x() const
Return the cell centre positions in local rotor frame.
inletFlowType inletFlow_
Inlet flow type.
autoPtr< trimModel > trim_
Trim model.
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
scalar rhoRef() const
Return the reference density for incompressible case.
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
void checkData()
Check data.
profileModelList profiles_
Profile data.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
bladeModel blade_
Blade data.
flapData flap_
Blade flap coefficients [rad/s].
scalar omega() const
Return the rotational speed [rad/s].
cylindricalCS coordSys_
Rotor local cylindrical co-ordinate system (r, theta, z)
Cell-set options abtract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:72
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
List< point > x_
Cell centre positions in local rotor frame.
const cylindricalCS & coordSys() const
Return the rotor co-ordinate system (r, theta, z)
void setFaceArea(vector &axis, const bool correct)
Set the face areas per cell, and optionally correct the rotor axis.
A class for managing temporary objects.
Definition: PtrList.H:54
List< tensor > invR_
Inverse rotation tensor for flap angle.
void writeField(const word &name, const List< Type > &values, const bool writeNow=false) const
Helper function to write rotor values.
void createCoordinateSystem()
Create the co-ordinate system.
TypeName("rotorDisk")
Runtime type information.
Namespace for OpenFOAM.