ENH: support Euler rotation rollPitchYaw/yawPitchRoll ordering
- can be more intuitive to specify for some cases: rotation { type euler; order rollPitchYaw; angles (0 20 45); } - refactor starcd rotation to reuse Euler ZXY ordering (code reduction) ENH: add -rotate-x, -rotate-y, -rotate-z for transformPoints etc - easier to specify for simple rotations
This commit is contained in:
parent
eba7a485ba
commit
a465e4db85
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,6 +53,15 @@ Usage
|
||||
-rotate-angle (vector angle)
|
||||
Rotate angle degrees about vector axis.
|
||||
|
||||
-rotate-x angle
|
||||
Rotate (degrees) about x-axis.
|
||||
|
||||
-rotate-y angle
|
||||
Rotate (degrees) about y-axis.
|
||||
|
||||
-rotate-z angle
|
||||
Rotate (degrees) about z-axis.
|
||||
|
||||
or -yawPitchRoll (yawdegrees pitchdegrees rolldegrees)
|
||||
or -rollPitchYaw (rolldegrees pitchdegrees yawdegrees)
|
||||
|
||||
@ -277,10 +286,25 @@ int main(int argc, char *argv[])
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-angle",
|
||||
"(vector scalar)",
|
||||
"(vector angle)",
|
||||
"Rotate <angle> degrees about <vector> - eg, '((1 0 0) 45)'"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-x", "deg",
|
||||
"Rotate (degrees) about x-axis"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-y", "deg",
|
||||
"Rotate (degrees) about y-axis"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-z", "deg",
|
||||
"Rotate (degrees) about z-axis"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rollPitchYaw",
|
||||
"vector",
|
||||
@ -316,15 +340,18 @@ int main(int argc, char *argv[])
|
||||
// Verify that an operation has been specified
|
||||
{
|
||||
const List<word> operationNames
|
||||
{
|
||||
({
|
||||
"recentre",
|
||||
"translate",
|
||||
"rotate",
|
||||
"rotate-angle",
|
||||
"rotate-x",
|
||||
"rotate-y",
|
||||
"rotate-z",
|
||||
"rollPitchYaw",
|
||||
"yawPitchRoll",
|
||||
"scale"
|
||||
};
|
||||
});
|
||||
|
||||
if (!args.count(operationNames))
|
||||
{
|
||||
@ -424,6 +451,12 @@ int main(int argc, char *argv[])
|
||||
points -= origin;
|
||||
}
|
||||
|
||||
|
||||
// Get a rotation specification
|
||||
|
||||
tensor rot(Zero);
|
||||
bool useRotation(false);
|
||||
|
||||
if (args.found("rotate"))
|
||||
{
|
||||
Pair<vector> n1n2
|
||||
@ -433,15 +466,8 @@ int main(int argc, char *argv[])
|
||||
n1n2[0].normalise();
|
||||
n1n2[1].normalise();
|
||||
|
||||
const tensor rot(rotationTensor(n1n2[0], n1n2[1]));
|
||||
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
|
||||
if (doRotateFields)
|
||||
{
|
||||
rotateFields(regionName, runTime, rot);
|
||||
}
|
||||
rot = rotationTensor(n1n2[0], n1n2[1]);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-angle"))
|
||||
{
|
||||
@ -457,15 +483,35 @@ int main(int argc, char *argv[])
|
||||
<< " about " << axis << nl
|
||||
<< " angle " << angle << nl;
|
||||
|
||||
const tensor rot(axisAngle::rotation(axis, angle, true));
|
||||
rot = axisAngle::rotation(axis, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-x"))
|
||||
{
|
||||
const scalar angle = args.get<scalar>("rotate-x");
|
||||
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
Info<< "Rotating points about x-axis: " << angle << nl;
|
||||
|
||||
if (doRotateFields)
|
||||
{
|
||||
rotateFields(regionName, runTime, rot);
|
||||
}
|
||||
rot = axisAngle::rotation(vector::X, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-y"))
|
||||
{
|
||||
const scalar angle = args.get<scalar>("rotate-y");
|
||||
|
||||
Info<< "Rotating points about y-axis: " << angle << nl;
|
||||
|
||||
rot = axisAngle::rotation(vector::Y, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-z"))
|
||||
{
|
||||
const scalar angle = args.get<scalar>("rotate-z");
|
||||
|
||||
Info<< "Rotating points about z-axis: " << angle << nl;
|
||||
|
||||
rot = axisAngle::rotation(vector::Z, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.readIfPresent("rollPitchYaw", v))
|
||||
{
|
||||
@ -474,15 +520,8 @@ int main(int argc, char *argv[])
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " yaw " << v.z() << nl;
|
||||
|
||||
const tensor rot(euler::rotation(euler::eulerOrder::XYZ, v, true));
|
||||
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
|
||||
if (doRotateFields)
|
||||
{
|
||||
rotateFields(regionName, runTime, rot);
|
||||
}
|
||||
rot = euler::rotation(euler::eulerOrder::ROLL_PITCH_YAW, v, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.readIfPresent("yawPitchRoll", v))
|
||||
{
|
||||
@ -491,10 +530,14 @@ int main(int argc, char *argv[])
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " roll " << v.z() << nl;
|
||||
|
||||
const tensor rot(euler::rotation(euler::eulerOrder::ZYX, v, true));
|
||||
rot = euler::rotation(euler::eulerOrder::YAW_PITCH_ROLL, v, true);
|
||||
useRotation = true;
|
||||
}
|
||||
|
||||
if (useRotation)
|
||||
{
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
transform(points, rot, points);
|
||||
|
||||
if (doRotateFields)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -206,10 +206,25 @@ int main(int argc, char *argv[])
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-angle",
|
||||
"(vector scalar)",
|
||||
"(vector angle)",
|
||||
"Rotate <angle> degrees about <vector> - eg, '((1 0 0) 45)'"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-x", "deg",
|
||||
"Rotate (degrees) about x-axis"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-y", "deg",
|
||||
"Rotate (degrees) about y-axis"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rotate-z", "deg",
|
||||
"Rotate (degrees) about z-axis"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"rollPitchYaw",
|
||||
"vector",
|
||||
@ -254,16 +269,19 @@ int main(int argc, char *argv[])
|
||||
// Verify that an operation has been specified
|
||||
{
|
||||
const List<word> operationNames
|
||||
{
|
||||
({
|
||||
"recentre",
|
||||
"translate",
|
||||
"rotate",
|
||||
"rotate-angle",
|
||||
"rotate-x",
|
||||
"rotate-y",
|
||||
"rotate-z",
|
||||
"rollPitchYaw",
|
||||
"yawPitchRoll",
|
||||
"read-scale",
|
||||
"write-scale"
|
||||
};
|
||||
});
|
||||
|
||||
if (!args.count(operationNames))
|
||||
{
|
||||
@ -348,6 +366,12 @@ int main(int argc, char *argv[])
|
||||
points -= origin;
|
||||
}
|
||||
|
||||
|
||||
// Get a rotation specification
|
||||
|
||||
tensor rot(Zero);
|
||||
bool useRotation(false);
|
||||
|
||||
if (args.found("rotate"))
|
||||
{
|
||||
Pair<vector> n1n2
|
||||
@ -357,10 +381,8 @@ int main(int argc, char *argv[])
|
||||
n1n2[0].normalise();
|
||||
n1n2[1].normalise();
|
||||
|
||||
const tensor rot(rotationTensor(n1n2[0], n1n2[1]));
|
||||
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
rot = rotationTensor(n1n2[0], n1n2[1]);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-angle"))
|
||||
{
|
||||
@ -376,10 +398,35 @@ int main(int argc, char *argv[])
|
||||
<< " about " << axis << nl
|
||||
<< " angle " << angle << nl;
|
||||
|
||||
const tensor rot(axisAngle::rotation(axis, angle, true));
|
||||
rot = axisAngle::rotation(axis, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-x"))
|
||||
{
|
||||
const scalar angle = args.get<scalar>("rotate-x");
|
||||
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
Info<< "Rotating points about x-axis: " << angle << nl;
|
||||
|
||||
rot = axisAngle::rotation(vector::X, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-y"))
|
||||
{
|
||||
const scalar angle = args.get<scalar>("rotate-y");
|
||||
|
||||
Info<< "Rotating points about y-axis: " << angle << nl;
|
||||
|
||||
rot = axisAngle::rotation(vector::Y, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.found("rotate-z"))
|
||||
{
|
||||
const scalar angle = args.get<scalar>("rotate-z");
|
||||
|
||||
Info<< "Rotating points about z-axis: " << angle << nl;
|
||||
|
||||
rot = axisAngle::rotation(vector::Z, angle, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.readIfPresent("rollPitchYaw", v))
|
||||
{
|
||||
@ -388,10 +435,8 @@ int main(int argc, char *argv[])
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " yaw " << v.z() << nl;
|
||||
|
||||
const tensor rot(euler::rotation(euler::eulerOrder::XYZ, v, true));
|
||||
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
rot = euler::rotation(euler::eulerOrder::ROLL_PITCH_YAW, v, true);
|
||||
useRotation = true;
|
||||
}
|
||||
else if (args.readIfPresent("yawPitchRoll", v))
|
||||
{
|
||||
@ -400,10 +445,14 @@ int main(int argc, char *argv[])
|
||||
<< " pitch " << v.y() << nl
|
||||
<< " roll " << v.z() << nl;
|
||||
|
||||
const tensor rot(euler::rotation(euler::eulerOrder::ZYX, v, true));
|
||||
rot = euler::rotation(euler::eulerOrder::YAW_PITCH_ROLL, v, true);
|
||||
useRotation = true;
|
||||
}
|
||||
|
||||
if (useRotation)
|
||||
{
|
||||
Info<< "Rotating points by " << rot << endl;
|
||||
points = transform(rot, points);
|
||||
transform(points, rot, points);
|
||||
}
|
||||
|
||||
// Output scaling
|
||||
|
@ -34,29 +34,31 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateRotations
|
||||
{
|
||||
defineTypeName(euler);
|
||||
namespace coordinateRotations
|
||||
{
|
||||
|
||||
// Standard short name
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
euler,
|
||||
dictionary,
|
||||
euler
|
||||
);
|
||||
defineTypeName(euler);
|
||||
|
||||
// Longer name - Compat 1806
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
euler,
|
||||
dictionary,
|
||||
EulerRotation
|
||||
);
|
||||
}
|
||||
}
|
||||
// Standard short name
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
euler,
|
||||
dictionary,
|
||||
euler
|
||||
);
|
||||
|
||||
// Longer name - Compat 1806
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
euler,
|
||||
dictionary,
|
||||
EulerRotation
|
||||
);
|
||||
|
||||
} // End namespace coordinateRotations
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -68,9 +70,9 @@ Foam::tensor Foam::coordinateRotations::euler::rotation
|
||||
bool degrees
|
||||
)
|
||||
{
|
||||
scalar angle1(angles.component(vector::X)); // Rotation #1
|
||||
scalar angle2(angles.component(vector::Y)); // Rotation #2
|
||||
scalar angle3(angles.component(vector::Z)); // Rotation #3
|
||||
scalar angle1(angles.x()); // Rotation #1
|
||||
scalar angle2(angles.y()); // Rotation #2
|
||||
scalar angle3(angles.z()); // Rotation #3
|
||||
|
||||
if (degrees)
|
||||
{
|
||||
@ -156,7 +158,7 @@ Foam::tensor Foam::coordinateRotations::euler::rotation
|
||||
}
|
||||
|
||||
|
||||
// Tait-Bryan angles
|
||||
// Tait-Bryan angles
|
||||
|
||||
case eulerOrder::XZY: // X1-Z2-Y3 rotation
|
||||
{
|
||||
@ -228,10 +230,9 @@ Foam::tensor Foam::coordinateRotations::euler::rotation
|
||||
FatalErrorInFunction
|
||||
<< "Unknown euler rotation order "
|
||||
<< int(order) << abort(FatalError);
|
||||
break;
|
||||
}
|
||||
|
||||
return tensor::I;
|
||||
return sphericalTensor::I; // identity rotation
|
||||
}
|
||||
|
||||
|
||||
@ -321,7 +322,7 @@ void Foam::coordinateRotations::euler::clear()
|
||||
|
||||
Foam::tensor Foam::coordinateRotations::euler::R() const
|
||||
{
|
||||
return euler::rotation(angles_, degrees_);
|
||||
return euler::rotation(order_, angles_, degrees_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,19 +47,24 @@ Description
|
||||
|
||||
\heading Dictionary entries
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | Type name: euler (or EulerRotation) | yes |
|
||||
angles | The z-x-z rotation angles | yes |
|
||||
degrees | Angles are in degrees | no | true
|
||||
Property | Description | Reqd | Default
|
||||
type | Type name: euler (or EulerRotation) | yes |
|
||||
angles | Rotation angles (usually z-x-z order) | yes |
|
||||
degrees | Angles are in degrees | no | true
|
||||
order | Rotation order | no | zxz
|
||||
\endtable
|
||||
|
||||
Note
|
||||
The rotation order is usually z-x-z, but can also be something like
|
||||
"rollPitchYaw" etc.
|
||||
|
||||
SourceFiles
|
||||
EulerCoordinateRotation.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotations_euler_H
|
||||
#define coordinateRotations_euler_H
|
||||
#ifndef Foam_coordinateRotations_euler_H
|
||||
#define Foam_coordinateRotations_euler_H
|
||||
|
||||
#include "coordinateRotation.H"
|
||||
#include "quaternion.H"
|
||||
@ -139,11 +144,11 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- The rotation tensor calculated for the intrinsic Euler
|
||||
//- Rotation tensor calculated for the intrinsic Euler
|
||||
//- angles in z-x-z order
|
||||
static tensor rotation(const vector& angles, bool degrees=false);
|
||||
|
||||
//- The rotation tensor calculated for given angles and order
|
||||
//- Rotation tensor calculated for given order and angles
|
||||
static tensor rotation
|
||||
(
|
||||
const eulerOrder order,
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,36 +27,38 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "STARCDCoordinateRotation.H"
|
||||
#include "unitConversion.H"
|
||||
#include "EulerCoordinateRotation.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateRotations
|
||||
{
|
||||
defineTypeName(starcd);
|
||||
namespace coordinateRotations
|
||||
{
|
||||
|
||||
// Standard short name
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
starcd,
|
||||
dictionary,
|
||||
starcd
|
||||
);
|
||||
defineTypeName(starcd);
|
||||
|
||||
// Longer name - Compat 1806
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
starcd,
|
||||
dictionary,
|
||||
STARCDRotation
|
||||
);
|
||||
}
|
||||
}
|
||||
// Standard short name
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
starcd,
|
||||
dictionary,
|
||||
starcd
|
||||
);
|
||||
|
||||
// Longer name - Compat 1806
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
starcd,
|
||||
dictionary,
|
||||
STARCDRotation
|
||||
);
|
||||
|
||||
} // End namespace coordinateRotation
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
@ -67,28 +69,7 @@ Foam::tensor Foam::coordinateRotations::starcd::rotation
|
||||
bool degrees
|
||||
)
|
||||
{
|
||||
scalar z = angles.component(vector::X); // 1. Rotate about Z
|
||||
scalar x = angles.component(vector::Y); // 2. Rotate about X
|
||||
scalar y = angles.component(vector::Z); // 3. Rotate about Y
|
||||
|
||||
if (degrees)
|
||||
{
|
||||
x *= degToRad();
|
||||
y *= degToRad();
|
||||
z *= degToRad();
|
||||
}
|
||||
|
||||
const scalar cx = cos(x); const scalar sx = sin(x);
|
||||
const scalar cy = cos(y); const scalar sy = sin(y);
|
||||
const scalar cz = cos(z); const scalar sz = sin(z);
|
||||
|
||||
return
|
||||
tensor
|
||||
(
|
||||
cy*cz - sx*sy*sz, -cx*sz, sx*cy*sz + sy*cz,
|
||||
cy*sz + sx*sy*cz, cx*cz, sy*sz - sx*cy*cz,
|
||||
-cx*sy, sx, cx*cy
|
||||
);
|
||||
return euler::rotation(euler::eulerOrder::ZXY, angles, degrees);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,8 +57,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotations_starcd_H
|
||||
#define coordinateRotations_starcd_H
|
||||
#ifndef Foam_coordinateRotations_starcd_H
|
||||
#define Foam_coordinateRotations_starcd_H
|
||||
|
||||
#include "coordinateRotation.H"
|
||||
|
||||
@ -124,7 +124,7 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- The rotation tensor calculated for the specified STARCD angles
|
||||
//- Rotation tensor calculated for the specified STARCD angles
|
||||
//- interpreted as rotate-Z, rotate-X, rotate-Y
|
||||
static tensor rotation(const vector& angles, bool degrees);
|
||||
|
||||
@ -142,7 +142,6 @@ public:
|
||||
|
||||
//- Write dictionary entry
|
||||
virtual void writeEntry(const word& keyword, Ostream& os) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,29 +34,31 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateRotations
|
||||
{
|
||||
defineTypeName(axes);
|
||||
namespace coordinateRotations
|
||||
{
|
||||
|
||||
// Standard short name
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
axes,
|
||||
dictionary,
|
||||
axes
|
||||
);
|
||||
defineTypeName(axes);
|
||||
|
||||
// Longer name - Compat 1806
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
axes,
|
||||
dictionary,
|
||||
axesRotation
|
||||
);
|
||||
}
|
||||
}
|
||||
// Standard short name
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
axes,
|
||||
dictionary,
|
||||
axes
|
||||
);
|
||||
|
||||
// Longer name - Compat 1806
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
axes,
|
||||
dictionary,
|
||||
axesRotation
|
||||
);
|
||||
|
||||
} // End namespace coordinateRotations
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
@ -61,8 +61,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotations_axes_H
|
||||
#define coordinateRotations_axes_H
|
||||
#ifndef Foam_coordinateRotations_axes_H
|
||||
#define Foam_coordinateRotations_axes_H
|
||||
|
||||
#include "coordinateRotation.H"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,17 +35,19 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateRotations
|
||||
{
|
||||
defineTypeName(axisAngle);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
axisAngle,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
namespace coordinateRotations
|
||||
{
|
||||
|
||||
defineTypeName(axisAngle);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
axisAngle,
|
||||
dictionary
|
||||
);
|
||||
|
||||
} // End namespace coordinateRotation
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -77,6 +79,20 @@ Foam::tensor Foam::coordinateRotations::axisAngle::rotation
|
||||
}
|
||||
|
||||
|
||||
Foam::tensor Foam::coordinateRotations::axisAngle::rotation
|
||||
(
|
||||
const vector::components axis,
|
||||
const scalar angle,
|
||||
bool degrees
|
||||
)
|
||||
{
|
||||
vector rotAxis(Zero);
|
||||
rotAxis[axis] = 1;
|
||||
|
||||
return axisAngle::rotation(rotAxis, angle, degrees);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coordinateRotations::axisAngle::axisAngle()
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,23 +41,23 @@ Description
|
||||
|
||||
\heading Dictionary entries
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | Type name: axisAngle | yes |
|
||||
axis | Axis of rotation (vector) | yes |
|
||||
angle | Rotation angle | yes |
|
||||
degrees | The angle is in degrees | no | true
|
||||
Property | Description | Reqd | Default
|
||||
type | Type name: axisAngle | yes |
|
||||
axis | Axis of rotation (vector) | yes |
|
||||
angle | Rotation angle | yes |
|
||||
degrees | The angle is in degrees | no | true
|
||||
\endtable
|
||||
|
||||
Note
|
||||
The rotation axis will be normalized internally.
|
||||
The rotation axis is normalized internally.
|
||||
|
||||
SourceFiles
|
||||
axisAngleRotation.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotations_axisAngle_H
|
||||
#define coordinateRotations_axisAngle_H
|
||||
#ifndef Foam_coordinateRotations_axisAngle_H
|
||||
#define Foam_coordinateRotations_axisAngle_H
|
||||
|
||||
#include "coordinateRotation.H"
|
||||
|
||||
@ -140,6 +140,14 @@ public:
|
||||
bool degrees=false
|
||||
);
|
||||
|
||||
//- Rotation tensor calculated for given axis and angle
|
||||
static tensor rotation
|
||||
(
|
||||
const vector::components axis,
|
||||
const scalar angle,
|
||||
bool degrees=false
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,8 +58,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotation_H
|
||||
#define coordinateRotation_H
|
||||
#ifndef Foam_coordinateRotation_H
|
||||
#define Foam_coordinateRotation_H
|
||||
|
||||
#include "autoPtr.H"
|
||||
#include "vector.H"
|
||||
|
@ -32,17 +32,19 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateRotations
|
||||
{
|
||||
defineTypeName(cylindrical);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
cylindrical,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
namespace coordinateRotations
|
||||
{
|
||||
|
||||
defineTypeName(cylindrical);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
cylindrical,
|
||||
dictionary
|
||||
);
|
||||
|
||||
} // End namespace coordinateRotations
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
@ -34,10 +34,10 @@ Description
|
||||
|
||||
\heading Dictionary entries
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | Type name: cylindrical | yes |
|
||||
axis | The z-axis | yes |
|
||||
e3 | Alias for 'axis' | no |
|
||||
Property | Description | Reqd | Default
|
||||
type | Type name: cylindrical | yes |
|
||||
axis | The z-axis | yes |
|
||||
e3 | Alias for 'axis' | no |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
@ -45,8 +45,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotations_cylindrical_H
|
||||
#define coordinateRotations_cylindrical_H
|
||||
#ifndef Foam_coordinateRotations_cylindrical_H
|
||||
#define Foam_coordinateRotations_cylindrical_H
|
||||
|
||||
#include "axesRotation.H"
|
||||
|
||||
|
@ -33,17 +33,19 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateRotations
|
||||
{
|
||||
defineTypeName(identity);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
identity,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
namespace coordinateRotations
|
||||
{
|
||||
|
||||
defineTypeName(identity);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
identity,
|
||||
dictionary
|
||||
);
|
||||
|
||||
} // End namespace coordinateRotations
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
@ -38,8 +38,8 @@ Description
|
||||
|
||||
\heading Dictionary entries
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
type | Type name: none | yes |
|
||||
Property | Description | Reqd | Default
|
||||
type | Type name: none | yes |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
@ -47,8 +47,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotations_identity_H
|
||||
#define coordinateRotations_identity_H
|
||||
#ifndef Foam_coordinateRotations_identity_H
|
||||
#define Foam_coordinateRotations_identity_H
|
||||
|
||||
#include "coordinateRotation.H"
|
||||
|
||||
|
@ -39,8 +39,8 @@ namespace coordinateRotations
|
||||
defineTypeName(specified);
|
||||
//FUTURE addToRunTimeSelectionTable(coordinateRotation, specified, dictionary);
|
||||
|
||||
}
|
||||
}
|
||||
} // End namespace coordinateRotations
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
@ -43,8 +43,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateRotations_specified_H
|
||||
#define coordinateRotations_specified_H
|
||||
#ifndef Foam_coordinateRotations_specified_H
|
||||
#define Foam_coordinateRotations_specified_H
|
||||
|
||||
#include "coordinateRotation.H"
|
||||
|
||||
|
@ -97,8 +97,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coordinateSystem_H
|
||||
#define coordinateSystem_H
|
||||
#ifndef Foam_coordinateSystem_H
|
||||
#define Foam_coordinateSystem_H
|
||||
|
||||
#include "vector.H"
|
||||
#include "point.H"
|
||||
|
@ -10,7 +10,7 @@ runApplication blockMesh
|
||||
runApplication mergeMeshes . ../cylinderMesh -overwrite
|
||||
|
||||
## Make it a bit smaller to keep it laminar
|
||||
#runApplication transformPoints -scale '(0.001 0.001 0.001)'
|
||||
#runApplication transformPoints -scale 0.001
|
||||
|
||||
# Select cellSets for the different zones
|
||||
runApplication topoSet
|
||||
|
@ -10,7 +10,7 @@ runApplication blockMesh
|
||||
runApplication mergeMeshes . ../cylinderMesh -overwrite
|
||||
|
||||
## Make it a bit smaller to keep it laminar
|
||||
#runApplication transformPoints -scale '(0.001 0.001 0.001)'
|
||||
#runApplication transformPoints -scale 0.001
|
||||
|
||||
# Select cellSets for the different zones
|
||||
runApplication topoSet
|
||||
|
@ -13,7 +13,7 @@ restore0Dir
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication transformPoints -scale "(1 0 1)"
|
||||
runApplication transformPoints -scale '(1 0 1)'
|
||||
|
||||
runApplication extrudeMesh
|
||||
|
||||
|
@ -13,7 +13,7 @@ restore0Dir
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication transformPoints -scale "(1 0 1)"
|
||||
runApplication transformPoints -scale '(1 0 1)'
|
||||
|
||||
runApplication extrudeMesh
|
||||
|
||||
|
@ -10,7 +10,7 @@ runApplication blockMesh
|
||||
runApplication mergeMeshes . ../cylinderMesh -overwrite
|
||||
|
||||
## Make it a bit smaller to keep it laminar
|
||||
#runApplication transformPoints -scale '(0.001 0.001 0.001)'
|
||||
#runApplication transformPoints -scale 0.001
|
||||
|
||||
# Select cellSets for the different zones
|
||||
runApplication topoSet
|
||||
|
@ -60,9 +60,9 @@ geometry
|
||||
{
|
||||
type cartesian;
|
||||
origin (2 2 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axesRotation;
|
||||
type axes;
|
||||
e1 (1 0 0);
|
||||
e3 (0 0 1);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ restore0Dir
|
||||
|
||||
runApplication setFields
|
||||
|
||||
runApplication transformPoints -rollPitchYaw "(0 -90 0)"
|
||||
runApplication transformPoints -rotate-y -90
|
||||
|
||||
runApplication checkMesh -allGeometry -allTopology
|
||||
|
||||
|
@ -9,7 +9,7 @@ mkdir -p constant/triSurface
|
||||
runApplication surfaceTransformPoints \
|
||||
-translate '(0 0 5)' \
|
||||
-origin '(0 0 5)' \
|
||||
-rotate-angle '((1 0 0) 45)' \
|
||||
-rotate-x 45 \
|
||||
"$FOAM_TUTORIALS"/resources/geometry/blob.stl.gz \
|
||||
constant/triSurface/blob.obj
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user