mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: alternative Euler rotation orders for lumpedPointState (#1341)
This commit is contained in:
committed by
Andrew Heather
parent
17de75b073
commit
f7f08fce4b
@ -182,7 +182,7 @@ public:
|
|||||||
//- Vector part of the quaternion ( = axis of rotation)
|
//- Vector part of the quaternion ( = axis of rotation)
|
||||||
inline const vector& v() const;
|
inline const vector& v() const;
|
||||||
|
|
||||||
//- The rotation tensor corresponding the quaternion
|
//- The rotation tensor corresponding to the quaternion
|
||||||
inline tensor R() const;
|
inline tensor R() const;
|
||||||
|
|
||||||
//- Return the Euler rotation angles corresponding to the
|
//- Return the Euler rotation angles corresponding to the
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,10 +25,8 @@ License
|
|||||||
|
|
||||||
#include "lumpedPointState.H"
|
#include "lumpedPointState.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
#include "EulerCoordinateRotation.H"
|
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
|
#include "EulerCoordinateRotation.H"
|
||||||
#include "ISstream.H"
|
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -70,13 +68,15 @@ static Foam::string getLineNoComment
|
|||||||
void Foam::lumpedPointState::calcRotations() const
|
void Foam::lumpedPointState::calcRotations() const
|
||||||
{
|
{
|
||||||
rotationPtr_ = new tensorField(angles_.size());
|
rotationPtr_ = new tensorField(angles_.size());
|
||||||
forAll(angles_, itemi)
|
|
||||||
|
auto rotIter = rotationPtr_->begin();
|
||||||
|
|
||||||
|
for (const vector& angles : angles_)
|
||||||
{
|
{
|
||||||
rotationPtr_->operator[](itemi) = EulerCoordinateRotation
|
*rotIter =
|
||||||
(
|
coordinateRotations::euler::rotation(order_, angles, degrees_);
|
||||||
angles_[itemi],
|
|
||||||
degrees_ // true=degrees, false=radians
|
++rotIter;
|
||||||
).R();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,15 @@ void Foam::lumpedPointState::readDict(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
dict.readEntry("points", points_);
|
dict.readEntry("points", points_);
|
||||||
dict.readEntry("angles", angles_);
|
dict.readEntry("angles", angles_);
|
||||||
|
order_ =
|
||||||
|
quaternion::eulerOrderNames.getOrDefault
|
||||||
|
(
|
||||||
|
"order",
|
||||||
|
dict,
|
||||||
|
quaternion::eulerOrder::ZXZ
|
||||||
|
);
|
||||||
degrees_ = dict.lookupOrDefault("degrees", false);
|
degrees_ = dict.lookupOrDefault("degrees", false);
|
||||||
|
|
||||||
deleteDemandDrivenData(rotationPtr_);
|
deleteDemandDrivenData(rotationPtr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +104,7 @@ Foam::lumpedPointState::lumpedPointState()
|
|||||||
:
|
:
|
||||||
points_(),
|
points_(),
|
||||||
angles_(),
|
angles_(),
|
||||||
|
order_(quaternion::eulerOrder::ZXZ),
|
||||||
degrees_(false),
|
degrees_(false),
|
||||||
rotationPtr_(nullptr)
|
rotationPtr_(nullptr)
|
||||||
{}
|
{}
|
||||||
@ -105,6 +114,7 @@ Foam::lumpedPointState::lumpedPointState(const lumpedPointState& rhs)
|
|||||||
:
|
:
|
||||||
points_(rhs.points_),
|
points_(rhs.points_),
|
||||||
angles_(rhs.angles_),
|
angles_(rhs.angles_),
|
||||||
|
order_(rhs.order_),
|
||||||
degrees_(rhs.degrees_),
|
degrees_(rhs.degrees_),
|
||||||
rotationPtr_(nullptr)
|
rotationPtr_(nullptr)
|
||||||
{}
|
{}
|
||||||
@ -114,6 +124,7 @@ Foam::lumpedPointState::lumpedPointState(const pointField& pts)
|
|||||||
:
|
:
|
||||||
points_(pts),
|
points_(pts),
|
||||||
angles_(points_.size(), Zero),
|
angles_(points_.size(), Zero),
|
||||||
|
order_(quaternion::eulerOrder::ZXZ),
|
||||||
degrees_(false),
|
degrees_(false),
|
||||||
rotationPtr_(nullptr)
|
rotationPtr_(nullptr)
|
||||||
{}
|
{}
|
||||||
@ -123,6 +134,7 @@ Foam::lumpedPointState::lumpedPointState(tmp<pointField>& pts)
|
|||||||
:
|
:
|
||||||
points_(pts),
|
points_(pts),
|
||||||
angles_(points_.size(), Zero),
|
angles_(points_.size(), Zero),
|
||||||
|
order_(quaternion::eulerOrder::ZXZ),
|
||||||
degrees_(false),
|
degrees_(false),
|
||||||
rotationPtr_(nullptr)
|
rotationPtr_(nullptr)
|
||||||
{}
|
{}
|
||||||
@ -132,6 +144,7 @@ Foam::lumpedPointState::lumpedPointState(const dictionary& dict)
|
|||||||
:
|
:
|
||||||
points_(),
|
points_(),
|
||||||
angles_(),
|
angles_(),
|
||||||
|
order_(quaternion::eulerOrder::ZXZ),
|
||||||
degrees_(false),
|
degrees_(false),
|
||||||
rotationPtr_(nullptr)
|
rotationPtr_(nullptr)
|
||||||
{
|
{
|
||||||
@ -153,6 +166,7 @@ void Foam::lumpedPointState::operator=(const lumpedPointState& rhs)
|
|||||||
{
|
{
|
||||||
points_ = rhs.points_;
|
points_ = rhs.points_;
|
||||||
angles_ = rhs.angles_;
|
angles_ = rhs.angles_;
|
||||||
|
order_ = rhs.order_;
|
||||||
degrees_ = rhs.degrees_;
|
degrees_ = rhs.degrees_;
|
||||||
|
|
||||||
deleteDemandDrivenData(rotationPtr_);
|
deleteDemandDrivenData(rotationPtr_);
|
||||||
@ -228,6 +242,7 @@ bool Foam::lumpedPointState::readPlain(Istream& is)
|
|||||||
|
|
||||||
points_.setSize(count);
|
points_.setSize(count);
|
||||||
angles_.setSize(count);
|
angles_.setSize(count);
|
||||||
|
order_ = quaternion::eulerOrder::ZXZ;
|
||||||
degrees_ = false;
|
degrees_ = false;
|
||||||
|
|
||||||
deleteDemandDrivenData(rotationPtr_);
|
deleteDemandDrivenData(rotationPtr_);
|
||||||
@ -256,9 +271,13 @@ void Foam::lumpedPointState::writeDict(Ostream& os) const
|
|||||||
{
|
{
|
||||||
os.writeEntry("points", points_);
|
os.writeEntry("points", points_);
|
||||||
os.writeEntry("angles", angles_);
|
os.writeEntry("angles", angles_);
|
||||||
|
if (order_ != quaternion::eulerOrder::ZXZ)
|
||||||
|
{
|
||||||
|
os.writeEntry("order", quaternion::eulerOrderNames[order_]);
|
||||||
|
}
|
||||||
if (degrees_)
|
if (degrees_)
|
||||||
{
|
{
|
||||||
os.writeEntry("degrees", word("true"));
|
os.writeEntry("degrees", "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,6 +35,7 @@ Description
|
|||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
points | List of points | yes |
|
points | List of points | yes |
|
||||||
angles | List of Euler rotation angles | yes |
|
angles | List of Euler rotation angles | yes |
|
||||||
|
order | The Euler-angle rotation order | no | zxz
|
||||||
degrees | Rotation angles in degrees | no | false
|
degrees | Rotation angles in degrees | no | false
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
@ -49,10 +50,11 @@ Description
|
|||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
EulerCoordinateRotation
|
Foam::coordinateRotations::euler, Foam::quaternion
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
lumpedPointState.C
|
lumpedPointState.C
|
||||||
|
lumpedPointStateI.H
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -65,6 +67,7 @@ SourceFiles
|
|||||||
#include "scalarField.H"
|
#include "scalarField.H"
|
||||||
#include "vectorField.H"
|
#include "vectorField.H"
|
||||||
#include "tensorField.H"
|
#include "tensorField.H"
|
||||||
|
#include "quaternion.H"
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -98,7 +101,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Positions of lumped points
|
//- Positions of lumped points
|
||||||
pointField points_;
|
pointField points_;
|
||||||
@ -106,7 +109,10 @@ private:
|
|||||||
//- Orientation of lumped points (as Euler angles)
|
//- Orientation of lumped points (as Euler angles)
|
||||||
vectorField angles_;
|
vectorField angles_;
|
||||||
|
|
||||||
//- Euler angles in degrees instead radians
|
//- The Euler-angle rotation order (default: zxz)
|
||||||
|
quaternion::eulerOrder order_;
|
||||||
|
|
||||||
|
//- Euler angles measured in degrees
|
||||||
bool degrees_;
|
bool degrees_;
|
||||||
|
|
||||||
//- Tensor rotation of lumped points
|
//- Tensor rotation of lumped points
|
||||||
|
|||||||
Reference in New Issue
Block a user