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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2018-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::rotorDiskSource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Applies cell-based momentum sources on velocity (i.e. \c U)
35  within a specified cylindrical region to approximate the mean
36  effects of rotor forces.
37 
38  Sources applied to:
39  \verbatim
40  U | Velocity [m/s]
41  \endverbatim
42 
43  Required fields:
44  \verbatim
45  U | Velocity [m/s]
46  \endverbatim
47 
48 Usage
49  Minimal example by using \c constant/fvOptions:
50  rotorDiskSource1
51  {
52  // Mandatory entries (unmodifiable)
53  type rotorDiskSource;
54 
55  // Mandatory entries (runtime modifiable)
56  fields (<field1> <field2> ... <fieldN>);
57  rhoRef 1.0;
58  rpm 5.5;
59  nBlades 3;
60  inletFlowType local;
61  geometryMode auto;
62  tipEffect 0.96; // [0, 1]
63  refDirection (-1 0 0 );
64  flapCoeffs
65  {
66  beta0 0.0;
67  beta1c 0.0;
68  beta2s 0.0;
69  }
70 
71  trimModel fixed;
72 
73  blade
74  {
75  // see bladeModel.H for documentation
76  }
77 
78  profiles
79  {
80  profile1
81  {
82  type lookup; // lookup || series
83  ...
84  // see lookupProfile.H or seriesProfile.H for documentation
85  }
86  profile2
87  {
88  ...
89  }
90  }
91 
92  // Conditional mandatory entries (runtime modifiable)
93 
94  // when inletFlowType=fixed
95  inletVelocity (1 0 0);
96 
97  // when inletFlowType=surfaceNormal
98  inletNormalVelocity 5.0;
99 
100  // when geometryMode=auto
101  pointAbove (1 0 0);
102 
103  // when geometryMode=specified
104  origin (0 0 0);
105  axis (1 0 0);
106 
107  // Mandatory/Optional (inherited) entries
108  ...
109  }
110 
111  where the entries mean:
112  \table
113  Property | Description | Type | Reqd | Dflt
114  type | Type name: rotorDiskSource | word | yes | -
115  fields | Names of operand fields | wordList | yes | -
116  rhoRef | Reference density for incompressible case | scalar | yes | -
117  rpm | Rotational speed [rad/s] | scalar | yes | -
118  nBlades | Number of rotor blades | label | yes | -
119  tipEffect | Ratio of blade radius beyond which lift=0 | scalar | yes | -
120  refDirection | Reference direction used as reference <!--
121  --> for psi angle | vector | yes | -
122  beta0 | Coning angle [deg] | scalar | yes | -
123  beta1c | Lateral flapping coeff (cos coeff) [deg] | scalar | yes | -
124  beta2s | Longitudinal flapping coeff (sin coeff) [deg] | scalar | yes | -
125  inletFlowType | Inlet flow type specification | word | yes | -
126  inletVelocity | Inlet velocity [m/s] | vector | cndtnl | -
127  inletNormalVelocity | Inlet normal velocity magnitude <!--
128  --> | scalar | cndtnl | -
129  geometryMode | Geometry mode specification | word | yes | -
130  pointAbove | Correct the axis direction using a point <!--
131  --> above the rotor | vector | cndtnl | -
132  origin | Origin of the specified coordinate system | vector | cndtnl | -
133  axis | Axis of the specified coordinate system | vector | cndtnl | -
134  trimModel | Trim model specification | word | yes | -
135  blade | Blade properties | dictionary | yes | -
136  \endtable
137 
138  The inherited entries are elaborated in:
139  - \link fvOption.H \endlink
140  - \link cellSetOption.H \endlink
141  - \link trimModel.H \endlink
142  - \link bladeModel.H \endlink
143  - \link profileModel.H \endlink
144 
145  Options for the \c inletFlowType entry:
146  \verbatim
147  fixed | Use a specified velocity
148  local | Use local flow conditions
149  surfaceNormal | Use a specified normal velocity (positive towards rotor)
150  \endverbatim
151 
152  Options for the \c geometryMode entry:
153  \verbatim
154  auto | Determine rotor coordinate system from selected cells
155  specified | Use a specified coordinate system
156  \endverbatim
157 
158  Options for the \c trimModel entry:
159  \verbatim
160  fixed | Fixed blade/angle characteristics
161  targetForce | Target thrust/torque by using time-variant blade characs.
162  \endverbatim
163 
164 Note
165  - The entry \c rpm is positive anti-clockwise
166  when looking along -ve lift direction.
167 
168 See also
169  - Foam::trimModel
170  - Foam::bladeModel
171  - Foam::lookupProfile
172  - Foam::seriesProfile
173 
174 SourceFiles
175  rotorDiskSource.C
176  rotorDiskSourceTemplates.C
177 
178 \*---------------------------------------------------------------------------*/
179 
180 #ifndef rotorDiskSource_H
181 #define rotorDiskSource_H
182 
183 #include "cellSetOption.H"
184 #include "cylindricalCS.H"
185 #include "Enum.H"
186 #include "bladeModel.H"
187 #include "profileModelList.H"
188 #include "volFieldsFwd.H"
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 namespace Foam
193 {
194 
195 // Forward declarations
196 class trimModel;
197 
198 namespace fv
199 {
200 
201 /*---------------------------------------------------------------------------*\
202  Class rotorDiskSource Declaration
203 \*---------------------------------------------------------------------------*/
204 
205 class rotorDiskSource
206 :
207  public fv::cellSetOption
208 {
209 public:
210 
211  // Public Enumerations
212 
213  //- Options for the geometry type specification
214  enum geometryModeType
215  {
216  gmAuto,
218  };
219 
220  //- Names for geometryModeType
221  static const Enum<geometryModeType> geometryModeTypeNames_;
222 
223  //- Options for the inlet flow type specification
224  enum inletFlowType
225  {
226  ifFixed,
228  ifLocal
229  };
230 
231  //- Names for inletFlowType
232  static const Enum<inletFlowType> inletFlowTypeNames_;
233 
234 
235 protected:
236 
237  // Helper structures to encapsulate flap and trim data
238  // Note: all input in degrees (converted to radians internally)
239 
240  struct flapData
241  {
242  scalar beta0; // coning angle
243  scalar beta1c; // lateral flapping coeff (cos coeff)
244  scalar beta2s; // longitudinal flapping coeff (sin coeff)
245  };
246 
247 
248  // Protected Data
249 
250  //- Reference density for incompressible case
251  scalar rhoRef_;
252 
253  //- Rotational speed [rad/s]
254  // Positive anti-clockwise when looking along -ve lift direction
255  scalar omega_;
256 
257  //- Number of blades
258  label nBlades_;
259 
260  //- Inlet flow type
262 
263  //- Inlet velocity for specified inflow
265 
266  //- Tip effect [0-1]
267  // Ratio of blade radius beyond which lift=0
268  scalar tipEffect_;
269 
270  //- Blade flap coefficients [rad/s]
271  flapData flap_;
272 
273  //- Cell centre positions in local rotor frame
274  // (Cylindrical r-theta-z)
275  List<point> x_;
276 
277  //- Rotation tensor for flap angle
278  List<tensor> Rcone_;
279 
280  //- Area [m2]
281  List<scalar> area_;
282 
283  //- Rotor local cylindrical coordinate system (r-theta-z)
284  coordSystem::cylindrical coordSys_;
285 
286  //- Cached rotation tensors for cylindrical coordinates
287  autoPtr<tensorField> Rcyl_;
288 
289  //- Maximum radius
290  scalar rMax_;
291 
292  //- Trim model
293  autoPtr<trimModel> trim_;
294 
295  //- Blade data
296  bladeModel blade_;
297 
298  //- Profile data
299  profileModelList profiles_;
300 
301 
302  // Protected Member Functions
303 
304  //- Check data
305  void checkData();
306 
307  //- Set the face areas per cell, and optionally correct the rotor axis
308  void setFaceArea(vector& axis, const bool correct);
309 
310  //- Create the coordinate system
311  void createCoordinateSystem();
312 
313  //- Construct geometry
314  void constructGeometry();
315 
316  //- Return the inlet flow field
317  tmp<vectorField> inflowVelocity(const volVectorField& U) const;
318 
319  //- Helper function to write rotor values
320  template<class Type>
321  void writeField
322  (
323  const word& name,
324  const List<Type>& values,
325  const bool writeNow = false
326  ) const;
327 
328 
329 public:
330 
331  //- Runtime type information
332  TypeName("rotorDisk");
333 
334 
335  // Constructors
336 
337  //- Construct from components
339  (
340  const word& name,
341  const word& modelType,
342  const dictionary& dict,
343  const fvMesh& mesh
344  );
345 
346  //- No copy construct
347  rotorDiskSource(const rotorDiskSource&) = delete;
348 
349  //- No copy assignment
350  void operator=(const rotorDiskSource&) = delete;
351 
352 
353  //- Destructor
354  virtual ~rotorDiskSource() = default;
355 
356 
357  // Member Functions
358 
359  // Access
360 
361  //- Return the reference density for incompressible case
362  inline scalar rhoRef() const;
363 
364  //- Return the rotational speed [rad/s]
365  // Positive anti-clockwise when looking along -ve lift direction
366  inline scalar omega() const;
367 
368  //- Return the cell centre positions in local rotor frame
369  // (Cylindrical r-theta-z)
370  inline const List<point>& x() const;
371 
372  //- Return the rotor coordinate system (r-theta-z)
373  inline const coordSystem::cylindrical& coordSys() const;
374 
375 
376  // Evaluation
377 
378  //- Calculate forces
379  template<class RhoFieldType>
381  (
382  const RhoFieldType& rho,
383  const vectorField& U,
384  const scalarField& thetag,
385  vectorField& force,
386  const bool divideVolume = true,
387  const bool output = true
388  ) const;
389 
390 
391  // Source term addition
392 
393  //- Add explicit contribution to momentum equation
394  virtual void addSup
395  (
397  const label fieldi
398  );
399 
400  //- Add explicit contribution to compressible momentum equation
401  virtual void addSup
402  (
404  fvMatrix<vector>& eqn,
405  const label fieldi
406  );
407 
408 
409  // IO
410 
411  //- Read source dictionary
412  virtual bool read(const dictionary& dict);
413 };
414 
415 
416 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
417 
418 } // End namespace fv
419 } // End namespace Foam
420 
421 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
422 
423 #include "rotorDiskSourceI.H"
424 
425 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
426 
427 #ifdef NoRepository
428  #include "rotorDiskSourceTemplates.C"
429 #endif
430 
431 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
432 
433 #endif
434 
435 // ************************************************************************* //
Foam::fv::rotorDiskSource::checkData
void checkData()
Check data.
Definition: rotorDiskSource.C:76
Foam::fv::option::correct
virtual void correct(volScalarField &field)
Definition: fvOption.C:318
Foam::fv::rotorDiskSource::profiles_
profileModelList profiles_
Profile data.
Definition: rotorDiskSource.H:424
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:39
Foam::fv::rotorDiskSource::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: rotorDiskSource.C:545
rotorDiskSourceI.H
Foam::fv::rotorDiskSource::operator=
void operator=(const rotorDiskSource &)=delete
No copy assignment.
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::Enum< geometryModeType >
Foam::output
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66
Foam::fv::rotorDiskSource::coordSys
const coordSystem::cylindrical & coordSys() const
Return the rotor coordinate system (r-theta-z)
Definition: rotorDiskSourceI.H:51
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Foam::fv::rotorDiskSource::createCoordinateSystem
void createCoordinateSystem()
Create the coordinate system.
Definition: rotorDiskSource.C:264
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:128
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::fv::rotorDiskSource::rhoRef_
scalar rhoRef_
Reference density for incompressible case.
Definition: rotorDiskSource.H:376
Foam::HashTableOps::values
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:149
Foam::fv::rotorDiskSource::omega_
scalar omega_
Rotational speed [rad/s].
Definition: rotorDiskSource.H:380
Foam::fv::rotorDiskSource::ifSurfaceNormal
Definition: rotorDiskSource.H:352
Foam::fv::rotorDiskSource::Rcyl_
autoPtr< tensorField > Rcyl_
Cached rotation tensors for cylindrical coordinates.
Definition: rotorDiskSource.H:412
Foam::fv::rotorDiskSource::rMax_
scalar rMax_
Maximum radius.
Definition: rotorDiskSource.H:415
Foam::fv::rotorDiskSource::omega
scalar omega() const
Return the rotational speed [rad/s].
Definition: rotorDiskSourceI.H:38
Foam::fv::rotorDiskSource::inletVelocity_
vector inletVelocity_
Inlet velocity for specified inflow.
Definition: rotorDiskSource.H:389
Foam::fv::rotorDiskSource::TypeName
TypeName("rotorDisk")
Runtime type information.
Foam::fv::rotorDiskSource::geometryModeType
geometryModeType
Options for the geometry type specification.
Definition: rotorDiskSource.H:339
Foam::fv::rotorDiskSource::flapData
Definition: rotorDiskSource.H:365
Foam::bladeModel
Blade model class calculates:
Definition: bladeModel.H:144
Foam::fv::rotorDiskSource::area_
List< scalar > area_
Area [m2].
Definition: rotorDiskSource.H:406
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::fv::rotorDiskSource::addSup
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
Definition: rotorDiskSource.C:478
Foam::fv::rotorDiskSource::gmSpecified
Definition: rotorDiskSource.H:342
Foam::fv::rotorDiskSource::x
const List< point > & x() const
Return the cell centre positions in local rotor frame.
Definition: rotorDiskSourceI.H:44
Foam::fv::rotorDiskSource::rhoRef
scalar rhoRef() const
Return the reference density for incompressible case.
Definition: rotorDiskSourceI.H:32
Foam::Field< vector >
Foam::profileModelList
Base class for profile models.
Definition: profileModelList.H:51
Foam::fv::rotorDiskSource::rotorDiskSource
rotorDiskSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: rotorDiskSource.C:446
Foam::fv::rotorDiskSource
Applies cell-based momentum sources on velocity (i.e. U) within a specified cylindrical region to app...
Definition: rotorDiskSource.H:330
bladeModel.H
Foam::fv::rotorDiskSource::flapData::beta0
scalar beta0
Definition: rotorDiskSource.H:367
Foam::fv::rotorDiskSource::constructGeometry
void constructGeometry()
Construct geometry.
Definition: rotorDiskSource.C:378
cylindricalCS.H
Foam::coordSystem::cylindrical
A cylindrical coordinate system (r-theta-z). The coordinate system angle theta is always in radians.
Definition: cylindricalCS.H:71
Foam::fv::rotorDiskSource::nBlades_
label nBlades_
Number of blades.
Definition: rotorDiskSource.H:383
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::fv::rotorDiskSource::flap_
flapData flap_
Blade flap coefficients [rad/s].
Definition: rotorDiskSource.H:396
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
profileModelList.H
Foam::fv::rotorDiskSource::x_
List< point > x_
Cell centre positions in local rotor frame.
Definition: rotorDiskSource.H:400
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:175
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::rotorDiskSource::flapData::beta1c
scalar beta1c
Definition: rotorDiskSource.H:368
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::fv::rotorDiskSource::blade_
bladeModel blade_
Blade data.
Definition: rotorDiskSource.H:421
Foam::fv::rotorDiskSource::geometryModeTypeNames_
static const Enum< geometryModeType > geometryModeTypeNames_
Names for geometryModeType.
Definition: rotorDiskSource.H:346
Foam::fv::rotorDiskSource::flapData::beta2s
scalar beta2s
Definition: rotorDiskSource.H:369
Foam::fv::rotorDiskSource::inletFlowTypeNames_
static const Enum< inletFlowType > inletFlowTypeNames_
Names for inletFlowType.
Definition: rotorDiskSource.H:357
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:62
fv
labelList fv(nPoints)
Foam::fv::rotorDiskSource::ifFixed
Definition: rotorDiskSource.H:351
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
U
U
Definition: pEqn.H:72
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fv::rotorDiskSource::gmAuto
Definition: rotorDiskSource.H:341
Foam::fv::rotorDiskSource::coordSys_
coordSystem::cylindrical coordSys_
Rotor local cylindrical coordinate system (r-theta-z)
Definition: rotorDiskSource.H:409
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::fv::rotorDiskSource::tipEffect_
scalar tipEffect_
Tip effect [0-1].
Definition: rotorDiskSource.H:393
rotorDiskSourceTemplates.C
Foam::fv::rotorDiskSource::inletFlowType
inletFlowType
Options for the inlet flow type specification.
Definition: rotorDiskSource.H:349
Foam::fv::rotorDiskSource::inflowVelocity
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
Definition: rotorDiskSource.C:413
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:386
Foam::fv::rotorDiskSource::trim_
autoPtr< trimModel > trim_
Trim model.
Definition: rotorDiskSource.H:418
Foam::fv::rotorDiskSource::~rotorDiskSource
virtual ~rotorDiskSource()=default
Destructor.
Foam::fv::rotorDiskSource::ifLocal
Definition: rotorDiskSource.H:353
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::fv::rotorDiskSource::Rcone_
List< tensor > Rcone_
Rotation tensor for flap angle.
Definition: rotorDiskSource.H:403
Enum.H