coordinateSystems: Initial work to simplify and rationalise
There is much more to be done, a complete rewrite of coordinateSystems would be best.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -123,10 +123,13 @@ void Foam::porosityModels::DarcyForchheimer::calcTransformModelData()
|
||||
F_[zoneI][i].zz() = 0.5*fXYZ_.value().z();
|
||||
}
|
||||
|
||||
const coordinateRotation& R = coordSys_.R(mesh_, cells);
|
||||
const coordinateRotation& R = coordSys_.R
|
||||
(
|
||||
UIndirectList<vector>(mesh_.C(), cells)()
|
||||
);
|
||||
|
||||
D_[zoneI] = R.transformTensor(D_[zoneI], cells);
|
||||
F_[zoneI] = R.transformTensor(F_[zoneI], cells);
|
||||
D_[zoneI] = R.transformTensor(D_[zoneI]);
|
||||
F_[zoneI] = R.transformTensor(F_[zoneI]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -175,10 +175,13 @@ void Foam::porosityModels::fixedCoeff::calcTransformModelData()
|
||||
beta_[zoneI][i].zz() = betaXYZ_.value().z();
|
||||
}
|
||||
|
||||
const coordinateRotation& R = coordSys_.R(mesh_, cells);
|
||||
const coordinateRotation& R = coordSys_.R
|
||||
(
|
||||
UIndirectList<vector>(mesh_.C(), cells)()
|
||||
);
|
||||
|
||||
alpha_[zoneI] = R.transformTensor(alpha_[zoneI], cells);
|
||||
beta_[zoneI] = R.transformTensor(beta_[zoneI], cells);
|
||||
alpha_[zoneI] = R.transformTensor(alpha_[zoneI]);
|
||||
beta_[zoneI] = R.transformTensor(beta_[zoneI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,7 +56,7 @@ fieldCoordinateSystemTransform
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
fieldSet_(),
|
||||
coordSys_(mesh_, dict.subDict("coordinateSystem"))
|
||||
coordSys_(coordinateSystem::New(mesh_, dict.subDict("coordinateSystem"))())
|
||||
{
|
||||
read(dict);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -362,7 +362,7 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
||||
|
||||
if (dict.found("coordinateSystem"))
|
||||
{
|
||||
coordSysPtr_.reset(new coordinateSystem(obr_, dict));
|
||||
coordSysPtr_ = coordinateSystem::New(obr_, dict);
|
||||
|
||||
Info<< "Transforming all vectorFields with coordinate system "
|
||||
<< coordSysPtr_().name() << endl;
|
||||
|
||||
@ -547,7 +547,7 @@ Foam::functionObjects::forces::forces
|
||||
fDName_(""),
|
||||
rhoRef_(vGreat),
|
||||
pRef_(0),
|
||||
coordSys_(),
|
||||
coordSys_("coordSys", vector::zero),
|
||||
localSystem_(false),
|
||||
porosity_(false),
|
||||
nBin_(1),
|
||||
@ -582,7 +582,7 @@ Foam::functionObjects::forces::forces
|
||||
fDName_(""),
|
||||
rhoRef_(vGreat),
|
||||
pRef_(0),
|
||||
coordSys_(),
|
||||
coordSys_("coordSys", vector::zero),
|
||||
localSystem_(false),
|
||||
porosity_(false),
|
||||
nBin_(1),
|
||||
@ -642,13 +642,16 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
||||
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
|
||||
}
|
||||
|
||||
coordSys_.clear();
|
||||
|
||||
// Centre of rotation for moment calculations
|
||||
// specified directly, from coordinate system, or implicitly (0 0 0)
|
||||
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
|
||||
if (dict.found("CofR"))
|
||||
{
|
||||
coordSys_ = coordinateSystem(obr_, dict);
|
||||
coordSys_ = coordinateSystem("coordSys", vector(dict.lookup("CofR")));
|
||||
localSystem_ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
coordSys_ = coordinateSystem("coordSys", dict);
|
||||
localSystem_ = true;
|
||||
}
|
||||
|
||||
|
||||
@ -24,11 +24,12 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "rotorDiskSource.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "trimModel.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "geometricOneField.H"
|
||||
#include "syncTools.H"
|
||||
#include "axesRotation.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
@ -42,8 +43,8 @@ namespace Foam
|
||||
addToRunTimeSelectionTable(option, rotorDiskSource, dictionary);
|
||||
}
|
||||
|
||||
template<> const char* NamedEnum<fv::rotorDiskSource::geometryModeType, 2>::
|
||||
names[] =
|
||||
template<> const char*
|
||||
NamedEnum<fv::rotorDiskSource::geometryModeType, 2>::names[] =
|
||||
{
|
||||
"auto",
|
||||
"specified"
|
||||
@ -52,8 +53,8 @@ namespace Foam
|
||||
const NamedEnum<fv::rotorDiskSource::geometryModeType, 2>
|
||||
fv::rotorDiskSource::geometryModeTypeNames_;
|
||||
|
||||
template<> const char* NamedEnum<fv::rotorDiskSource::inletFlowType, 3>::
|
||||
names[] =
|
||||
template<> const char*
|
||||
NamedEnum<fv::rotorDiskSource::inletFlowType, 3>::names[] =
|
||||
{
|
||||
"fixed",
|
||||
"surfaceNormal",
|
||||
@ -338,13 +339,7 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
||||
|
||||
cylindrical_.reset
|
||||
(
|
||||
new cylindrical
|
||||
(
|
||||
mesh_,
|
||||
axis,
|
||||
origin,
|
||||
cells
|
||||
)
|
||||
new cylindrical(axis, origin, UIndirectList<vector>(C, cells)())
|
||||
);
|
||||
|
||||
// Set the face areas and apply correction to calculated axis
|
||||
@ -363,10 +358,9 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
||||
(
|
||||
new cylindrical
|
||||
(
|
||||
mesh_,
|
||||
axis,
|
||||
origin,
|
||||
cells()
|
||||
UIndirectList<vector>(mesh_.C(), this->cells())()
|
||||
)
|
||||
);
|
||||
|
||||
@ -475,7 +469,6 @@ Foam::fv::rotorDiskSource::rotorDiskSource
|
||||
const word& modelType,
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
|
||||
)
|
||||
:
|
||||
cellSetOption(name, modelType, dict, mesh),
|
||||
@ -490,7 +483,7 @@ Foam::fv::rotorDiskSource::rotorDiskSource
|
||||
R_(cells().size(), I),
|
||||
invR_(cells().size(), I),
|
||||
area_(cells().size(), 0.0),
|
||||
coordSys_(false),
|
||||
coordSys_("rotorCoordSys", vector::zero, axesRotation(sphericalTensor::I)),
|
||||
cylindrical_(),
|
||||
rMax_(0.0),
|
||||
trim_(trimModel::New(*this, coeffs_)),
|
||||
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "Random.H"
|
||||
#include "triangle.H"
|
||||
#include "cloud.H"
|
||||
#include "axesRotation.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -522,7 +523,7 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
|
||||
faceTris_(),
|
||||
nSector_(0),
|
||||
radius_(),
|
||||
coordSys_(false),
|
||||
coordSys_("coordSys", vector::zero, axesRotation(sphericalTensor::I)),
|
||||
normal_(),
|
||||
negateParcelsOppositeNormal_
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,84 +38,7 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cartesianCS::cartesianCS()
|
||||
:
|
||||
coordinateSystem()
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const coordinateSystem& cs
|
||||
)
|
||||
:
|
||||
coordinateSystem(cs)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const coordinateSystem& cs
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, cs)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const coordinateRotation& cr
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, cr)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const vector& axis,
|
||||
const vector& dirn
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, axis, dirn)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, dict)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coordinateSystem(obr, dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cartesianCS::~cartesianCS()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::cartesianCS::localToGlobal
|
||||
(
|
||||
@ -157,4 +80,45 @@ Foam::tmp<Foam::vectorField> Foam::cartesianCS::globalToLocal
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const coordinateRotation& cr
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, cr)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const vector& axis,
|
||||
const vector& dirn
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, axis, dirn)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cartesianCS::~cartesianCS()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -51,10 +51,7 @@ class cartesianCS
|
||||
:
|
||||
public coordinateSystem
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Convert from local coordinate system to the global Cartesian system
|
||||
// with optional translation for the origin
|
||||
@ -89,22 +86,6 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
cartesianCS();
|
||||
|
||||
//- Construct copy
|
||||
cartesianCS
|
||||
(
|
||||
const coordinateSystem&
|
||||
);
|
||||
|
||||
//- Construct copy with a different name
|
||||
cartesianCS
|
||||
(
|
||||
const word& name,
|
||||
const coordinateSystem&
|
||||
);
|
||||
|
||||
//- Construct from origin and rotation
|
||||
cartesianCS
|
||||
(
|
||||
@ -126,13 +107,8 @@ public:
|
||||
cartesianCS(const word&, const dictionary&);
|
||||
|
||||
|
||||
//- Construct from dictionary and objectRegistry
|
||||
cartesianCS(const objectRegistry&, const dictionary&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cartesianCS();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,109 +43,10 @@ namespace Foam
|
||||
(
|
||||
coordinateRotation,
|
||||
EulerCoordinateRotation,
|
||||
objectRegistry
|
||||
points
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::EulerCoordinateRotation::transform(const vector& st) const
|
||||
{
|
||||
return (R_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::EulerCoordinateRotation::invTransform
|
||||
(
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return (Rtr_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::transform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::invTransform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
const Foam::tensorField& Foam::EulerCoordinateRotation::Tr() const
|
||||
{
|
||||
NotImplemented;
|
||||
return NullObjectRef<tensorField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::EulerCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<tensorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tensor Foam::EulerCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensor& st
|
||||
) const
|
||||
{
|
||||
return (R_ & st & Rtr_);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::EulerCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensorField& st,
|
||||
const labelList& cellMap
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<tensorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::EulerCoordinateRotation::
|
||||
transformVector
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
tmp<symmTensorField> tfld(new symmTensorField(st.size()));
|
||||
symmTensorField& fld = tfld.ref();
|
||||
|
||||
forAll(fld, i)
|
||||
{
|
||||
fld[i] = transformPrincipal(R_, st[i]);
|
||||
}
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
Foam::symmTensor Foam::EulerCoordinateRotation::transformVector
|
||||
(
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return transformPrincipal(R_, st);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -192,47 +93,6 @@ void Foam::EulerCoordinateRotation::calcTransform
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation()
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
||||
(
|
||||
const vector& phiThetaPsi,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{
|
||||
calcTransform
|
||||
(
|
||||
phiThetaPsi.component(vector::X),
|
||||
phiThetaPsi.component(vector::Y),
|
||||
phiThetaPsi.component(vector::Z),
|
||||
inDegrees
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
||||
(
|
||||
const scalar phiAngle,
|
||||
const scalar thetaAngle,
|
||||
const scalar psiAngle,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{
|
||||
calcTransform(phiAngle, thetaAngle, psiAngle, inDegrees);
|
||||
}
|
||||
|
||||
|
||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
||||
(
|
||||
const dictionary& dict
|
||||
@ -256,21 +116,92 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
||||
(
|
||||
const dictionary& dict,
|
||||
const objectRegistry&
|
||||
const UList<vector>& points
|
||||
)
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{
|
||||
vector rotation(dict.lookup("rotation"));
|
||||
EulerCoordinateRotation(dict)
|
||||
{}
|
||||
|
||||
calcTransform
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::EulerCoordinateRotation::transform(const vector& st) const
|
||||
{
|
||||
return (R_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::EulerCoordinateRotation::invTransform
|
||||
(
|
||||
rotation.component(vector::X),
|
||||
rotation.component(vector::Y),
|
||||
rotation.component(vector::Z),
|
||||
dict.lookupOrDefault("degrees", true)
|
||||
);
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return (Rtr_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::transform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::invTransform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::EulerCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<tensorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tensor Foam::EulerCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensor& st
|
||||
) const
|
||||
{
|
||||
return (R_ & st & Rtr_);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::EulerCoordinateRotation::
|
||||
transformVector
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
tmp<symmTensorField> tfld(new symmTensorField(st.size()));
|
||||
symmTensorField& fld = tfld.ref();
|
||||
|
||||
forAll(fld, i)
|
||||
{
|
||||
fld[i] = transformPrincipal(R_, st[i]);
|
||||
}
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
Foam::symmTensor Foam::EulerCoordinateRotation::transformVector
|
||||
(
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return transformPrincipal(R_, st);
|
||||
}
|
||||
|
||||
|
||||
@ -281,4 +212,5 @@ void Foam::EulerCoordinateRotation::write(Ostream& os) const
|
||||
writeEntry(os, "e3", e3());
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -98,43 +98,26 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
EulerCoordinateRotation();
|
||||
|
||||
//- Construct from rotation vector
|
||||
EulerCoordinateRotation
|
||||
(
|
||||
const vector& phiThetaPsi,
|
||||
const bool inDegrees=true
|
||||
);
|
||||
|
||||
//- Construct from components of rotation vector
|
||||
EulerCoordinateRotation
|
||||
(
|
||||
const scalar phiAngle,
|
||||
const scalar thetaAngle,
|
||||
const scalar psiAngle,
|
||||
const bool inDegrees=true
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
EulerCoordinateRotation(const dictionary&);
|
||||
|
||||
//- Construct from dictionary and mesh
|
||||
EulerCoordinateRotation(const dictionary&, const objectRegistry&);
|
||||
//- Construct from dictionary and list of points
|
||||
EulerCoordinateRotation(const dictionary&, const UList<vector>& points);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return autoPtr<coordinateRotation>
|
||||
(
|
||||
new EulerCoordinateRotation(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Reset rotation to an identity rotation
|
||||
virtual void clear()
|
||||
{
|
||||
R_ = sphericalTensor::I;
|
||||
Rtr_ = sphericalTensor::I;
|
||||
}
|
||||
|
||||
//- Update the rotation for a list of cells
|
||||
virtual void updateCells(const polyMesh&, const labelList&)
|
||||
//- Update the rotation for a list of points
|
||||
virtual void updatePoints(const UList<vector>& points)
|
||||
{}
|
||||
|
||||
//- Return local-to-global transformation tensor
|
||||
@ -143,12 +126,6 @@ public:
|
||||
return R_;
|
||||
}
|
||||
|
||||
//- Return global-to-local transformation tensor
|
||||
virtual const tensor& Rtr() const
|
||||
{
|
||||
return Rtr_;
|
||||
};
|
||||
|
||||
//- Return local Cartesian x-axis in global coordinates
|
||||
virtual const vector e1() const
|
||||
{
|
||||
@ -167,9 +144,6 @@ public:
|
||||
return Rtr_.z();
|
||||
}
|
||||
|
||||
//- Return transformation tensor field
|
||||
virtual const tensorField& Tr() const;
|
||||
|
||||
//- Transform vectorField using transformation tensor field
|
||||
virtual tmp<vectorField> transform(const vectorField& st) const;
|
||||
|
||||
@ -188,13 +162,6 @@ public:
|
||||
//- Transform tensor using transformation tensorField
|
||||
virtual tensor transformTensor(const tensor& st) const;
|
||||
|
||||
//- Transform tensor sub-field using transformation tensorField
|
||||
virtual tmp<tensorField> transformTensor
|
||||
(
|
||||
const tensorField& st,
|
||||
const labelList& cellMap
|
||||
) const;
|
||||
|
||||
//- Transform vectorField using transformation tensorField and return
|
||||
// symmetrical tensorField
|
||||
virtual tmp<symmTensorField> transformVector
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,110 +43,11 @@ namespace Foam
|
||||
(
|
||||
coordinateRotation,
|
||||
STARCDCoordinateRotation,
|
||||
objectRegistry
|
||||
points
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::STARCDCoordinateRotation::transform(const vector& st) const
|
||||
{
|
||||
return (R_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::STARCDCoordinateRotation::invTransform
|
||||
(
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return (Rtr_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::transform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::invTransform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
const Foam::tensorField& Foam::STARCDCoordinateRotation::Tr() const
|
||||
{
|
||||
NotImplemented;
|
||||
return NullObjectRef<tensorField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::STARCDCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<tensorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tensor Foam::STARCDCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensor& st
|
||||
) const
|
||||
{
|
||||
return (R_ & st & Rtr_);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::STARCDCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensorField& st,
|
||||
const labelList& cellMap
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<tensorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::STARCDCoordinateRotation::
|
||||
transformVector
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
tmp<symmTensorField> tfld(new symmTensorField(st.size()));
|
||||
symmTensorField& fld = tfld.ref();
|
||||
|
||||
forAll(fld, i)
|
||||
{
|
||||
fld[i] = transformPrincipal(R_, st[i]);
|
||||
}
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
Foam::symmTensor Foam::STARCDCoordinateRotation::transformVector
|
||||
(
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return transformPrincipal(R_, st);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::STARCDCoordinateRotation::calcTransform
|
||||
@ -192,47 +93,6 @@ void Foam::STARCDCoordinateRotation::calcTransform
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation()
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
||||
(
|
||||
const vector& rotZrotXrotY,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{
|
||||
calcTransform
|
||||
(
|
||||
rotZrotXrotY.component(vector::X),
|
||||
rotZrotXrotY.component(vector::Y),
|
||||
rotZrotXrotY.component(vector::Z),
|
||||
inDegrees
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
||||
(
|
||||
const scalar rotZ,
|
||||
const scalar rotX,
|
||||
const scalar rotY,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{
|
||||
calcTransform(rotZ, rotX, rotY, inDegrees);
|
||||
}
|
||||
|
||||
|
||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
||||
(
|
||||
const dictionary& dict
|
||||
@ -256,18 +116,92 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
||||
(
|
||||
const dictionary& dict,
|
||||
const objectRegistry&
|
||||
const UList<vector>& points
|
||||
)
|
||||
{
|
||||
vector rotation(dict.lookup("rotation"));
|
||||
:
|
||||
STARCDCoordinateRotation(dict)
|
||||
{}
|
||||
|
||||
calcTransform
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::STARCDCoordinateRotation::transform(const vector& st) const
|
||||
{
|
||||
return (R_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::STARCDCoordinateRotation::invTransform
|
||||
(
|
||||
rotation.component(vector::X),
|
||||
rotation.component(vector::Y),
|
||||
rotation.component(vector::Z),
|
||||
dict.lookupOrDefault("degrees", true)
|
||||
);
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return (Rtr_ & st);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::transform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::invTransform
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<vectorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::STARCDCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensorField& st
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<tensorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tensor Foam::STARCDCoordinateRotation::transformTensor
|
||||
(
|
||||
const tensor& st
|
||||
) const
|
||||
{
|
||||
return (R_ & st & Rtr_);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::STARCDCoordinateRotation::
|
||||
transformVector
|
||||
(
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
tmp<symmTensorField> tfld(new symmTensorField(st.size()));
|
||||
symmTensorField& fld = tfld.ref();
|
||||
|
||||
forAll(fld, i)
|
||||
{
|
||||
fld[i] = transformPrincipal(R_, st[i]);
|
||||
}
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
Foam::symmTensor Foam::STARCDCoordinateRotation::transformVector
|
||||
(
|
||||
const vector& st
|
||||
) const
|
||||
{
|
||||
return transformPrincipal(R_, st);
|
||||
}
|
||||
|
||||
|
||||
@ -278,4 +212,5 @@ void Foam::STARCDCoordinateRotation::write(Ostream& os) const
|
||||
writeEntry(os, "e3", e3());
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -95,42 +95,30 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
STARCDCoordinateRotation();
|
||||
|
||||
//- Construct from rotation vector
|
||||
STARCDCoordinateRotation
|
||||
(
|
||||
const vector& rotZrotXrotY,
|
||||
const bool inDegrees=true
|
||||
);
|
||||
|
||||
//- Construct from components of rotation vector
|
||||
STARCDCoordinateRotation
|
||||
(
|
||||
const scalar rotZ,
|
||||
const scalar rotX,
|
||||
const scalar rotY,
|
||||
const bool inDegrees=true
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
STARCDCoordinateRotation(const dictionary&);
|
||||
|
||||
//- Construct from dictionary and mesh
|
||||
STARCDCoordinateRotation(const dictionary&, const objectRegistry&);
|
||||
//- Construct from dictionary and list of points
|
||||
STARCDCoordinateRotation
|
||||
(
|
||||
const dictionary&,
|
||||
const UList<vector>& points
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return autoPtr<coordinateRotation>
|
||||
(
|
||||
new STARCDCoordinateRotation(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Reset rotation to an identity rotation
|
||||
virtual void clear()
|
||||
{
|
||||
R_ = sphericalTensor::I;
|
||||
Rtr_ = sphericalTensor::I;
|
||||
}
|
||||
|
||||
//- Update the rotation for a list of cells
|
||||
virtual void updateCells(const polyMesh&, const labelList&)
|
||||
//- Update the rotation for a list of points
|
||||
virtual void updatePoints(const UList<vector>& points)
|
||||
{}
|
||||
|
||||
//- Return local-to-global transformation tensor
|
||||
@ -139,12 +127,6 @@ public:
|
||||
return R_;
|
||||
}
|
||||
|
||||
//- Return global-to-local transformation tensor
|
||||
virtual const tensor& Rtr() const
|
||||
{
|
||||
return Rtr_;
|
||||
};
|
||||
|
||||
//- Return local Cartesian x-axis in global coordinates
|
||||
virtual const vector e1() const
|
||||
{
|
||||
@ -163,9 +145,6 @@ public:
|
||||
return Rtr_.z();
|
||||
}
|
||||
|
||||
//- Return transformation tensor field
|
||||
virtual const tensorField& Tr() const;
|
||||
|
||||
//- Transform vectorField using transformation tensor field
|
||||
virtual tmp<vectorField> transform(const vectorField& st) const;
|
||||
|
||||
@ -184,13 +163,6 @@ public:
|
||||
//- Transform tensor using transformation tensorField
|
||||
virtual tensor transformTensor(const tensor& st) const;
|
||||
|
||||
//- Transform tensor sub-field using transformation tensorField
|
||||
virtual tmp<tensorField> transformTensor
|
||||
(
|
||||
const tensorField& st,
|
||||
const labelList& cellMap
|
||||
) const;
|
||||
|
||||
//- Transform vectorField using transformation tensorField and return
|
||||
// symmetrical tensorField
|
||||
virtual tmp<symmTensorField> transformVector
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,12 +33,7 @@ namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(axesRotation, 0);
|
||||
addToRunTimeSelectionTable(coordinateRotation, axesRotation, dictionary);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
axesRotation,
|
||||
objectRegistry
|
||||
);
|
||||
addToRunTimeSelectionTable(coordinateRotation, axesRotation, points);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -105,13 +100,6 @@ void Foam::axesRotation::calcTransform
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::axesRotation::axesRotation()
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::axesRotation::axesRotation
|
||||
(
|
||||
const vector& axis,
|
||||
@ -125,6 +113,13 @@ Foam::axesRotation::axesRotation
|
||||
}
|
||||
|
||||
|
||||
Foam::axesRotation::axesRotation(const tensor& R)
|
||||
:
|
||||
R_(R),
|
||||
Rtr_(R_.T())
|
||||
{}
|
||||
|
||||
|
||||
Foam::axesRotation::axesRotation
|
||||
(
|
||||
const dictionary& dict
|
||||
@ -140,32 +135,15 @@ Foam::axesRotation::axesRotation
|
||||
Foam::axesRotation::axesRotation
|
||||
(
|
||||
const dictionary& dict,
|
||||
const objectRegistry& obr
|
||||
const UList<vector>& points
|
||||
)
|
||||
:
|
||||
R_(sphericalTensor::I),
|
||||
Rtr_(R_)
|
||||
{
|
||||
operator=(dict);
|
||||
}
|
||||
|
||||
|
||||
Foam::axesRotation::axesRotation(const tensor& R)
|
||||
:
|
||||
R_(R),
|
||||
Rtr_(R_.T())
|
||||
axesRotation(dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::tensorField& Foam::axesRotation::Tr() const
|
||||
{
|
||||
NotImplemented;
|
||||
return NullObjectRef<tensorField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::axesRotation::transform
|
||||
(
|
||||
const vectorField& st
|
||||
@ -215,17 +193,6 @@ Foam::tensor Foam::axesRotation::transformTensor
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::axesRotation::transformTensor
|
||||
(
|
||||
const tensorField& st,
|
||||
const labelList& cellMap
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<tensorField>(nullptr);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::axesRotation::transformVector
|
||||
(
|
||||
const vectorField& st
|
||||
@ -251,6 +218,14 @@ Foam::symmTensor Foam::axesRotation::transformVector
|
||||
}
|
||||
|
||||
|
||||
void Foam::axesRotation::write(Ostream& os) const
|
||||
{
|
||||
writeEntry(os, "e1", e1());
|
||||
writeEntry(os, "e2", e2());
|
||||
writeEntry(os, "e3", e3());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::axesRotation::operator=(const dictionary& dict)
|
||||
@ -296,12 +271,4 @@ void Foam::axesRotation::operator=(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::axesRotation::write(Ostream& os) const
|
||||
{
|
||||
writeEntry(os, "e1", e1());
|
||||
writeEntry(os, "e2", e2());
|
||||
writeEntry(os, "e3", e3());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -100,25 +100,22 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
axesRotation();
|
||||
|
||||
//- Construct from 2 axes
|
||||
axesRotation(const vector& axis, const vector& dir);
|
||||
|
||||
//- Construct from dictionary
|
||||
axesRotation(const dictionary&);
|
||||
|
||||
//- Construct from components
|
||||
axesRotation(const tensor& R);
|
||||
|
||||
//- Construct from dictionary and mesh
|
||||
axesRotation(const dictionary&, const objectRegistry&);
|
||||
//- Construct from dictionary
|
||||
axesRotation(const dictionary&);
|
||||
|
||||
//- Return clone
|
||||
autoPtr<axesRotation> clone() const
|
||||
//- Construct from dictionary and list of points
|
||||
axesRotation(const dictionary&, const UList<vector>& points);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return autoPtr<axesRotation>(new axesRotation(*this));
|
||||
return autoPtr<coordinateRotation>(new axesRotation(*this));
|
||||
}
|
||||
|
||||
|
||||
@ -129,15 +126,8 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Reset rotation to an identity rotation
|
||||
virtual void clear()
|
||||
{
|
||||
R_ = sphericalTensor::I;
|
||||
Rtr_ = sphericalTensor::I;
|
||||
}
|
||||
|
||||
//- Update the rotation for a list of cells
|
||||
virtual void updateCells(const polyMesh&, const labelList&)
|
||||
//- Update the rotation for a list of points
|
||||
virtual void updatePoints(const UList<vector>& points)
|
||||
{}
|
||||
|
||||
//- Return local-to-global transformation tensor
|
||||
@ -146,12 +136,6 @@ public:
|
||||
return R_;
|
||||
}
|
||||
|
||||
//- Return global-to-local transformation tensor
|
||||
virtual const tensor& Rtr() const
|
||||
{
|
||||
return Rtr_;
|
||||
}
|
||||
|
||||
//- Return local Cartesian x-axis in global coordinates
|
||||
virtual const vector e1() const
|
||||
{
|
||||
@ -170,9 +154,6 @@ public:
|
||||
return Rtr_.z();
|
||||
}
|
||||
|
||||
//- Return transformation tensor field
|
||||
virtual const tensorField& Tr() const;
|
||||
|
||||
//- Transform vectorField using transformation tensor field
|
||||
virtual tmp<vectorField> transform(const vectorField& st) const;
|
||||
|
||||
@ -191,13 +172,6 @@ public:
|
||||
//- Transform tensor using transformation tensorField
|
||||
virtual tensor transformTensor(const tensor& st) const;
|
||||
|
||||
//- Transform tensor sub-field using transformation tensorField
|
||||
virtual tmp<tensorField> transformTensor
|
||||
(
|
||||
const tensorField& st,
|
||||
const labelList& cellMap
|
||||
) const;
|
||||
|
||||
//- Transform vectorField using transformation tensorField and return
|
||||
// symmetric tensorField
|
||||
virtual tmp<symmTensorField> transformVector
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,7 +33,7 @@ namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(coordinateRotation, 0);
|
||||
defineRunTimeSelectionTable(coordinateRotation, dictionary);
|
||||
defineRunTimeSelectionTable(coordinateRotation, objectRegistry);
|
||||
defineRunTimeSelectionTable(coordinateRotation, points);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,20 +85,6 @@ public:
|
||||
TypeName("coordinateRotation");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
// for constructors with dictionary and objectRegistry
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
coordinateRotation,
|
||||
objectRegistry,
|
||||
(
|
||||
const dictionary& dict, const objectRegistry& obr
|
||||
),
|
||||
(dict, obr)
|
||||
);
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
// for constructors with dictionary
|
||||
declareRunTimeSelectionTable
|
||||
@ -112,13 +98,32 @@ public:
|
||||
(dict)
|
||||
);
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
// for constructors with dictionary and list of points
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
coordinateRotation,
|
||||
points,
|
||||
(
|
||||
const dictionary& dict, const UList<vector>& points
|
||||
),
|
||||
(dict, points)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<coordinateRotation> clone() const = 0;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select constructed from dictionary and objectRegistry
|
||||
//- Select constructed from dictionary and list of points
|
||||
static autoPtr<coordinateRotation> New
|
||||
(
|
||||
const dictionary& dict, const objectRegistry& obr
|
||||
const dictionary& dict, const UList<vector>& points
|
||||
);
|
||||
|
||||
//- Select constructed from dictionary
|
||||
@ -135,22 +140,12 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Reset rotation to an identity rotation
|
||||
virtual void clear() = 0;
|
||||
|
||||
//- Update the rotation for a list of cells
|
||||
virtual void updateCells
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& cells
|
||||
) = 0;
|
||||
//- Update the rotation for a list of points
|
||||
virtual void updatePoints(const UList<vector>& points) = 0;
|
||||
|
||||
//- Return local-to-global transformation tensor
|
||||
virtual const tensor& R() const = 0;
|
||||
|
||||
//- Return global-to-local transformation tensor
|
||||
virtual const tensor& Rtr() const = 0;
|
||||
|
||||
//- Return local Cartesian x-axis
|
||||
virtual const vector e1() const = 0;
|
||||
|
||||
@ -160,9 +155,6 @@ public:
|
||||
//- Return local Cartesian z-axis
|
||||
virtual const vector e3() const = 0;
|
||||
|
||||
//- Return local-to-global transformation tensor
|
||||
virtual const tensorField& Tr() const = 0;
|
||||
|
||||
//- Return true if the rotation tensor is uniform
|
||||
virtual bool uniform() const
|
||||
{
|
||||
@ -187,13 +179,6 @@ public:
|
||||
const tensorField& st
|
||||
) const = 0;
|
||||
|
||||
//- Transform tensor sub-field using transformation tensorField
|
||||
virtual tmp<tensorField> transformTensor
|
||||
(
|
||||
const tensorField& st,
|
||||
const labelList& cellMap
|
||||
) const = 0;
|
||||
|
||||
//- Transform tensor using transformation tensorField
|
||||
virtual tensor transformTensor(const tensor& st) const = 0;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,39 +28,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
|
||||
(
|
||||
const dictionary& dict, const objectRegistry& obr
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "coordinateRotation::New(const dictionary&) : "
|
||||
<< "constructing coordinateRotation"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
word rotType = dict.lookup("type");
|
||||
|
||||
objectRegistryConstructorTable::iterator cstrIter =
|
||||
objectRegistryConstructorTablePtr_->find(rotType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
dict
|
||||
) << "Unknown coordinateRotation type "
|
||||
<< rotType << nl << nl
|
||||
<< "Valid coordinateRotation types are :" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<coordinateRotation>(cstrIter()(dict, obr));
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
|
||||
(
|
||||
const dictionary& dict
|
||||
@ -93,4 +60,40 @@ Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
|
||||
return autoPtr<coordinateRotation>(cstrIter()(dict));
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const UList<vector>& points
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "coordinateRotation::New"
|
||||
"(const dictionary&,const UList<vector>&) : "
|
||||
<< "constructing coordinateRotation"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
word rotType = dict.lookup("type");
|
||||
|
||||
pointsConstructorTable::iterator cstrIter =
|
||||
pointsConstructorTablePtr_->find(rotType);
|
||||
|
||||
if (cstrIter == pointsConstructorTablePtr_->end())
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
dict
|
||||
) << "Unknown coordinateRotation type "
|
||||
<< rotType << nl << nl
|
||||
<< "Valid coordinateRotation types are :" << nl
|
||||
<< pointsConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<coordinateRotation>(cstrIter()(dict, points));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,27 +25,16 @@ License
|
||||
|
||||
#include "cylindrical.H"
|
||||
#include "axesRotation.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "polyMesh.H"
|
||||
#include "tensorIOField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cylindrical, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
cylindrical,
|
||||
dictionary
|
||||
);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
coordinateRotation,
|
||||
cylindrical,
|
||||
objectRegistry
|
||||
);
|
||||
addToRunTimeSelectionTable(coordinateRotation, cylindrical, dictionary);
|
||||
addToRunTimeSelectionTable(coordinateRotation, cylindrical, points);
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +47,7 @@ Foam::tensor Foam::cylindrical::R(const vector& dir) const
|
||||
|
||||
if (mag(r) < small)
|
||||
{
|
||||
// If the cell centre 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();
|
||||
}
|
||||
else
|
||||
@ -68,35 +57,17 @@ Foam::tensor Foam::cylindrical::R(const vector& dir) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::cylindrical::init
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const List<label>& cells
|
||||
)
|
||||
void Foam::cylindrical::init(const UList<vector>& points)
|
||||
{
|
||||
const polyMesh& mesh = refCast<const polyMesh>(obr);
|
||||
|
||||
Rptr_.reset(new tensorField(cells.size()));
|
||||
|
||||
updateCells(mesh, cells);
|
||||
}
|
||||
|
||||
|
||||
void Foam::cylindrical::init(const objectRegistry& obr)
|
||||
{
|
||||
const polyMesh& mesh = refCast<const polyMesh>(obr);
|
||||
|
||||
Rptr_.reset(new tensorField(mesh.nCells()));
|
||||
|
||||
const vectorField& cc = mesh.cellCentres();
|
||||
|
||||
Rptr_.reset(new tensorField(points.size()));
|
||||
tensorField& R = Rptr_();
|
||||
forAll(cc, celli)
|
||||
|
||||
forAll(points, i)
|
||||
{
|
||||
vector dir = cc[celli] - origin_;
|
||||
vector dir = points[i] - origin_;
|
||||
dir /= mag(dir) + vSmall;
|
||||
|
||||
R[celli] = this->R(dir);
|
||||
R[i] = this->R(dir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,55 +76,16 @@ void Foam::cylindrical::init(const objectRegistry& obr)
|
||||
|
||||
Foam::cylindrical::cylindrical
|
||||
(
|
||||
const dictionary& dict,
|
||||
const objectRegistry& obr
|
||||
)
|
||||
:
|
||||
Rptr_(),
|
||||
origin_(point::zero),
|
||||
e3_(Zero)
|
||||
{
|
||||
// If origin is specified in the coordinateSystem
|
||||
if (dict.parent().found("origin"))
|
||||
{
|
||||
dict.parent().lookup("origin") >> origin_;
|
||||
}
|
||||
|
||||
// rotation axis
|
||||
dict.lookup("e3") >> e3_;
|
||||
|
||||
init(obr);
|
||||
}
|
||||
|
||||
|
||||
Foam::cylindrical::cylindrical
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const vector& axis,
|
||||
const point& origin
|
||||
)
|
||||
:
|
||||
Rptr_(),
|
||||
origin_(origin),
|
||||
e3_(axis)
|
||||
{
|
||||
init(obr);
|
||||
}
|
||||
|
||||
|
||||
Foam::cylindrical::cylindrical
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const vector& axis,
|
||||
const point& origin,
|
||||
const List<label>& cells
|
||||
const UList<vector>& points
|
||||
)
|
||||
:
|
||||
Rptr_(),
|
||||
origin_(origin),
|
||||
e3_(axis)
|
||||
{
|
||||
init(obr, cells);
|
||||
init(points);
|
||||
}
|
||||
|
||||
|
||||
@ -163,50 +95,47 @@ Foam::cylindrical::cylindrical(const dictionary& dict)
|
||||
origin_(),
|
||||
e3_()
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " cylindrical can not be constructed from dictionary "
|
||||
<< " use the constructor : "
|
||||
"("
|
||||
" const dictionary&, const objectRegistry&"
|
||||
")"
|
||||
<< exit(FatalIOError);
|
||||
// If origin is specified in the coordinateSystem
|
||||
if (dict.parent().found("origin"))
|
||||
{
|
||||
dict.parent().lookup("origin") >> origin_;
|
||||
}
|
||||
|
||||
// Rotation axis
|
||||
dict.lookup("e3") >> e3_;
|
||||
}
|
||||
|
||||
|
||||
Foam::cylindrical::cylindrical(const tensorField& R)
|
||||
Foam::cylindrical::cylindrical
|
||||
(
|
||||
const dictionary& dict,
|
||||
const UList<vector>& points
|
||||
)
|
||||
:
|
||||
Rptr_(),
|
||||
origin_(Zero),
|
||||
e3_(Zero)
|
||||
cylindrical(dict)
|
||||
{
|
||||
Rptr_() = R;
|
||||
init(points);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cylindrical::clear()
|
||||
void Foam::cylindrical::updatePoints(const UList<vector>& points)
|
||||
{
|
||||
if (!Rptr_.empty())
|
||||
if (Rptr_.valid())
|
||||
{
|
||||
Rptr_.clear();
|
||||
Rptr_().setSize(points.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
Rptr_.reset(new tensorField(points.size()));
|
||||
}
|
||||
|
||||
|
||||
void Foam::cylindrical::updateCells
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& cells
|
||||
)
|
||||
{
|
||||
const vectorField& cc = mesh.cellCentres();
|
||||
tensorField& R = Rptr_();
|
||||
|
||||
forAll(cells, i)
|
||||
forAll(points, i)
|
||||
{
|
||||
label celli = cells[i];
|
||||
vector dir = cc[celli] - origin_;
|
||||
vector dir = points[i] - origin_;
|
||||
dir /= mag(dir) + vSmall;
|
||||
|
||||
R[i] = this->R(dir);
|
||||
@ -252,6 +181,13 @@ Foam::tmp<Foam::vectorField> Foam::cylindrical::invTransform
|
||||
const vectorField& vf
|
||||
) const
|
||||
{
|
||||
if (Rptr_->size() != vf.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "vectorField st has different size to tensorField "
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return (Rptr_().T() & vf);
|
||||
}
|
||||
|
||||
@ -294,37 +230,10 @@ Foam::tensor Foam::cylindrical::transformTensor
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return Zero;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::tensorField> Foam::cylindrical::transformTensor
|
||||
(
|
||||
const tensorField& tf,
|
||||
const labelList& cellMap
|
||||
) const
|
||||
{
|
||||
if (cellMap.size() != tf.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "tensorField tf has different size to tensorField Tr"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const tensorField& R = Rptr_();
|
||||
const tensorField Rtr(R.T());
|
||||
tmp<tensorField> tt(new tensorField(cellMap.size()));
|
||||
tensorField& t = tt.ref();
|
||||
forAll(cellMap, i)
|
||||
{
|
||||
t[i] = R[i] & tf[i] & Rtr[i];
|
||||
}
|
||||
|
||||
return tt;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::symmTensorField> Foam::cylindrical::transformVector
|
||||
(
|
||||
const vectorField& vf
|
||||
|
||||
@ -27,10 +27,10 @@ Class
|
||||
Description
|
||||
A local coordinate rotation.
|
||||
|
||||
The cell based 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)
|
||||
where <tt>dir = cellC - origin</tt> and \c e3 is the rotation axis.
|
||||
Per each cell an axesRotation type of rotation is created
|
||||
where <tt>dir = point - origin</tt> and \c e3 is the rotation axis.
|
||||
Per each point an axesRotation type of rotation is created
|
||||
(cylindrical coordinates). For example:
|
||||
\verbatim
|
||||
cylindrical
|
||||
@ -85,15 +85,8 @@ class cylindrical
|
||||
// corresponding to the given vector
|
||||
tensor R(const vector& dir) const;
|
||||
|
||||
//- Initialise transformation tensor field for cell set
|
||||
void init
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const List<label>& cells
|
||||
);
|
||||
|
||||
//- Initialise transformation tensor field for all cells
|
||||
void init(const objectRegistry& obr);
|
||||
//- Initialise transformation tensor field for given points
|
||||
void init(const UList<vector>& points);
|
||||
|
||||
|
||||
public:
|
||||
@ -103,36 +96,24 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and objectRegistry
|
||||
cylindrical(const dictionary&, const objectRegistry&);
|
||||
|
||||
//- Construct from components for all cells
|
||||
//- Construct from components for list of points
|
||||
cylindrical
|
||||
(
|
||||
const objectRegistry&,
|
||||
const vector& axis,
|
||||
const point& origin
|
||||
);
|
||||
|
||||
//- Construct from components for list of cells
|
||||
cylindrical
|
||||
(
|
||||
const objectRegistry&,
|
||||
const vector& axis,
|
||||
const point& origin,
|
||||
const List<label>& cells
|
||||
const UList<vector>& points
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
cylindrical(const dictionary&);
|
||||
|
||||
//- Construct from tensor Field
|
||||
cylindrical(const tensorField&);
|
||||
//- Construct from dictionary
|
||||
cylindrical(const dictionary&, const UList<vector>& points);
|
||||
|
||||
//- Return clone
|
||||
autoPtr<cylindrical> clone() const
|
||||
virtual autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return autoPtr<cylindrical>(new cylindrical(*this));
|
||||
return autoPtr<coordinateRotation>(new cylindrical(*this));
|
||||
}
|
||||
|
||||
|
||||
@ -143,11 +124,8 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Reset rotation to an identity rotation
|
||||
virtual void clear();
|
||||
|
||||
//- Update the rotation for a list of cells
|
||||
virtual void updateCells(const polyMesh& mesh, const labelList& cells);
|
||||
//- Update the rotation for a list of points
|
||||
virtual void updatePoints(const UList<vector>& points);
|
||||
|
||||
//- Return local-to-global transformation tensor
|
||||
virtual const tensor& R() const
|
||||
@ -156,13 +134,6 @@ public:
|
||||
return tensor::zero;
|
||||
}
|
||||
|
||||
//- Return global-to-local transformation tensor
|
||||
virtual const tensor& Rtr() const
|
||||
{
|
||||
NotImplemented;
|
||||
return tensor::zero;
|
||||
}
|
||||
|
||||
//- Return local Cartesian x-axis in global coordinates
|
||||
virtual const vector e1() const
|
||||
{
|
||||
@ -183,11 +154,6 @@ public:
|
||||
return e3_;
|
||||
}
|
||||
|
||||
virtual const tensorField& Tr() const
|
||||
{
|
||||
return Rptr_();
|
||||
}
|
||||
|
||||
//- Transform vectorField using transformation tensor field
|
||||
virtual tmp<vectorField> transform(const vectorField& tf) const;
|
||||
|
||||
@ -218,13 +184,6 @@ public:
|
||||
//- Transform tensor using transformation tensorField
|
||||
virtual tensor transformTensor(const tensor& t) const;
|
||||
|
||||
//- Transform tensor sub-field using transformation tensorField
|
||||
virtual tmp<tensorField> transformTensor
|
||||
(
|
||||
const tensorField& tf,
|
||||
const labelList& cellMap
|
||||
) const;
|
||||
|
||||
//- Transform vectorField using transformation tensorField and return
|
||||
// symmetrical tensorField
|
||||
virtual tmp<symmTensorField> transformVector
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,10 +23,9 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "IOstream.H"
|
||||
#include "axesRotation.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "coordinateSystems.H"
|
||||
#include "axesRotation.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -39,25 +38,15 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coordinateSystem::coordinateSystem()
|
||||
:
|
||||
name_(),
|
||||
note_(),
|
||||
origin_(point::zero),
|
||||
R_(new axesRotation(sphericalTensor::I))
|
||||
{}
|
||||
|
||||
|
||||
Foam::coordinateSystem::coordinateSystem
|
||||
(
|
||||
const word& name,
|
||||
const coordinateSystem& cs
|
||||
const point& origin
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
note_(),
|
||||
origin_(cs.origin_),
|
||||
R_(const_cast<coordinateRotation*>(&cs.R()))
|
||||
origin_(origin),
|
||||
R_(new axesRotation(sphericalTensor::I))
|
||||
{}
|
||||
|
||||
|
||||
@ -69,9 +58,8 @@ Foam::coordinateSystem::coordinateSystem
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
note_(),
|
||||
origin_(origin),
|
||||
R_(const_cast<coordinateRotation*>(&cr))
|
||||
R_(cr.clone())
|
||||
{}
|
||||
|
||||
|
||||
@ -84,7 +72,6 @@ Foam::coordinateSystem::coordinateSystem
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
note_(),
|
||||
origin_(origin),
|
||||
R_(new axesRotation(axis, dirn))
|
||||
{}
|
||||
@ -97,83 +84,9 @@ Foam::coordinateSystem::coordinateSystem
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
note_(),
|
||||
origin_(point::zero),
|
||||
R_()
|
||||
{
|
||||
init(dict);
|
||||
}
|
||||
|
||||
|
||||
Foam::coordinateSystem::coordinateSystem(const dictionary& dict)
|
||||
:
|
||||
name_(),
|
||||
note_(),
|
||||
origin_(point::zero),
|
||||
R_()
|
||||
{
|
||||
init(dict);
|
||||
}
|
||||
|
||||
|
||||
Foam::coordinateSystem::coordinateSystem
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(),
|
||||
note_(),
|
||||
origin_(point::zero),
|
||||
R_()
|
||||
{
|
||||
const entry* entryPtr = dict.lookupEntryPtr(typeName_(), false, false);
|
||||
|
||||
// non-dictionary entry is a lookup into global coordinateSystems
|
||||
if (entryPtr && !entryPtr->isDict())
|
||||
{
|
||||
keyType key(entryPtr->stream());
|
||||
|
||||
const coordinateSystems& lst = coordinateSystems::New(obr);
|
||||
const label index = lst.findIndex(key);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Using global coordinate system: "
|
||||
<< key << "=" << index << endl;
|
||||
}
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "could not find coordinate system: " << key << nl
|
||||
<< "available coordinate systems: " << lst.toc() << nl << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// copy coordinateSystem, but assign the name as the typeName
|
||||
// to avoid strange things in writeDict()
|
||||
operator=(lst[index]);
|
||||
name_ = typeName_();
|
||||
}
|
||||
else
|
||||
{
|
||||
init(dict, obr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::coordinateSystem::coordinateSystem(Istream& is)
|
||||
:
|
||||
name_(is),
|
||||
note_(),
|
||||
origin_(point::zero),
|
||||
R_()
|
||||
{
|
||||
dictionary dict(is);
|
||||
init(dict);
|
||||
}
|
||||
origin_(dict.lookup("origin")),
|
||||
R_(coordinateRotation::New(dict.subDict("coordinateRotation")).ptr())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
@ -184,32 +97,6 @@ Foam::coordinateSystem::~coordinateSystem()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dictionary Foam::coordinateSystem::dict(bool ignoreType) const
|
||||
{
|
||||
dictionary dict;
|
||||
|
||||
dict.add("name", name_);
|
||||
|
||||
// only write type for derived types
|
||||
if (!ignoreType && type() != typeName_())
|
||||
{
|
||||
dict.add("type", type());
|
||||
}
|
||||
|
||||
// The note entry is optional
|
||||
if (note_.size())
|
||||
{
|
||||
dict.add("note", note_);
|
||||
}
|
||||
|
||||
dict.add("origin", origin_);
|
||||
dict.add("e1", R_->e1());
|
||||
dict.add("e3", R_->e3());
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::coordinateSystem::localToGlobal
|
||||
(
|
||||
const vector& local,
|
||||
@ -278,14 +165,6 @@ Foam::tmp<Foam::vectorField> Foam::coordinateSystem::globalToLocal
|
||||
}
|
||||
|
||||
|
||||
void Foam::coordinateSystem::clear()
|
||||
{
|
||||
note_.clear();
|
||||
origin_ = Zero;
|
||||
R_->clear();
|
||||
}
|
||||
|
||||
|
||||
void Foam::coordinateSystem::write(Ostream& os) const
|
||||
{
|
||||
os << type() << " origin: " << origin() << nl;
|
||||
@ -304,12 +183,6 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
|
||||
writeEntry(os, "type", type());
|
||||
|
||||
|
||||
// The note entry is optional
|
||||
if (note_.size())
|
||||
{
|
||||
writeEntry(os, "note", note_);
|
||||
}
|
||||
|
||||
writeEntry(os, "origin", origin_);
|
||||
R_->write(os);
|
||||
|
||||
@ -320,59 +193,6 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::coordinateSystem::init(const dictionary& rhs)
|
||||
{
|
||||
rhs.lookup("origin") >> origin_;
|
||||
note_.clear();
|
||||
rhs.readIfPresent("note", note_);
|
||||
R_.reset(coordinateRotation::New(rhs.subDict("coordinateRotation")).ptr());
|
||||
}
|
||||
|
||||
|
||||
void Foam::coordinateSystem::init
|
||||
(
|
||||
const dictionary& rhs,
|
||||
const objectRegistry& obr
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "coordinateSystem::operator="
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"const objectRegistry&"
|
||||
") : "
|
||||
<< "assign from " << rhs << endl;
|
||||
}
|
||||
|
||||
rhs.lookup("origin") >> origin_;
|
||||
|
||||
// The note entry is optional
|
||||
note_.clear();
|
||||
rhs.readIfPresent("note", note_);
|
||||
|
||||
R_.reset
|
||||
(
|
||||
coordinateRotation::New(rhs.subDict("coordinateRotation"), obr).ptr()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::operator!=(const coordinateSystem& a, const coordinateSystem& b)
|
||||
{
|
||||
return
|
||||
(
|
||||
a.origin() != b.origin()
|
||||
|| a.R().R() != b.R().R()
|
||||
|| a.type() != b.type()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const coordinateSystem& cs)
|
||||
|
||||
@ -61,15 +61,9 @@ SourceFiles
|
||||
#ifndef coordinateSystem_H
|
||||
#define coordinateSystem_H
|
||||
|
||||
#include "vector.H"
|
||||
#include "point.H"
|
||||
#include "tensor.H"
|
||||
#include "vectorField.H"
|
||||
#include "pointField.H"
|
||||
#include "tmp.H"
|
||||
#include "coordinateRotation.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -95,14 +89,11 @@ class coordinateSystem
|
||||
//- Name of coordinate system
|
||||
word name_;
|
||||
|
||||
//- Optional note
|
||||
string note_;
|
||||
|
||||
//- Origin
|
||||
point origin_;
|
||||
|
||||
//- Local-to-Global transformation tensor
|
||||
autoPtr<coordinateRotation> R_;
|
||||
mutable autoPtr<coordinateRotation> R_;
|
||||
|
||||
|
||||
protected:
|
||||
@ -133,12 +124,6 @@ protected:
|
||||
bool translate
|
||||
) const;
|
||||
|
||||
//- Init from dict and obr
|
||||
void init(const dictionary&);
|
||||
|
||||
//- Init from dictionary
|
||||
void init(const dictionary&, const objectRegistry&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -148,14 +133,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null. This is equivalent to an identity coordinateSystem
|
||||
coordinateSystem();
|
||||
|
||||
//- Construct copy with a different name
|
||||
//- Construct from origin
|
||||
coordinateSystem
|
||||
(
|
||||
const word& name,
|
||||
const coordinateSystem&
|
||||
const point& origin
|
||||
);
|
||||
|
||||
//- Construct from origin and rotation
|
||||
@ -178,17 +160,6 @@ public:
|
||||
//- Construct from dictionary with a given name
|
||||
coordinateSystem(const word& name, const dictionary&);
|
||||
|
||||
//- Construct from dictionary with default name
|
||||
coordinateSystem(const dictionary&);
|
||||
|
||||
//- Construct from dictionary (default name)
|
||||
// With the ability to reference global coordinateSystems
|
||||
coordinateSystem(const objectRegistry&, const dictionary&);
|
||||
|
||||
//- Construct from Istream
|
||||
// The Istream contains a word followed by a dictionary
|
||||
coordinateSystem(Istream&);
|
||||
|
||||
|
||||
//- Return clone
|
||||
autoPtr<coordinateSystem> clone() const
|
||||
@ -204,10 +175,10 @@ public:
|
||||
coordinateSystem,
|
||||
dictionary,
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
),
|
||||
(obr, dict)
|
||||
(name, dict)
|
||||
);
|
||||
|
||||
|
||||
@ -220,9 +191,10 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Select constructed from dictionary
|
||||
//- Select constructed from name and dictionary
|
||||
static autoPtr<coordinateSystem> New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
@ -244,18 +216,6 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return non-constant access to the optional note
|
||||
string& note()
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
|
||||
//- Return the optional note
|
||||
const string& note() const
|
||||
{
|
||||
return note_;
|
||||
}
|
||||
|
||||
//- Return origin
|
||||
const point& origin() const
|
||||
{
|
||||
@ -268,47 +228,13 @@ public:
|
||||
return R_();
|
||||
}
|
||||
|
||||
//- Return non const reference to co-ordinate rotation
|
||||
coordinateRotation& R()
|
||||
//- Update and return the co-ordinate rotation for a list of points
|
||||
const coordinateRotation& R(const UList<vector>& points) const
|
||||
{
|
||||
R_->updatePoints(points);
|
||||
return R_();
|
||||
}
|
||||
|
||||
//- Update and return the co-ordinate rotation for a list of cells
|
||||
const coordinateRotation& R
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& cells
|
||||
)
|
||||
{
|
||||
R_->updateCells(mesh, cells);
|
||||
return R_();
|
||||
}
|
||||
|
||||
//- Return as dictionary of entries
|
||||
// \param[in] ignoreType drop type (cartesian, cylindrical, etc)
|
||||
// when generating the dictionary
|
||||
virtual dictionary dict(bool ignoreType=false) const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Rename
|
||||
void rename(const word& newName)
|
||||
{
|
||||
name_ = newName;
|
||||
}
|
||||
|
||||
//- Edit access to origin
|
||||
point& origin()
|
||||
{
|
||||
return origin_;
|
||||
}
|
||||
|
||||
//- Reset origin and rotation to an identity coordinateSystem
|
||||
// Also resets the note
|
||||
virtual void clear();
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
@ -378,17 +304,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
// friend Operators
|
||||
|
||||
friend bool operator!=
|
||||
(
|
||||
const coordinateSystem&,
|
||||
const coordinateSystem&
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const coordinateSystem&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,8 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coordinateSystem.H"
|
||||
#include "dictionary.H"
|
||||
#include "coordinateSystems.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,7 +34,37 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
|
||||
)
|
||||
{
|
||||
const dictionary& coordDict = dict.subDict(typeName_());
|
||||
word coordType = coordDict.lookup("type");
|
||||
|
||||
const entry* entryPtr = coordDict.lookupEntryPtr(typeName_(), false, false);
|
||||
|
||||
// non-dictionary entry is a lookup into global coordinateSystems
|
||||
if (entryPtr && !entryPtr->isDict())
|
||||
{
|
||||
keyType key(entryPtr->stream());
|
||||
|
||||
const coordinateSystems& lst = coordinateSystems::New(obr);
|
||||
const label index = lst.findIndex(key);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Using global coordinate system: "
|
||||
<< key << "=" << index << endl;
|
||||
}
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "could not find coordinate system: " << key << nl
|
||||
<< "available coordinate systems: " << lst.toc() << nl << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return lst[index].clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
const word coordType = coordDict.lookup("type");
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(coordType);
|
||||
@ -52,18 +81,35 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<coordinateSystem>(cstrIter()(obr, coordDict));
|
||||
return autoPtr<coordinateSystem>(cstrIter()(coordType, coordDict));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
const dictionary& coordDict = dict.subDict(typeName_());
|
||||
const word coordType = dict.lookup("type");
|
||||
|
||||
return autoPtr<coordinateSystem>(new coordinateSystem(coordDict));
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(coordType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
dict
|
||||
) << "Unknown coordinateSystem type "
|
||||
<< coordType << nl << nl
|
||||
<< "Valid coordinateSystem types are :" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<coordinateSystem>(cstrIter()(name, dict));
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +121,7 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
|
||||
const word name(is);
|
||||
const dictionary dict(is);
|
||||
|
||||
return autoPtr<coordinateSystem>(new coordinateSystem(name, dict));
|
||||
return autoPtr<coordinateSystem>(coordinateSystem::New(name, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,9 +24,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coordinateSystems.H"
|
||||
#include "IOPtrList.H"
|
||||
#include "Time.H"
|
||||
#include "stringListOps.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,29 +43,8 @@ Foam::coordinateSystems::coordinateSystems(const IOobject& io)
|
||||
{}
|
||||
|
||||
|
||||
Foam::coordinateSystems::coordinateSystems
|
||||
(
|
||||
const IOobject& io,
|
||||
const PtrList<coordinateSystem>& lst
|
||||
)
|
||||
:
|
||||
IOPtrList<coordinateSystem>(io, lst)
|
||||
{}
|
||||
|
||||
|
||||
Foam::coordinateSystems::coordinateSystems
|
||||
(
|
||||
const IOobject& io,
|
||||
PtrList<coordinateSystem>&& lst
|
||||
)
|
||||
:
|
||||
IOPtrList<coordinateSystem>(io, move(lst))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Read construct from registry, or return previously registered
|
||||
const Foam::coordinateSystems& Foam::coordinateSystems::New
|
||||
(
|
||||
const objectRegistry& obr
|
||||
@ -127,8 +105,9 @@ Foam::label Foam::coordinateSystems::findIndex(const keyType& key) const
|
||||
{
|
||||
if (key.isPattern())
|
||||
{
|
||||
labelList indices = findIndices(key);
|
||||
// return first element
|
||||
const labelList indices = findIndices(key);
|
||||
|
||||
// Return first element
|
||||
if (!indices.empty())
|
||||
{
|
||||
return indices[0];
|
||||
|
||||
@ -73,6 +73,12 @@ class coordinateSystems
|
||||
:
|
||||
public IOPtrList<coordinateSystem>
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
//- Find and return indices for all matches
|
||||
labelList findIndices(const keyType& key) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -83,20 +89,6 @@ public:
|
||||
//- Read construct from IOobject
|
||||
explicit coordinateSystems(const IOobject&);
|
||||
|
||||
//- Construct from IOobject and a PtrList
|
||||
coordinateSystems
|
||||
(
|
||||
const IOobject&,
|
||||
const PtrList<coordinateSystem>&
|
||||
);
|
||||
|
||||
//- Construct from IOobject and transferring the PtrList contents
|
||||
coordinateSystems
|
||||
(
|
||||
const IOobject&,
|
||||
PtrList<coordinateSystem>&&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
coordinateSystems(const coordinateSystems&) = delete;
|
||||
|
||||
@ -109,9 +101,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Find and return indices for all matches
|
||||
labelList findIndices(const keyType& key) const;
|
||||
|
||||
//- Find and return index for the first match, return -1 if not found
|
||||
label findIndex(const keyType& key) const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,107 +29,16 @@ License
|
||||
#include "mathematicalConstants.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS(const bool inDegrees)
|
||||
:
|
||||
coordinateSystem(),
|
||||
inDegrees_(inDegrees)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const coordinateSystem& cs,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
coordinateSystem(cs),
|
||||
inDegrees_(inDegrees)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const coordinateSystem& cs,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, cs),
|
||||
inDegrees_(inDegrees)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const coordinateRotation& cr,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, cr),
|
||||
inDegrees_(inDegrees)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const vector& axis,
|
||||
const vector& dirn,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, axis, dirn),
|
||||
inDegrees_(inDegrees)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, dict),
|
||||
inDegrees_(dict.lookupOrDefault("degrees", true))
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coordinateSystem(obr, dict),
|
||||
inDegrees_(dict.lookupOrDefault("degrees", true))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cylindricalCS::~cylindricalCS()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::cylindricalCS::inDegrees() const
|
||||
namespace Foam
|
||||
{
|
||||
return inDegrees_;
|
||||
defineTypeNameAndDebug(cylindricalCS, 0);
|
||||
addToRunTimeSelectionTable(coordinateSystem, cylindricalCS, dictionary);
|
||||
}
|
||||
|
||||
|
||||
bool& Foam::cylindricalCS::inDegrees()
|
||||
{
|
||||
return inDegrees_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::cylindricalCS::localToGlobal
|
||||
(
|
||||
@ -162,7 +71,6 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::localToGlobal
|
||||
*(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0)
|
||||
);
|
||||
|
||||
|
||||
vectorField lc(local.size());
|
||||
lc.replace(vector::X, local.component(vector::X)*cos(theta));
|
||||
lc.replace(vector::Y, local.component(vector::X)*sin(theta));
|
||||
@ -232,4 +140,50 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::globalToLocal
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const coordinateRotation& cr,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, cr),
|
||||
inDegrees_(inDegrees)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
const vector& axis,
|
||||
const vector& dirn,
|
||||
const bool inDegrees
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, origin, axis, dirn),
|
||||
inDegrees_(inDegrees)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coordinateSystem(name, dict),
|
||||
inDegrees_(dict.lookupOrDefault("degrees", true))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cylindricalCS::~cylindricalCS()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,9 +56,7 @@ class cylindricalCS
|
||||
bool inDegrees_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
//- Convert from local coordinate system to the global Cartesian system
|
||||
@ -88,27 +86,12 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cylindrical");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
cylindricalCS(const bool inDegrees=true);
|
||||
|
||||
//- Construct copy
|
||||
cylindricalCS
|
||||
(
|
||||
const coordinateSystem&,
|
||||
const bool inDegrees=true
|
||||
);
|
||||
|
||||
//- Construct copy with a different name
|
||||
cylindricalCS
|
||||
(
|
||||
const word& name,
|
||||
const coordinateSystem&,
|
||||
const bool inDegrees=true
|
||||
);
|
||||
|
||||
//- Construct from origin and rotation
|
||||
cylindricalCS
|
||||
(
|
||||
@ -131,21 +114,9 @@ public:
|
||||
//- Construct from dictionary and name
|
||||
cylindricalCS(const word&, const dictionary&);
|
||||
|
||||
//- Construct from dictionary and objectRegistry
|
||||
cylindricalCS(const objectRegistry&, const dictionary&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cylindricalCS();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Are angles in degrees?
|
||||
bool inDegrees() const;
|
||||
|
||||
//- Non-const access to inDegrees
|
||||
bool& inDegrees();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -203,6 +203,7 @@ Foam::searchableSurfaceCollection::searchableSurfaceCollection
|
||||
surfI,
|
||||
coordinateSystem::New
|
||||
(
|
||||
io.db(),
|
||||
subDict.subDict("transform")
|
||||
)
|
||||
);
|
||||
|
||||
@ -57,10 +57,13 @@ Foam::sampledSurfaces::plane::plane
|
||||
// allow lookup from global coordinate systems
|
||||
if (dict.found("coordinateSystem"))
|
||||
{
|
||||
coordinateSystem cs(mesh, dict.subDict("coordinateSystem"));
|
||||
autoPtr<coordinateSystem> cs
|
||||
(
|
||||
coordinateSystem::New(mesh, dict.subDict("coordinateSystem"))
|
||||
);
|
||||
|
||||
point base = cs.globalPosition(planeDesc().refPoint());
|
||||
vector norm = cs.globalVector(planeDesc().normal());
|
||||
point base = cs->globalPosition(planeDesc().refPoint());
|
||||
vector norm = cs->globalVector(planeDesc().normal());
|
||||
|
||||
// Assign the plane description
|
||||
static_cast<Foam::plane&>(*this) = Foam::plane(base, norm);
|
||||
|
||||
@ -294,12 +294,14 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::KappaLocal() const
|
||||
);
|
||||
volSymmTensorField& KappaLocal = tKappaLocal.ref();
|
||||
|
||||
KappaLocal.primitiveFieldRef() = coordinates.R().transformVector(Kappa);
|
||||
KappaLocal.primitiveFieldRef() =
|
||||
coordinates.R(mesh.C()).transformVector(Kappa);
|
||||
|
||||
forAll(KappaLocal.boundaryField(), patchi)
|
||||
{
|
||||
KappaLocal.boundaryFieldRef()[patchi] =
|
||||
coordinates.R().transformVector(Kappa.boundaryField()[patchi]);
|
||||
coordinates.R(mesh.boundary()[patchi].Cf())
|
||||
.transformVector(Kappa.boundaryField()[patchi]);
|
||||
}
|
||||
|
||||
return tKappaLocal;
|
||||
@ -320,7 +322,9 @@ Foam::heSolidThermo<BasicSolidThermo, MixtureType>::KappaLocal
|
||||
coordinateSystem::New(mesh, this->properties())
|
||||
);
|
||||
|
||||
return coordinates.R().transformVector(Kappa(patchi));
|
||||
return
|
||||
coordinates.R(mesh.boundary()[patchi].Cf())
|
||||
.transformVector(Kappa(patchi));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -285,7 +285,7 @@ Foam::mixerFvMesh::mixerFvMesh
|
||||
(
|
||||
coordinateSystem::New
|
||||
(
|
||||
"coordinateSystem",
|
||||
io.db(),
|
||||
motionDict_.subDict("coordinateSystem")
|
||||
)
|
||||
),
|
||||
|
||||
@ -36,7 +36,7 @@ SourceFiles
|
||||
#define mixerFvMesh_H
|
||||
|
||||
#include "topoChangerFvMesh.H"
|
||||
#include "cylindricalCS.H"
|
||||
#include "coordinateSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user