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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fv::rotorDiskSource
29
30Group
31 grpFvOptionsSources
32
33Description
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
48Usage
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
164Note
165 - The entry \c rpm is positive anti-clockwise
166 when looking along -ve lift direction.
167
168See also
169 - Foam::trimModel
170 - Foam::bladeModel
171 - Foam::lookupProfile
172 - Foam::seriesProfile
173
174SourceFiles
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
192namespace Foam
193{
194
195// Forward declarations
196class trimModel;
197
198namespace fv
199{
200
201/*---------------------------------------------------------------------------*\
202 Class rotorDiskSource Declaration
203\*---------------------------------------------------------------------------*/
204
205class rotorDiskSource
206:
207 public fv::cellSetOption
208{
209public:
210
211 // Public Enumerations
212
213 //- Options for the geometry type specification
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
235protected:
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
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
329public:
331 //- Runtime type information
332 TypeName("rotorDisk");
333
334
335 // Constructors
336
337 //- Construct from components
340 const word& name,
341 const word& modelType,
342 const dictionary& dict,
344 );
345
346 //- No copy construct
347 rotorDiskSource(const rotorDiskSource&) = delete;
348
349 //- No copy assignment
350 void operator=(const rotorDiskSource&) = delete;
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;
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,
384 const scalarField& thetag,
385 vectorField& force,
386 const bool divideVolume = true,
387 const bool output = true
388 ) const;
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
416// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
417
418} // End namespace fv
419} // End namespace Foam
420
421// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
422
423#include "rotorDiskSourceI.H"
425// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
426
427#ifdef NoRepository
429#endif
430
431// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
432
433#endif
434
435// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Blade model class calculates:
Definition: bladeModel.H:145
A cylindrical coordinate system (r-theta-z). The coordinate system angle theta is always in radians.
Definition: cylindricalCS.H:74
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Intermediate abstract class for handling cell-set options for the derived fvOptions.
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Applies cell-based momentum sources on velocity (i.e. U) within a specified cylindrical region to app...
scalar omega_
Rotational speed [rad/s].
static const Enum< geometryModeType > geometryModeTypeNames_
Names for geometryModeType.
void calculate(const RhoFieldType &rho, const vectorField &U, const scalarField &thetag, vectorField &force, const bool divideVolume=true, const bool output=true) const
Calculate forces.
scalar rhoRef_
Reference density for incompressible case.
const coordSystem::cylindrical & coordSys() const
Return the rotor coordinate system (r-theta-z)
scalar rhoRef() const
Return the reference density for incompressible case.
void setFaceArea(vector &axis, const bool correct)
Set the face areas per cell, and optionally correct the rotor axis.
rotorDiskSource(const rotorDiskSource &)=delete
No copy construct.
void checkData()
Check data.
List< scalar > area_
Area [m2].
scalar tipEffect_
Tip effect [0-1].
const List< point > & x() const
Return the cell centre positions in local rotor frame.
inletFlowType inletFlow_
Inlet flow type.
void constructGeometry()
Construct geometry.
void writeField(const word &name, const List< Type > &values, const bool writeNow=false) const
Helper function to write rotor values.
coordSystem::cylindrical coordSys_
Rotor local cylindrical coordinate system (r-theta-z)
scalar rMax_
Maximum radius.
virtual bool read(const dictionary &dict)
Read source dictionary.
List< point > x_
Cell centre positions in local rotor frame.
bladeModel blade_
Blade data.
tmp< vectorField > inflowVelocity(const volVectorField &U) const
Return the inlet flow field.
scalar omega() const
Return the rotational speed [rad/s].
void createCoordinateSystem()
Create the coordinate system.
flapData flap_
Blade flap coefficients [rad/s].
vector inletVelocity_
Inlet velocity for specified inflow.
inletFlowType
Options for the inlet flow type specification.
List< tensor > Rcone_
Rotation tensor for flap angle.
TypeName("rotorDisk")
Runtime type information.
label nBlades_
Number of blades.
virtual ~rotorDiskSource()=default
Destructor.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to momentum equation.
autoPtr< tensorField > Rcyl_
Cached rotation tensors for cylindrical coordinates.
autoPtr< trimModel > trim_
Trim model.
profileModelList profiles_
Profile data.
static const Enum< inletFlowType > inletFlowTypeNames_
Names for inletFlowType.
void operator=(const rotorDiskSource &)=delete
No copy assignment.
geometryModeType
Options for the geometry type specification.
Base class for profile models.
A class for managing temporary objects.
Definition: tmp.H:65
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
Definition: word.H:68
U
Definition: pEqn.H:72
thermo correct()
Namespace for OpenFOAM.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:83
static Ostream & output(Ostream &os, const IntRange< T > &range)
Definition: IntRanges.C:66
labelList fv(nPoints)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73