coordinateSystems/coordinateRotation/cylindrical: Simplified use of R
This commit is contained in:
@ -161,17 +161,20 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Transform vector using transformation tensor
|
||||||
|
virtual vector transform(const vector& st) const = 0;
|
||||||
|
|
||||||
//- Transform vectorField using transformation tensor field
|
//- Transform vectorField using transformation tensor field
|
||||||
virtual tmp<vectorField> transform(const vectorField& st) const = 0;
|
virtual tmp<vectorField> transform(const vectorField& st) const = 0;
|
||||||
|
|
||||||
//- Transform vector using transformation tensor
|
//- Inverse transform vector using transformation tensor
|
||||||
virtual vector transform(const vector& st) const = 0;
|
virtual vector invTransform(const vector& st) const = 0;
|
||||||
|
|
||||||
//- Inverse transform vectorField using transformation tensor field
|
//- Inverse transform vectorField using transformation tensor field
|
||||||
virtual tmp<vectorField> invTransform(const vectorField& st) const = 0;
|
virtual tmp<vectorField> invTransform(const vectorField& st) const = 0;
|
||||||
|
|
||||||
//- Inverse transform vector using transformation tensor
|
//- Transform tensor using transformation tensorField
|
||||||
virtual vector invTransform(const vector& st) const = 0;
|
virtual tensor transformTensor(const tensor& st) const = 0;
|
||||||
|
|
||||||
//- Transform tensor field using transformation tensorField
|
//- Transform tensor field using transformation tensorField
|
||||||
virtual tmp<tensorField> transformTensor
|
virtual tmp<tensorField> transformTensor
|
||||||
@ -179,26 +182,22 @@ public:
|
|||||||
const tensorField& st
|
const tensorField& st
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Transform tensor using transformation tensorField
|
//- Transform vector using transformation tensor and return
|
||||||
virtual tensor transformTensor(const tensor& st) const = 0;
|
// symmetrical tensor
|
||||||
|
virtual symmTensor transformVector(const vector& st) const = 0;
|
||||||
|
|
||||||
//- Transform vectorField using transformation tensorField and return
|
//- Transform vectorField using transformation tensorField and return
|
||||||
// symmetrical tensorField
|
// symmetrical tensorField
|
||||||
virtual tmp<symmTensorField> transformVector
|
virtual tmp<symmTensorField> transformVector
|
||||||
(
|
(
|
||||||
const vectorField& st
|
const vectorField& st
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Transform vector using transformation tensor and return
|
|
||||||
// symmetrical tensor
|
|
||||||
virtual symmTensor transformVector(const vector& st) const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write(Ostream&) const = 0;
|
virtual void write(Ostream&) const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -40,20 +40,25 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tensor Foam::cylindrical::R(const vector& dir) const
|
Foam::tensor Foam::cylindrical::R(const vector& p) const
|
||||||
{
|
{
|
||||||
const vector e3 = e3_/mag(e3_);
|
vector dir = p - origin_;
|
||||||
const vector r = dir - (dir & e3)*e3;
|
dir /= mag(dir) + vSmall;
|
||||||
|
|
||||||
|
const vector axis = axis_/mag(axis_);
|
||||||
|
const vector r = dir - (dir & axis)*axis;
|
||||||
|
|
||||||
if (mag(r) < small)
|
if (mag(r) < small)
|
||||||
{
|
{
|
||||||
// If the point is on the axis choose any radial direction
|
// If the point is on the axis choose any radial direction
|
||||||
return axesRotation(e3, perpendicular(e3)).R();
|
return axesRotation(axis, perpendicular(axis)).R();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return axesRotation(e3, dir).R();
|
return axesRotation(axis, dir).R();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return tensor(r, axis^r, axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,10 +69,7 @@ void Foam::cylindrical::init(const UList<vector>& points)
|
|||||||
|
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vector dir = points[i] - origin_;
|
R[i] = this->R(points[i]);
|
||||||
dir /= mag(dir) + vSmall;
|
|
||||||
|
|
||||||
R[i] = this->R(dir);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +85,7 @@ Foam::cylindrical::cylindrical
|
|||||||
:
|
:
|
||||||
Rptr_(),
|
Rptr_(),
|
||||||
origin_(origin),
|
origin_(origin),
|
||||||
e3_(axis)
|
axis_(axis)
|
||||||
{
|
{
|
||||||
init(points);
|
init(points);
|
||||||
}
|
}
|
||||||
@ -92,17 +94,19 @@ Foam::cylindrical::cylindrical
|
|||||||
Foam::cylindrical::cylindrical(const dictionary& dict)
|
Foam::cylindrical::cylindrical(const dictionary& dict)
|
||||||
:
|
:
|
||||||
Rptr_(),
|
Rptr_(),
|
||||||
origin_(),
|
origin_
|
||||||
e3_()
|
(
|
||||||
|
dict.parent().found("origin")
|
||||||
|
? dict.parent().lookup("origin")
|
||||||
|
: dict.lookup("origin")
|
||||||
|
),
|
||||||
|
axis_
|
||||||
|
(
|
||||||
|
dict.found("e3")
|
||||||
|
? dict.lookup("e3")
|
||||||
|
: dict.lookup("axis")
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// If origin is specified in the coordinateSystem
|
|
||||||
if (dict.parent().found("origin"))
|
|
||||||
{
|
|
||||||
dict.parent().lookup("origin") >> origin_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rotation axis
|
|
||||||
dict.lookup("e3") >> e3_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -135,10 +139,7 @@ void Foam::cylindrical::updatePoints(const UList<vector>& points)
|
|||||||
|
|
||||||
forAll(points, i)
|
forAll(points, i)
|
||||||
{
|
{
|
||||||
vector dir = points[i] - origin_;
|
R[i] = this->R(points[i]);
|
||||||
dir /= mag(dir) + vSmall;
|
|
||||||
|
|
||||||
R[i] = this->R(dir);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +271,7 @@ Foam::symmTensor Foam::cylindrical::transformVector
|
|||||||
|
|
||||||
void Foam::cylindrical::write(Ostream& os) const
|
void Foam::cylindrical::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
writeEntry(os, "e3", e3());
|
writeEntry(os, "axis", axis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,15 +28,15 @@ Description
|
|||||||
A local coordinate rotation.
|
A local coordinate rotation.
|
||||||
|
|
||||||
The rotational field can be created in two ways:
|
The rotational field can be created in two ways:
|
||||||
-# Each rotational tensor is defined with two vectors (\c dir and \c e3)
|
-# Each rotational tensor is defined with two vectors (\c dir and \c axis)
|
||||||
where <tt>dir = point - origin</tt> and \c e3 is the rotation axis.
|
where <tt>dir = point - origin</tt> and \c axis is the rotation axis.
|
||||||
Per each point an axesRotation type of rotation is created
|
Per each point an axesRotation type of rotation is created
|
||||||
(cylindrical coordinates). For example:
|
(cylindrical coordinates). For example:
|
||||||
\verbatim
|
\verbatim
|
||||||
cylindrical
|
cylindrical
|
||||||
{
|
{
|
||||||
type localAxes;
|
type localAxes;
|
||||||
e3 (0 0 1);
|
axis (0 0 1);
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
@ -76,14 +76,14 @@ class cylindrical
|
|||||||
point origin_;
|
point origin_;
|
||||||
|
|
||||||
//- Rotation axis
|
//- Rotation axis
|
||||||
vector e3_;
|
vector axis_;
|
||||||
|
|
||||||
|
|
||||||
// Private members
|
// Private members
|
||||||
|
|
||||||
//- Return the local transformation tensor
|
//- Return the local transformation tensor
|
||||||
// corresponding to the given vector
|
// corresponding to the given point
|
||||||
tensor R(const vector& dir) const;
|
tensor R(const vector& p) const;
|
||||||
|
|
||||||
//- Initialise transformation tensor field for given points
|
//- Initialise transformation tensor field for given points
|
||||||
void init(const UList<vector>& points);
|
void init(const UList<vector>& points);
|
||||||
@ -151,26 +151,14 @@ public:
|
|||||||
//- Return local Cartesian z-axis in global coordinates
|
//- Return local Cartesian z-axis in global coordinates
|
||||||
virtual const vector e3() const
|
virtual const vector e3() const
|
||||||
{
|
{
|
||||||
return e3_;
|
return axis_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Transform vectorField using transformation tensor field
|
//- Return local Cartesian z-axis in global coordinates
|
||||||
virtual tmp<vectorField> transform(const vectorField& tf) const;
|
virtual const vector axis() const
|
||||||
|
{
|
||||||
//- Transform vector using transformation tensor
|
return axis_;
|
||||||
virtual vector transform(const vector& v) const;
|
}
|
||||||
|
|
||||||
//- Transform vector using transformation tensor for component
|
|
||||||
virtual vector transform(const vector& v, const label cmptI) const;
|
|
||||||
|
|
||||||
//- Inverse transform vectorField using transformation tensor field
|
|
||||||
virtual tmp<vectorField> invTransform(const vectorField& vf) const;
|
|
||||||
|
|
||||||
//- Inverse transform vector using transformation tensor
|
|
||||||
virtual vector invTransform(const vector& v) const;
|
|
||||||
|
|
||||||
//- Inverse transform vector using transformation tensor for component
|
|
||||||
virtual vector invTransform(const vector& v, const label cmptI) const;
|
|
||||||
|
|
||||||
//- Return if the rotation is uniform
|
//- Return if the rotation is uniform
|
||||||
virtual bool uniform() const
|
virtual bool uniform() const
|
||||||
@ -178,23 +166,41 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Transform tensor field using transformation tensorField
|
//- Transform vector using transformation tensor
|
||||||
virtual tmp<tensorField> transformTensor(const tensorField& tf) const;
|
virtual vector transform(const vector& v) const;
|
||||||
|
|
||||||
|
//- Transform vectorField using transformation tensor field
|
||||||
|
virtual tmp<vectorField> transform(const vectorField& tf) const;
|
||||||
|
|
||||||
|
//- Transform vector using transformation tensor for component
|
||||||
|
virtual vector transform(const vector& v, const label cmptI) const;
|
||||||
|
|
||||||
|
//- Inverse transform vector using transformation tensor
|
||||||
|
virtual vector invTransform(const vector& v) const;
|
||||||
|
|
||||||
|
//- Inverse transform vectorField using transformation tensor field
|
||||||
|
virtual tmp<vectorField> invTransform(const vectorField& vf) const;
|
||||||
|
|
||||||
|
//- Inverse transform vector using transformation tensor for component
|
||||||
|
virtual vector invTransform(const vector& v, const label cmptI) const;
|
||||||
|
|
||||||
//- Transform tensor using transformation tensorField
|
//- Transform tensor using transformation tensorField
|
||||||
virtual tensor transformTensor(const tensor& t) const;
|
virtual tensor transformTensor(const tensor& t) const;
|
||||||
|
|
||||||
|
//- Transform tensor field using transformation tensorField
|
||||||
|
virtual tmp<tensorField> transformTensor(const tensorField& tf) const;
|
||||||
|
|
||||||
|
//- Transform vector using transformation tensor and return
|
||||||
|
// symmetrical tensor
|
||||||
|
virtual symmTensor transformVector(const vector& v) const;
|
||||||
|
|
||||||
//- Transform vectorField using transformation tensorField and return
|
//- Transform vectorField using transformation tensorField and return
|
||||||
// symmetrical tensorField
|
// symmetrical tensorField
|
||||||
virtual tmp<symmTensorField> transformVector
|
virtual tmp<symmTensorField> transformVector
|
||||||
(
|
(
|
||||||
const vectorField& vf
|
const vectorField& vf
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Transform vector using transformation tensor and return
|
|
||||||
// symmetrical tensor (R & st & R.T())
|
|
||||||
virtual symmTensor transformVector(const vector& v) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user