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-2015 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  \heading Source usage
34 
35  Example usage:
36  \verbatim
37  rotorDiskSourceCoeffs
38  {
39  fieldNames (U); // names of fields on which to apply source
40  nBlades 3; // number of blades
41  tipEffect 0.96; // normalised radius above which lift = 0
42 
43  inletFlowType local; // inlet flow type specification
44 
45  geometryMode auto; // geometry specification
46 
47  refDirection (-1 0 0); // reference direction
48  // - used as reference for psi angle
49 
50  trimModel fixed; // fixed || targetForce
51 
52  flapCoeffs
53  {
54  beta0 0; // coning angle [deg]
55  beta1c 0; // lateral flapping coeff (cos coeff)
56  beta2s 0; // longitudinal flapping coeff (sin coeff)
57  }
58 
59  blade
60  {
61  // see bladeModel.H for documentation
62  }
63 
64  profiles
65  {
66  profile1
67  {
68  type lookup; // lookup || series
69  ...
70  // see lookupProfile.H or seriesProfile.H for documentation
71  }
72  profile2
73  {
74  ...
75  }
76  }
77  }
78  \endverbatim
79 
80  Where:
81  Valid options for the \c geometryMode entry include:
82  - auto : determine rototor co-ord system from cells
83  - specified : specified co-ord system
84 
85  Valid options for the \c inletFlowType entry include:
86  - fixed : specified velocity
87  - local : use local flow conditions
88  - surfaceNormal : specified normal velocity (positive towards rotor)
89 
90 See Also
91  Foam::bladeModel
92  Foam::lookupProfile
93  Foam::seriesProfile
94 
95 SourceFiles
96  rotorDiskSource.C
97  rotorDiskSourceTemplates.C
98 
99 \*---------------------------------------------------------------------------*/
100 
101 #ifndef rotorDiskSource_H
102 #define rotorDiskSource_H
103 
104 #include "cellSetOption.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 cellSetOption
130 {
131 public:
132 
133  enum geometryModeType
134  {
137  };
139 
140  enum inletFlowType
141  {
144  ifLocal
145  };
147 
148 
149 protected:
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  // Protected data
163 
164  //- Reference density for incompressible case
165  scalar rhoRef_;
166 
167  //- Rotational speed [rad/s]
168  // Positive anti-clockwise when looking along -ve lift direction
169  scalar omega_;
170 
171  //- Number of blades
172  label nBlades_;
173 
174  //- Inlet flow type
176 
177  //- Inlet velocity for specified iinflow
179 
180  //- Tip effect [0-1]
181  // Ratio of blade radius beyond which lift=0
182  scalar tipEffect_;
183 
184  //- Blade flap coefficients [rad/s]
185  flapData flap_;
186 
187  //- Cell centre positions in local rotor frame
188  // (Cylindrical r, theta, z)
189  List<point> x_;
190 
191  //- Rotation tensor for flap angle
193 
194  //- Inverse rotation tensor for flap angle
196 
197  //- Area [m2]
199 
200  //- Rotor local cylindrical co-ordinate system (r, theta, z)
202 
203  //- Rotor transformation co-ordinate system
205 
206  //- Maximum radius
207  scalar rMax_;
208 
209  //- Trim model
211 
212  //- Blade data
214 
215  //- Profile data
217 
218 
219  // Protected Member Functions
220 
221  //- Check data
222  void checkData();
223 
224  //- Set the face areas per cell, and optionally correct the rotor axis
225  void setFaceArea(vector& axis, const bool correct);
226 
227  //- Create the co-ordinate system
228  void createCoordinateSystem();
229 
230  //- Construct geometry
231  void constructGeometry();
232 
233  //- Return the inlet flow field
235 
236  //- Helper function to write rotor values
237  template<class Type>
238  void writeField
239  (
240  const word& name,
241  const List<Type>& values,
242  const bool writeNow = false
243  ) const;
244 
245 
246 public:
247 
248  //- Runtime type information
249  TypeName("rotorDisk");
250 
251 
252  // Constructors
253 
254 
255  //- Construct from components
257  (
258  const word& name,
259  const word& modelType,
260  const dictionary& dict,
261  const fvMesh& mesh
262  );
263 
264 
265  //- Destructor
266  virtual ~rotorDiskSource();
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  //- Return the cell centre positions in local rotor frame
281  // (Cylindrical r, theta, z)
282  inline const List<point>& x() const;
283 
284  //- Return the rotor co-ordinate system (r, theta, z)
285  inline const cylindricalCS& coordSys() const;
286 
287 
288  // Evaluation
289 
290  //- Calculate forces
291  template<class RhoFieldType>
292  void calculate
293  (
294  const RhoFieldType& rho,
295  const vectorField& U,
296  const scalarField& thetag,
297  vectorField& force,
298  const bool divideVolume = true,
299  const bool output = true
300  ) const;
301 
302 
303  // Source term addition
304 
305  //- Source term to momentum equation
306  virtual void addSup
307  (
308  fvMatrix<vector>& eqn,
309  const label fieldI
310  );
311 
312  //- Source term to compressible momentum equation
313  virtual void addSup
314  (
315  const volScalarField& rho,
316  fvMatrix<vector>& eqn,
317  const label fieldI
318  );
319 
320 
321  // IO
322 
323  //- Read source dictionary
324  virtual bool read(const dictionary& dict);
325 };
326 
327 
328 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
329 
330 } // End namespace fv
331 } // End namespace Foam
332 
333 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
334 
335 #include "rotorDiskSourceI.H"
336 
337 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
338 
339 #ifdef NoRepository
340  #include "rotorDiskSourceTemplates.C"
341 #endif
342 
343 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
344 
345 #endif
346 
347 // ************************************************************************* //
Foam::fv::rotorDiskSource::checkData
void checkData()
Check data.
Definition: rotorDiskSource.C:70
Foam::fv::option::correct
virtual void correct(volScalarField &field)
Definition: fvOption.C:299
Foam::fv::rotorDiskSource::profiles_
profileModelList profiles_
Profile data.
Definition: rotorDiskSource.H:215
volFieldsFwd.H
Foam::fv::rotorDiskSource::calculate
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
Definition: rotorDiskSourceTemplates.C:36
Foam::fv::rotorDiskSource::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: rotorDiskSource.C:586
rotorDiskSourceI.H
Foam::fv::rotorDiskSource::invR_
List< tensor > invR_
Inverse rotation tensor for flap angle.
Definition: rotorDiskSource.H:194
cylindrical.H
Foam::fv::rotorDiskSource::coordSys_
cylindricalCS coordSys_
Rotor local cylindrical co-ordinate system (r, theta, z)
Definition: rotorDiskSource.H:200
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fv::rotorDiskSource::cylindrical_
autoPtr< cylindrical > cylindrical_
Rotor transformation co-ordinate system.
Definition: rotorDiskSource.H:203
Foam::fv::cellSetOption
Cell-set options abtract base class. Provides a base set of controls, e.g.
Definition: cellSetOption.H:71
Foam::fv::rotorDiskSource::addSup
virtual void addSup(fvMatrix< vector > &eqn, const label fieldI)
Source term to momentum equation.
Definition: rotorDiskSource.C:509
Foam::fv::rotorDiskSource::createCoordinateSystem
void createCoordinateSystem()
Create the co-ordinate system.
Definition: rotorDiskSource.C:263
Foam::fv::rotorDiskSource::setFaceArea
void setFaceArea(vector &axis, const bool correct)
Set the face areas per cell, and optionally correct the rotor axis.
Definition: rotorDiskSource.C:127
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
Foam::fv::rotorDiskSource::rhoRef_
scalar rhoRef_
Reference density for incompressible case.
Definition: rotorDiskSource.H:164
Foam::fv::rotorDiskSource::omega_
scalar omega_
Rotational speed [rad/s].
Definition: rotorDiskSource.H:168
Foam::fv::rotorDiskSource::ifSurfaceNormal
@ ifSurfaceNormal
Definition: rotorDiskSource.H:142
Foam::fv::rotorDiskSource::R_
List< tensor > R_
Rotation tensor for flap angle.
Definition: rotorDiskSource.H:191
NamedEnum.H
Foam::fv::rotorDiskSource::rMax_
scalar rMax_
Maximum radius.
Definition: rotorDiskSource.H:206
Foam::fv::rotorDiskSource::omega
scalar omega() const
Return the rotational speed [rad/s].
Definition: rotorDiskSourceI.H:36
Foam::fv::rotorDiskSource::inletVelocity_
vector inletVelocity_
Inlet velocity for specified iinflow.
Definition: rotorDiskSource.H:177
Foam::fv::rotorDiskSource::TypeName
TypeName("rotorDisk")
Runtime type information.
Foam::fv::rotorDiskSource::geometryModeType
geometryModeType
Definition: rotorDiskSource.H:132
Foam::fv::rotorDiskSource::flapData
Definition: rotorDiskSource.H:153
Foam::cylindricalCS
Cylindrical coordinate system.
Definition: cylindricalCS.H:48
Foam::bladeModel
Blade model class calculates: Linear interpolated blade twist and chord based on radial position Inte...
Definition: bladeModel.H:64
Foam::fv::rotorDiskSource::area_
List< scalar > area_
Area [m2].
Definition: rotorDiskSource.H:197
cellSetOption.H
U
U
Definition: pEqn.H:46
Foam::fv::rotorDiskSource::coordSys
const cylindricalCS & coordSys() const
Return the rotor co-ordinate system (r, theta, z)
Definition: rotorDiskSourceI.H:48
Foam::fv::rotorDiskSource::~rotorDiskSource
virtual ~rotorDiskSource()
Destructor.
Definition: rotorDiskSource.C:502
Foam::fv::rotorDiskSource::inletFlowTypeNames_
static const NamedEnum< inletFlowType, 3 > inletFlowTypeNames_
Definition: rotorDiskSource.H:145
Foam::fv::rotorDiskSource::gmSpecified
@ gmSpecified
Definition: rotorDiskSource.H:135
Foam::fv::rotorDiskSource::x
const List< point > & x() const
Return the cell centre positions in local rotor frame.
Definition: rotorDiskSourceI.H:42
Foam::fv::rotorDiskSource::rhoRef
scalar rhoRef() const
Return the reference density for incompressible case.
Definition: rotorDiskSourceI.H:30
Foam::label
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
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::profileModelList
Base class for profile models.
Definition: profileModelList.H:49
Foam::fv::rotorDiskSource::rotorDiskSource
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: rotorDiskSource.C:469
Foam::fv::rotorDiskSource
Rotor disk source.
Definition: rotorDiskSource.H:126
bladeModel.H
Foam::fv::rotorDiskSource::flapData::beta0
scalar beta0
Definition: rotorDiskSource.H:155
Foam::fv::rotorDiskSource::constructGeometry
void constructGeometry()
Construct geometry.
Definition: rotorDiskSource.C:398
cylindricalCS.H
Foam::fv::rotorDiskSource::nBlades_
label nBlades_
Number of blades.
Definition: rotorDiskSource.H:171
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::fv::rotorDiskSource::flap_
flapData flap_
Blade flap coefficients [rad/s].
Definition: rotorDiskSource.H:184
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
profileModelList.H
Foam::fv::rotorDiskSource::x_
List< point > x_
Cell centre positions in local rotor frame.
Definition: rotorDiskSource.H:188
Foam::fv::rotorDiskSource::writeField
void writeField(const word &name, const List< Type > &values, const bool writeNow=false) const
Helper function to write rotor values.
Definition: rotorDiskSourceTemplates.C:162
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fv::rotorDiskSource::flapData::beta1c
scalar beta1c
Definition: rotorDiskSource.H:156
Foam::fv::rotorDiskSource::blade_
bladeModel blade_
Blade data.
Definition: rotorDiskSource.H:212
Foam::fv::rotorDiskSource::flapData::beta2s
scalar beta2s
Definition: rotorDiskSource.H:157
rho
rho
Definition: pEqn.H:3
fv
labelList fv(nPoints)
Foam::fv::rotorDiskSource::ifFixed
@ ifFixed
Definition: rotorDiskSource.H:141
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::fv::rotorDiskSource::gmAuto
@ gmAuto
Definition: rotorDiskSource.H:134
Foam::Vector< scalar >
Foam::fv::rotorDiskSource::geometryModeTypeNames_
static const NamedEnum< geometryModeType, 2 > geometryModeTypeNames_
Definition: rotorDiskSource.H:137
Foam::List
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
Foam::fv::rotorDiskSource::tipEffect_
scalar tipEffect_
Tip effect [0-1].
Definition: rotorDiskSource.H:181
rotorDiskSourceTemplates.C
Foam::fv::rotorDiskSource::inletFlowType
inletFlowType
Definition: rotorDiskSource.H:139
Foam::fv::rotorDiskSource::inflowVelocity
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
Definition: rotorDiskSource.C:433
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fv::rotorDiskSource::inletFlow_
inletFlowType inletFlow_
Inlet flow type.
Definition: rotorDiskSource.H:174
Foam::fv::rotorDiskSource::trim_
autoPtr< trimModel > trim_
Trim model.
Definition: rotorDiskSource.H:209
Foam::fv::rotorDiskSource::ifLocal
@ ifLocal
Definition: rotorDiskSource.H:143
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::NamedEnum< geometryModeType, 2 >