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 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  Rotor disk source
35 
36  Cell based momemtum source which approximates the mean effects of
37  rotor forces on a cylindrical region within the domain.
38 
39 Usage
40  Example usage:
41  \verbatim
42  fields (U); // names of fields on which to apply source
43  nBlades 3; // number of blades
44  tipEffect 0.96; // normalised radius above which lift = 0
45 
46  inletFlowType local; // inlet flow type specification
47 
48  geometryMode auto; // geometry specification
49 
50  refDirection (-1 0 0); // reference direction
51  // - used as reference for psi angle
52 
53  trimModel fixed; // fixed || targetForce
54 
55  flapCoeffs
56  {
57  beta0 0; // coning angle [deg]
58  beta1c 0; // lateral flapping coeff (cos coeff)
59  beta2s 0; // longitudinal flapping coeff (sin coeff)
60  }
61 
62  blade
63  {
64  // see bladeModel.H for documentation
65  }
66 
67  profiles
68  {
69  profile1
70  {
71  type lookup; // lookup || series
72  ...
73  // see lookupProfile.H or seriesProfile.H for documentation
74  }
75  profile2
76  {
77  ...
78  }
79  }
80  \endverbatim
81 
82  Where:
83  Valid options for the \c geometryMode entry include:
84  - auto : determine rotor coordinate system from cells
85  - specified : specified coordinate system
86 
87  Valid options for the \c inletFlowType entry include:
88  - fixed : specified velocity
89  - local : use local flow conditions
90  - surfaceNormal : specified normal velocity (positive towards rotor)
91 
92 See also
93  Foam::bladeModel
94  Foam::lookupProfile
95  Foam::seriesProfile
96 
97 SourceFiles
98  rotorDiskSource.C
99  rotorDiskSourceTemplates.C
100 
101 \*---------------------------------------------------------------------------*/
102 
103 #ifndef rotorDiskSource_H
104 #define rotorDiskSource_H
105 
106 #include "cellSetOption.H"
107 #include "cylindricalCS.H"
108 #include "Enum.H"
109 #include "bladeModel.H"
110 #include "profileModelList.H"
111 #include "volFieldsFwd.H"
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 namespace Foam
116 {
117 
118 // Forward declarations
119 class trimModel;
120 
121 namespace fv
122 {
123 
124 /*---------------------------------------------------------------------------*\
125  Class rotorDiskSource Declaration
126 \*---------------------------------------------------------------------------*/
127 
128 class rotorDiskSource
129 :
130  public cellSetOption
131 {
132 public:
133 
134  enum geometryModeType
135  {
138  };
140 
141  enum inletFlowType
142  {
145  ifLocal
146  };
148 
149 
150 protected:
151 
152  // Helper structures to encapsulate flap and trim data
153  // Note: all input in degrees (converted to radians internally)
154 
155  struct flapData
156  {
157  scalar beta0; // coning angle
158  scalar beta1c; // lateral flapping coeff (cos coeff)
159  scalar beta2s; // longitudinal flapping coeff (sin coeff)
160  };
161 
162 
163  // Protected data
164 
165  //- Reference density for incompressible case
166  scalar rhoRef_;
167 
168  //- Rotational speed [rad/s]
169  // Positive anti-clockwise when looking along -ve lift direction
170  scalar omega_;
171 
172  //- Number of blades
173  label nBlades_;
174 
175  //- Inlet flow type
177 
178  //- Inlet velocity for specified inflow
180 
181  //- Tip effect [0-1]
182  // Ratio of blade radius beyond which lift=0
183  scalar tipEffect_;
184 
185  //- Blade flap coefficients [rad/s]
186  flapData flap_;
187 
188  //- Cell centre positions in local rotor frame
189  // (Cylindrical r-theta-z)
190  List<point> x_;
191 
192  //- Rotation tensor for flap angle
194 
195  //- Area [m2]
197 
198  //- Rotor local cylindrical coordinate system (r-theta-z)
200 
201  //- Cached rotation tensors for cylindrical coordinates
203 
204  //- Maximum radius
205  scalar rMax_;
206 
207  //- Trim model
209 
210  //- Blade data
212 
213  //- Profile data
215 
216 
217  // Protected Member Functions
218 
219  //- Check data
220  void checkData();
221 
222  //- Set the face areas per cell, and optionally correct the rotor axis
223  void setFaceArea(vector& axis, const bool correct);
224 
225  //- Create the coordinate system
226  void createCoordinateSystem();
227 
228  //- Construct geometry
229  void constructGeometry();
230 
231  //- Return the inlet flow field
233 
234  //- Helper function to write rotor values
235  template<class Type>
236  void writeField
237  (
238  const word& name,
239  const List<Type>& values,
240  const bool writeNow = false
241  ) const;
242 
243 
244 public:
245 
246  //- Runtime type information
247  TypeName("rotorDisk");
248 
249 
250  // Constructors
251 
252  //- Construct from components
254  (
255  const word& name,
256  const word& modelType,
257  const dictionary& dict,
258  const fvMesh& mesh
259  );
260 
261 
262  //- Destructor
263  virtual ~rotorDiskSource();
264 
265 
266  // Member Functions
267 
268  // Access
269 
270  //- Return the reference density for incompressible case
271  inline scalar rhoRef() const;
272 
273  //- Return the rotational speed [rad/s]
274  // Positive anti-clockwise when looking along -ve lift direction
275  inline scalar omega() const;
276 
277  //- Return the cell centre positions in local rotor frame
278  // (Cylindrical r-theta-z)
279  inline const List<point>& x() const;
280 
281  //- Return the rotor coordinate system (r-theta-z)
282  inline const coordSystem::cylindrical& coordSys() const;
283 
284 
285  // Evaluation
286 
287  //- Calculate forces
288  template<class RhoFieldType>
289  void calculate
290  (
291  const RhoFieldType& rho,
292  const vectorField& U,
293  const scalarField& thetag,
294  vectorField& force,
295  const bool divideVolume = true,
296  const bool output = true
297  ) const;
298 
299 
300  // Source term addition
301 
302  //- Source term to momentum equation
303  virtual void addSup
304  (
305  fvMatrix<vector>& eqn,
306  const label fieldi
307  );
308 
309  //- Source term to compressible momentum equation
310  virtual void addSup
311  (
312  const volScalarField& rho,
313  fvMatrix<vector>& eqn,
314  const label fieldi
315  );
316 
317 
318  // IO
319 
320  //- Read source dictionary
321  virtual bool read(const dictionary& dict);
322 };
323 
324 
325 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
326 
327 } // End namespace fv
328 } // End namespace Foam
329 
330 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
331 
332 #include "rotorDiskSourceI.H"
333 
334 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
335 
336 #ifdef NoRepository
337  #include "rotorDiskSourceTemplates.C"
338 #endif
339 
340 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
341 
342 #endif
343 
344 // ************************************************************************* //
Foam::fv::rotorDiskSource::checkData
void checkData()
Check data.
Definition: rotorDiskSource.C:76
Foam::fv::option::correct
virtual void correct(volScalarField &field)
Definition: fvOption.C:307
Foam::fv::rotorDiskSource::profiles_
profileModelList profiles_
Profile data.
Definition: rotorDiskSource.H:213
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:552
rotorDiskSourceI.H
Foam::Enum< geometryModeType >
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:62
Foam::fv::cellSetOption
Cell-set options abtract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:72
Foam::fv::rotorDiskSource::createCoordinateSystem
void createCoordinateSystem()
Create the coordinate system.
Definition: rotorDiskSource.C:265
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:129
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::fv::option::name
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:30
Foam::fv::rotorDiskSource::rhoRef_
scalar rhoRef_
Reference density for incompressible case.
Definition: rotorDiskSource.H:165
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:169
Foam::fv::rotorDiskSource::ifSurfaceNormal
Definition: rotorDiskSource.H:143
Foam::fv::rotorDiskSource::Rcyl_
autoPtr< tensorField > Rcyl_
Cached rotation tensors for cylindrical coordinates.
Definition: rotorDiskSource.H:201
Foam::fv::rotorDiskSource::rMax_
scalar rMax_
Maximum radius.
Definition: rotorDiskSource.H:204
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:178
Foam::fv::rotorDiskSource::TypeName
TypeName("rotorDisk")
Runtime type information.
Foam::fv::rotorDiskSource::geometryModeType
geometryModeType
Definition: rotorDiskSource.H:133
Foam::fv::rotorDiskSource::flapData
Definition: rotorDiskSource.H:154
Foam::bladeModel
Blade model class calculates: Linear interpolated blade twist and chord based on radial position Inte...
Definition: bladeModel.H:66
Foam::fv::rotorDiskSource::area_
List< scalar > area_
Area [m2].
Definition: rotorDiskSource.H:195
rho
rho
Definition: readInitialConditions.H:96
cellSetOption.H
Foam::fv::rotorDiskSource::~rotorDiskSource
virtual ~rotorDiskSource()
Destructor.
Definition: rotorDiskSource.C:478
Foam::fv::rotorDiskSource::addSup
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Source term to momentum equation.
Definition: rotorDiskSource.C:485
Foam::fv::rotorDiskSource::gmSpecified
Definition: rotorDiskSource.H:136
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::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:62
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:447
Foam::fv::rotorDiskSource
Rotor disk source.
Definition: rotorDiskSource.H:127
bladeModel.H
Foam::fv::rotorDiskSource::flapData::beta0
scalar beta0
Definition: rotorDiskSource.H:156
Foam::fv::rotorDiskSource::constructGeometry
void constructGeometry()
Construct geometry.
Definition: rotorDiskSource.C:379
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:172
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::fv::rotorDiskSource::flap_
flapData flap_
Blade flap coefficients [rad/s].
Definition: rotorDiskSource.H:185
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
profileModelList.H
Foam::fv::rotorDiskSource::x_
List< point > x_
Cell centre positions in local rotor frame.
Definition: rotorDiskSource.H:189
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:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::rotorDiskSource::flapData::beta1c
scalar beta1c
Definition: rotorDiskSource.H:157
Foam::fv::rotorDiskSource::blade_
bladeModel blade_
Blade data.
Definition: rotorDiskSource.H:210
Foam::fv::rotorDiskSource::geometryModeTypeNames_
static const Enum< geometryModeType > geometryModeTypeNames_
Definition: rotorDiskSource.H:138
Foam::fv::rotorDiskSource::flapData::beta2s
scalar beta2s
Definition: rotorDiskSource.H:158
Foam::fv::rotorDiskSource::inletFlowTypeNames_
static const Enum< inletFlowType > inletFlowTypeNames_
Definition: rotorDiskSource.H:146
fv
labelList fv(nPoints)
Foam::fv::rotorDiskSource::ifFixed
Definition: rotorDiskSource.H:142
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::rotorDiskSource::gmAuto
Definition: rotorDiskSource.H:135
Foam::fv::rotorDiskSource::coordSys_
coordSystem::cylindrical coordSys_
Rotor local cylindrical coordinate system (r-theta-z)
Definition: rotorDiskSource.H:198
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: HashTable.H:102
Foam::fv::rotorDiskSource::tipEffect_
scalar tipEffect_
Tip effect [0-1].
Definition: rotorDiskSource.H:182
rotorDiskSourceTemplates.C
Foam::fv::rotorDiskSource::inletFlowType
inletFlowType
Definition: rotorDiskSource.H:140
Foam::fv::rotorDiskSource::inflowVelocity
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
Definition: rotorDiskSource.C:414
Foam::fv::option::mesh
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:36
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::fv::rotorDiskSource::inletFlow_
inletFlowType inletFlow_
Inlet flow type.
Definition: rotorDiskSource.H:175
Foam::fv::rotorDiskSource::trim_
autoPtr< trimModel > trim_
Trim model.
Definition: rotorDiskSource.H:207
Foam::fv::rotorDiskSource::ifLocal
Definition: rotorDiskSource.H:144
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::fv::rotorDiskSource::Rcone_
List< tensor > Rcone_
Rotation tensor for flap angle.
Definition: rotorDiskSource.H:192
Enum.H