diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C index 59c1517d69b2db553c783457421b3d39369b1084..443e2edf2ca21ac65d20e0b1b5bd595294b5875a 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C @@ -311,6 +311,16 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() coeffs_.lookup("refDirection") >> refDir; + localAxesRotation_.reset + ( + new localAxesRotation + ( + mesh_, + axis, + origin + ) + ); + // set the face areas and apply correction to calculated axis // e.g. if cellZone is more than a single layer in thickness setFaceArea(axis, true); @@ -323,6 +333,16 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() coeffs_.lookup("axis") >> axis; coeffs_.lookup("refDirection") >> refDir; + localAxesRotation_.reset + ( + new localAxesRotation + ( + mesh_, + axis, + origin + ) + ); + setFaceArea(axis, false); break; @@ -446,6 +466,7 @@ Foam::fv::rotorDiskSource::rotorDiskSource invR_(cells_.size(), I), area_(cells_.size(), 0.0), coordSys_(false), + localAxesRotation_(), rMax_(0.0), trim_(trimModel::New(*this, coeffs_)), blade_(coeffs_.subDict("blade")), @@ -482,6 +503,10 @@ void Foam::fv::rotorDiskSource::calculate scalar AOAmin = GREAT; scalar AOAmax = -GREAT; + tmp<vectorField> tUcf(localAxesRotation_->transform(U)); + + vectorField& Ucf = tUcf(); + forAll(cells_, i) { if (area_[i] > ROOTVSMALL) @@ -491,7 +516,7 @@ void Foam::fv::rotorDiskSource::calculate const scalar radius = x_[i].x(); // velocity in local cylindrical reference frame - vector Uc = coordSys_.localVector(U[cellI]); + vector Uc = Ucf[i]; // transform from rotor cylindrical into local coning system Uc = R_[i] & Uc; diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H index 0b412ba3ec02eb35a2cdb3b5034125ab36fb3cbb..d8648364f728efd7d6bb6fa22f79cc0e7a51723e 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H @@ -90,6 +90,7 @@ SourceFiles #include "fvOption.H" #include "cylindricalCS.H" +#include "localAxesRotation.H" #include "NamedEnum.H" #include "bladeModel.H" #include "profileModelList.H" @@ -183,9 +184,12 @@ protected: //- Area [m2] List<scalar> area_; - //- Rotor co-ordinate system (r, theta, z) + //- Rotor local cylindrical co-ordinate system (r, theta, z) cylindricalCS coordSys_; + //- Rotor transformation co-ordinate system + autoPtr<localAxesRotation> localAxesRotation_; + //- Maximum radius scalar rMax_; diff --git a/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.C index cbe68e4402439dda2da66d52ef4fff8671523f4b..132c1f10d0f5f2315ade12efb8cad6526a1fb58a 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.C @@ -113,6 +113,33 @@ Foam::localAxesRotation::localAxesRotation(const dictionary& dict) } +Foam::localAxesRotation::localAxesRotation +( + const objectRegistry& obr, + const vector& axis, + const point& origin +) +: + Rptr_(), + origin_(origin), + e3_(axis) +{ + const polyMesh& mesh = refCast<const polyMesh>(obr); + + Rptr_.reset(new tensorField(mesh.nCells())); + init(obr); +} + +Foam::localAxesRotation::localAxesRotation(const tensorField& R) +: + Rptr_(), + origin_(vector::zero), + e3_(vector::zero) +{ + Rptr_() = R; +} + + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // void Foam::localAxesRotation::clear() diff --git a/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.H index d6eb7c63d5db849bb5e1219c2d56cc08a5518fbf..444898c7f0a94c2b1c15758bb305b607d58c896b 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/localAxesRotation.H @@ -26,17 +26,22 @@ Class Description A local coordinate rotation. - Each rotational tensor is defined with two vectors (dir and e3) - where dir = cellC - origin and e3 is the rotation axis. - Per each cell an axesRotation type of rotation is created + The cell based rotational field can be created in two ways: - \verbatim - localAxesRotation - { - type localAxes; - e3 (0 0 1); - } - \endverbatim + 1) Each rotational tensor is defined with two vectors (dir and e3) + where dir = cellC - origin and e3 is the rotation axis. + Per each cell an axesRotation type of rotation is created + (cylindrical coordinates) + + \verbatim + localAxesRotation + { + type localAxes; + e3 (0 0 1); + } + \endverbatim + + 2) The rotational tensor field is provided at construction \*---------------------------------------------------------------------------*/ @@ -88,9 +93,20 @@ public: //- Construct from dictionary and objectRegistry localAxesRotation(const dictionary&, const objectRegistry&); + //- Construct from dictionary and objectRegistry + localAxesRotation + ( + const objectRegistry&, + const vector& axis, + const point& origin + ); + //- Construct from dictionary localAxesRotation(const dictionary&); + //- Construct from tensor Field + localAxesRotation(const tensorField&); + //- Return clone autoPtr<localAxesRotation> clone() const { diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index 196395cd25539e959ac0692f171603b8e5050b03..7e8b81c0e56cbbdd185b773f7e8984e774eba4f7 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -50,7 +50,7 @@ Description Type of co-ordinates: 1) cartesian - 2) cylindrical + See Also coordinateSystem and coordinateSystem::New diff --git a/src/meshTools/coordinateSystems/cylindricalCS.C b/src/meshTools/coordinateSystems/cylindricalCS.C index 08a8a37aeb0c5cbaccc7aae4645fdcc926dbf692..18be4ab3a8a8e8816b28b4d70012e71fb4b286ab 100644 --- a/src/meshTools/coordinateSystems/cylindricalCS.C +++ b/src/meshTools/coordinateSystems/cylindricalCS.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,14 +29,6 @@ License #include "mathematicalConstants.H" #include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(cylindricalCS, 0); - addToRunTimeSelectionTable(coordinateSystem, cylindricalCS, dictionary); -} - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/meshTools/coordinateSystems/cylindricalCS.H b/src/meshTools/coordinateSystems/cylindricalCS.H index fd537c29cd59ccdec62e2f33ad3940059177239e..16b46a72456c8f19d15d66483ef7c030a1edcff7 100644 --- a/src/meshTools/coordinateSystems/cylindricalCS.H +++ b/src/meshTools/coordinateSystems/cylindricalCS.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,6 @@ SourceFiles #define cylindricalCS_H #include "coordinateSystem.H" -#include "typeInfo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -89,9 +88,6 @@ protected: public: - //- Runtime type information - TypeName("cylindrical"); - // Constructors