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-2018 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  fields (U); // names of fields on which to apply source
37  nBlades 3; // number of blades
38  tipEffect 0.96; // normalised radius above which lift = 0
39 
40  inletFlowType local; // inlet flow type specification
41 
42  geometryMode auto; // geometry specification
43 
44  refDirection (-1 0 0); // reference direction
45  // - used as reference for psi angle
46 
47  trimModel fixed; // fixed || targetForce
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; // lookup || series
66  ...
67  // see lookupProfile.H or seriesProfile.H for documentation
68  }
69  profile2
70  {
71  ...
72  }
73  }
74  \endverbatim
75 
76  Where:
77  Valid options for the \c geometryMode entry include:
78  - auto : determine rototor co-ord system from cells
79  - specified : specified co-ord system
80 
81  Valid options for the \c inletFlowType entry include:
82  - fixed : specified velocity
83  - local : use local flow conditions
84  - surfaceNormal : specified normal velocity (positive towards rotor)
85 
86 See also
87  Foam::bladeModel
88  Foam::lookupProfile
89  Foam::seriesProfile
90 
91 SourceFiles
92  rotorDiskSource.C
93  rotorDiskSourceTemplates.C
94 
95 \*---------------------------------------------------------------------------*/
96 
97 #ifndef rotorDiskSource_H
98 #define rotorDiskSource_H
99 
100 #include "cellSetOption.H"
101 #include "cylindricalCS.H"
102 #include "cylindrical.H"
103 #include "NamedEnum.H"
104 #include "bladeModel.H"
105 #include "profileModelList.H"
106 #include "volFieldsFwd.H"
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 namespace Foam
111 {
112 
113 // Forward declaration of classes
114 class trimModel;
115 
116 namespace fv
117 {
118 
119 /*---------------------------------------------------------------------------*\
120  Class rotorDiskSource Declaration
121 \*---------------------------------------------------------------------------*/
123 class rotorDiskSource
124 :
125  public cellSetOption
126 {
127 public:
129  enum geometryModeType
130  {
133  };
136  enum inletFlowType
137  {
140  ifLocal
141  };
143 
144 
145 protected:
146 
147  // Helper structures to encapsulate flap and trim data
148  // Note: all input in degrees (converted to radians internally)
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  // Protected data
159 
160  //- Reference density for incompressible case
161  scalar rhoRef_;
162 
163  //- Rotational speed [rad/s]
164  // Positive anti-clockwise when looking along -ve lift direction
165  scalar omega_;
166 
167  //- Number of blades
168  label nBlades_;
169 
170  //- Inlet flow type
172 
173  //- Inlet velocity for specified iinflow
175 
176  //- Tip effect [0-1]
177  // Ratio of blade radius beyond which lift=0
178  scalar tipEffect_;
179 
180  //- Blade flap coefficients [rad/s]
181  flapData flap_;
182 
183  //- Cell centre positions in local rotor frame
184  // (Cylindrical r, theta, z)
185  List<point> x_;
186 
187  //- Rotation tensor for flap angle
189 
190  //- Inverse rotation tensor for flap angle
192 
193  //- Area [m2]
195 
196  //- Rotor local cylindrical co-ordinate system (r, theta, z)
198 
199  //- Rotor transformation co-ordinate system
201 
202  //- Maximum radius
203  scalar rMax_;
204 
205  //- Trim model
207 
208  //- Blade data
210 
211  //- Profile data
213 
214 
215  // Protected Member Functions
216 
217  //- Check data
218  void checkData();
219 
220  //- Set the face areas per cell, and optionally correct the rotor axis
221  void setFaceArea(vector& axis, const bool correct);
222 
223  //- Create the co-ordinate system
224  void createCoordinateSystem();
225 
226  //- Construct geometry
227  void constructGeometry();
228 
229  //- Return the inlet flow field
231 
232  //- Helper function to write rotor values
233  template<class Type>
234  void writeField
235  (
236  const word& name,
237  const List<Type>& values,
238  const bool writeNow = false
239  ) const;
240 
241 
242 public:
243 
244  //- Runtime type information
245  TypeName("rotorDisk");
246 
247 
248  // Constructors
249 
250 
251  //- Construct from components
253  (
254  const word& name,
255  const word& modelType,
256  const dictionary& dict,
257  const fvMesh& mesh
258  );
259 
260 
261  //- Destructor
262  virtual ~rotorDiskSource();
263 
264 
265  // Member Functions
266 
267  // Access
268 
269  //- Return the reference density for incompressible case
270  inline scalar rhoRef() const;
271 
272  //- Return the rotational speed [rad/s]
273  // Positive anti-clockwise when looking along -ve lift direction
274  inline scalar omega() const;
275 
276  //- Return the cell centre positions in local rotor frame
277  // (Cylindrical r, theta, z)
278  inline const List<point>& x() const;
279 
280  //- Return the rotor co-ordinate system (r, theta, z)
281  inline const cylindricalCS& coordSys() const;
282 
283 
284  // Evaluation
285 
286  //- Calculate forces
287  template<class RhoFieldType>
288  void calculate
289  (
290  const RhoFieldType& rho,
291  const vectorField& U,
292  const scalarField& thetag,
293  vectorField& force,
294  const bool divideVolume = true,
295  const bool output = true
296  ) const;
297 
298 
299  // Source term addition
300 
301  //- Source term to momentum equation
302  virtual void addSup
303  (
304  fvMatrix<vector>& eqn,
305  const label fieldi
306  );
307 
308  //- Source term to compressible momentum equation
309  virtual void addSup
310  (
311  const volScalarField& rho,
312  fvMatrix<vector>& eqn,
313  const label fieldi
314  );
315 
316 
317  // IO
318 
319  //- Read source dictionary
320  virtual bool read(const dictionary& dict);
321 };
322 
323 
324 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
325 
326 } // End namespace fv
327 } // End namespace Foam
328 
329 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330 
331 #include "rotorDiskSourceI.H"
332 
333 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
334 
335 #ifdef NoRepository
336  #include "rotorDiskSourceTemplates.C"
337 #endif
338 
339 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
340 
341 #endif
342 
343 // ************************************************************************* //
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
virtual void correct(volScalarField &field)
Definition: fvOption.C:306
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:60
const List< point > & x() const
Return the cell centre positions in local rotor frame.
virtual bool read(const dictionary &dict)
Read source dictionary.
const cylindricalCS & coordSys() const
Return the rotor co-ordinate system (r, theta, z)
virtual ~rotorDiskSource()
Destructor.
autoPtr< cylindrical > cylindrical_
Rotor transformation co-ordinate system.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
scalar rhoRef_
Reference density for incompressible case.
Base class for 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.
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:72
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
scalar rhoRef() const
Return the reference density for incompressible case.
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.
void checkData()
Check data.
U
Definition: pEqn.H:72
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].
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:69
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
List< point > x_
Cell centre positions in local rotor frame.
void writeField(const word &name, const List< Type > &values, const bool writeNow=false) const
Helper function to write rotor values.
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 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:53
List< tensor > invR_
Inverse rotation tensor for flap angle.
void createCoordinateSystem()
Create the co-ordinate system.
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
TypeName("rotorDisk")
Runtime type information.
Namespace for OpenFOAM.