Files
openfoam/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H
andy bc1477592d ENH: Updates to rotorDiskSource momentum source
- code restructuring
- better spefication of rotor axis direction (uses pointAbove)
- run-time selectable trim models
- new rotor trimming model: targetForce
2012-04-12 16:49:28 +01:00

310 lines
7.8 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::rotorDiskSource
Description
Cell based momemtum source
Source approximates the mean effects of rotor forces on a cylindrical
region within the domain
Sources described by:
rotorDiskSourceCoeffs
{
fieldNames (U); // names of fields on which to apply source
rhoName rho; // density field if compressible case
nBlades 3; // number of blades
tipEffect 0.96; // normalised radius above which lift = 0
inletFlowType local; // inlet flow type specification
geometryMode auto; // geometry specification
refDirection (-1 0 0); // reference direction
// - used as reference for psi angle
trimModel fixed; // fixed || targetForce
flapCoeffs
{
beta0 0; // coning angle [deg]
beta1 0; // lateral flapping coeff
beta2 0; // longitudinal flapping coeff
}
blade
{
...
}
profiles
{
...
}
}
Where:
geometryMode =
auto : determine rototor co-ord system from cells
specified : specified co-ord system
inletFlowType =
fixed : specified velocity
surfaceNormal : specified normal velocity (positive towards rotor)
local : use local flow conditions
SourceFiles
rotorDiskSource.C
rotorDiskSourceTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef rotorDiskSource_H
#define rotorDiskSource_H
#include "basicSource.H"
#include "cylindricalCS.H"
#include "NamedEnum.H"
#include "bladeModel.H"
#include "profileModelList.H"
#include "volFieldsFwd.H"
#include "dimensionSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class trimModel;
/*---------------------------------------------------------------------------*\
Class rotorDiskSource Declaration
\*---------------------------------------------------------------------------*/
class rotorDiskSource
:
public basicSource
{
public:
enum geometryModeType
{
gmAuto,
gmSpecified
};
static const NamedEnum<geometryModeType, 2> geometryModeTypeNames_;
enum inletFlowType
{
ifFixed,
ifSurfaceNormal,
ifLocal
};
static const NamedEnum<inletFlowType, 3> inletFlowTypeNames_;
protected:
// Helper structures to encapsulate flap and trim data
// Note: all input in degrees (converted to radians internally)
struct flapData
{
scalar beta0; // coning angle
scalar beta1; // lateral flapping coeff
scalar beta2; // longitudinal flapping coeff
};
// Protected data
//- Name of density field
word rhoName_;
//- Rotational speed [rad/s]
scalar omega_;
//- Number of blades
label nBlades_;
//- Inlet flow type
inletFlowType inletFlow_;
//- Inlet velocity for specified iinflow
vector inletVelocity_;
//- Tip effect [0-1]
// Ratio of blade radius beyond which lift=0
scalar tipEffect_;
//- Blade flap coefficients [rad/s]
flapData flap_;
//- Trim model
autoPtr<trimModel> trim_;
//- Blade data
bladeModel blade_;
//- Profile data
profileModelList profiles_;
//- Cell centre positions in local rotor frame
// (Cylindrical r, theta, z)
List<point> x_;
//- Rotation tensor for flap angle
List<tensor> R_;
//- Inverse rotation tensor for flap angle
List<tensor> invR_;
//- Area [m2]
List<scalar> area_;
//- Rotor co-ordinate system (r, theta, z)
cylindricalCS coordSys_;
//- Maximum radius
scalar rMax_;
// Protected Member Functions
//- Check data
void checkData();
//- Set the face areas per cell, and optionally correct the rotor axis
void setFaceArea(vector& axis, const bool correct);
//- Create the co-ordinate system
void createCoordinateSystem();
//- Construct geometry
void constructGeometry();
//- Return the inlet flow field
tmp<vectorField> inflowVelocity(const volVectorField& U) const;
//- Helper function to write rotor values
template<class Type>
void writeField
(
const word& name,
const List<Type>& values,
const bool writeNow = false
) const;
public:
//- Runtime type information
TypeName("rotorDisk");
// Constructors
//- Construct from components
rotorDiskSource
(
const word& name,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~rotorDiskSource();
// Member Functions
// Access
//- Return the cell centre positions in local rotor frame
// (Cylindrical r, theta, z)
inline const List<point>& x() const;
//- Return the rotor co-ordinate system (r, theta, z)
inline const cylindricalCS& coordSys() const;
// Evaluation
//- Calculate forces
void calculate
(
const vectorField& U,
const scalarField& alphag,
vectorField& force,
const bool divideVolume = true,
const bool output = true
) const;
// Source term addition
//- Source term to fvMatrix<vector>
virtual void addSup(fvMatrix<vector>& eqn, const label fieldI);
// I-O
//- Write the source properties
virtual void writeData(Ostream&) const;
//- Read source dictionary
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "rotorDiskSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "rotorDiskSourceTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //