mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Bug fixing in vector transformation using localAxesRotation Adding constructor for localAxesRotation class.
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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_;
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -26,9 +26,12 @@ Class
|
||||
|
||||
Description
|
||||
A local coordinate rotation.
|
||||
Each rotational tensor is defined with two vectors (dir and e3)
|
||||
The cell based rotational field can be created in two ways:
|
||||
|
||||
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
|
||||
@ -38,6 +41,8 @@ Description
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
2) The rotational tensor field is provided at construction
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef localAxesRotation_H
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -50,7 +50,7 @@ Description
|
||||
|
||||
Type of co-ordinates:
|
||||
1) cartesian
|
||||
2) cylindrical
|
||||
|
||||
|
||||
See Also
|
||||
coordinateSystem and coordinateSystem::New
|
||||
|
||||
@ -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 * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user