mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-coordinateSystem' into 'develop'
coordinate system improvements See merge request Development/OpenFOAM-plus!211
This commit is contained in:
@ -31,7 +31,12 @@
|
|||||||
coordinates.set
|
coordinates.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
coordinateSystem::New(solidRegions[i], thermos[i])
|
coordinateSystem::New
|
||||||
|
(
|
||||||
|
solidRegions[i],
|
||||||
|
thermos[i],
|
||||||
|
coordinateSystem::typeName_()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
tmp<volVectorField> tkappaByCp =
|
tmp<volVectorField> tkappaByCp =
|
||||||
@ -57,7 +62,11 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
aniAlphas[i].primitiveFieldRef() =
|
aniAlphas[i].primitiveFieldRef() =
|
||||||
coordinates[i].R().transformVector(tkappaByCp());
|
coordinates[i].transformPrincipal
|
||||||
|
(
|
||||||
|
solidRegions[i].cellCentres(),
|
||||||
|
tkappaByCp()
|
||||||
|
);
|
||||||
aniAlphas[i].correctBoundaryConditions();
|
aniAlphas[i].correctBoundaryConditions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,12 @@ if (!thermo.isotropic())
|
|||||||
const coordinateSystem& coodSys = coordinates[i];
|
const coordinateSystem& coodSys = coordinates[i];
|
||||||
|
|
||||||
aniAlpha.primitiveFieldRef() =
|
aniAlpha.primitiveFieldRef() =
|
||||||
coodSys.R().transformVector(tkappaByCp());
|
coodSys.transformPrincipal
|
||||||
|
(
|
||||||
|
mesh.cellCentres(),
|
||||||
|
tkappaByCp()
|
||||||
|
);
|
||||||
|
|
||||||
aniAlpha.correctBoundaryConditions();
|
aniAlpha.correctBoundaryConditions();
|
||||||
|
|
||||||
taniAlpha = tmp<volSymmTensorField>
|
taniAlpha = tmp<volSymmTensorField>
|
||||||
|
|||||||
@ -30,12 +30,68 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "coordinateSystem.H"
|
#include "Time.H"
|
||||||
|
#include "coordinateSystems.H"
|
||||||
|
#include "identityRotation.H"
|
||||||
|
#include "indirectCS.H"
|
||||||
#include "Fstream.H"
|
#include "Fstream.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
#include "transform.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void testTransform(const coordinateSystem& cs, const point& p, const T& val)
|
||||||
|
{
|
||||||
|
Info<< " " << pTraits<T>::typeName << ": " << val
|
||||||
|
<< " transform: " << cs.transform(p, val)
|
||||||
|
<< " invTransform: " << cs.invTransform(p, val) << nl;
|
||||||
|
|
||||||
|
// Info<< " both: " << cs.invTransform(p, cs.transform(p, val)) << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void basicTests(const coordinateSystem& cs)
|
||||||
|
{
|
||||||
|
cs.writeEntry(cs.name(), Info);
|
||||||
|
|
||||||
|
if (isA<coordSystem::indirect>(cs))
|
||||||
|
{
|
||||||
|
Info<< "indirect from:" << nl;
|
||||||
|
dynamicCast<const coordSystem::indirect>(cs).cs()
|
||||||
|
.writeEntry(cs.name(), Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "rotation: " << cs.R() << nl;
|
||||||
|
|
||||||
|
List<point> testPoints
|
||||||
|
({
|
||||||
|
{1,0,0}, {0,1,0}, {0,0,1}, {1,1,1},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
for (const point& p : testPoints)
|
||||||
|
{
|
||||||
|
Info<< nl
|
||||||
|
<< " test point: " << p
|
||||||
|
<< " = local point " << cs.transformPoint(p)
|
||||||
|
<< " = local coord " << cs.localPosition(p) << nl;
|
||||||
|
|
||||||
|
const vector v1(1, 1, 1);
|
||||||
|
const tensor t1(tensor::I);
|
||||||
|
const tensor t2(1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||||
|
|
||||||
|
testTransform(cs, p, v1);
|
||||||
|
testTransform(cs, p, t1);
|
||||||
|
testTransform(cs, p, t2);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void doTest(const dictionary& dict)
|
void doTest(const dictionary& dict)
|
||||||
{
|
{
|
||||||
Info<< dict.dictName() << dict << nl;
|
Info<< dict.dictName() << dict << nl;
|
||||||
@ -43,18 +99,42 @@ void doTest(const dictionary& dict)
|
|||||||
// Could fail?
|
// Could fail?
|
||||||
const bool throwingIOError = FatalIOError.throwExceptions();
|
const bool throwingIOError = FatalIOError.throwExceptions();
|
||||||
const bool throwingError = FatalError.throwExceptions();
|
const bool throwingError = FatalError.throwExceptions();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
coordinateSystem cs1(dict.dictName(), dict);
|
auto cs1ptr = coordinateSystem::New(dict, "");
|
||||||
|
coordinateSystem& cs1 = *cs1ptr;
|
||||||
|
cs1.rename(dict.dictName());
|
||||||
|
|
||||||
coordinateSystem cs2;
|
basicTests(cs1);
|
||||||
|
}
|
||||||
|
catch (Foam::IOerror& err)
|
||||||
|
{
|
||||||
|
Info<< "Caught FatalIOError " << err << nl << endl;
|
||||||
|
}
|
||||||
|
catch (Foam::error& err)
|
||||||
|
{
|
||||||
|
Info<< "Caught FatalError " << err << nl << endl;
|
||||||
|
}
|
||||||
|
FatalError.throwExceptions(throwingError);
|
||||||
|
FatalIOError.throwExceptions(throwingIOError);
|
||||||
|
}
|
||||||
|
|
||||||
// Move assign
|
|
||||||
cs2 = std::move(cs1);
|
|
||||||
|
|
||||||
// Info<<cs2 << nl;
|
void doTest(const objectRegistry& obr, const dictionary& dict)
|
||||||
cs2.writeDict(Info, true);
|
{
|
||||||
Info<< nl;
|
Info<< dict.dictName() << dict << nl;
|
||||||
|
|
||||||
|
// Could fail?
|
||||||
|
const bool throwingIOError = FatalIOError.throwExceptions();
|
||||||
|
const bool throwingError = FatalError.throwExceptions();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
auto cs1ptr = coordinateSystem::New(obr, dict, word::null);
|
||||||
|
coordinateSystem& cs1 = *cs1ptr;
|
||||||
|
|
||||||
|
basicTests(cs1);
|
||||||
}
|
}
|
||||||
catch (Foam::IOerror& err)
|
catch (Foam::IOerror& err)
|
||||||
{
|
{
|
||||||
@ -78,7 +158,40 @@ int main(int argc, char *argv[])
|
|||||||
argList::addArgument("dict .. dictN");
|
argList::addArgument("dict .. dictN");
|
||||||
argList args(argc, argv, false, true);
|
argList args(argc, argv, false, true);
|
||||||
|
|
||||||
if (args.size() <= 1)
|
if (args.found("case"))
|
||||||
|
{
|
||||||
|
Info<<"using case for tests" << nl;
|
||||||
|
|
||||||
|
#include "createTime.H"
|
||||||
|
|
||||||
|
const coordinateSystems& systems = coordinateSystems::New(runTime);
|
||||||
|
|
||||||
|
Info<< systems.size() << " global systems" << nl;
|
||||||
|
|
||||||
|
for (const coordinateSystem& cs : systems)
|
||||||
|
{
|
||||||
|
basicTests(cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// systems.write();
|
||||||
|
|
||||||
|
for (label argi=1; argi < args.size(); ++argi)
|
||||||
|
{
|
||||||
|
const string& dictFile = args[argi];
|
||||||
|
IFstream is(dictFile);
|
||||||
|
|
||||||
|
dictionary inputDict(is);
|
||||||
|
|
||||||
|
forAllConstIters(inputDict, iter)
|
||||||
|
{
|
||||||
|
if (iter().isDict())
|
||||||
|
{
|
||||||
|
doTest(runTime, iter().dict());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.size() <= 1)
|
||||||
{
|
{
|
||||||
Info<<"no coordinateSystem dictionaries to expand" << nl;
|
Info<<"no coordinateSystem dictionaries to expand" << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class IOPtrList<coordinateSystem>; //<-- Older name
|
||||||
|
object coordinateSystems;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
(
|
||||||
|
cs1
|
||||||
|
{
|
||||||
|
type cartesian;
|
||||||
|
origin (1 2 3);
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type axes;
|
||||||
|
e1 (0 0 1);
|
||||||
|
e2 (0 1 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
application simpleFoam;
|
||||||
|
|
||||||
|
startFrom latestTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 4;
|
||||||
|
|
||||||
|
deltaT 1;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
|
||||||
|
writeInterval 100;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat binary;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression off;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
//OLD class IOPtrList<coordinateSystem>;
|
||||||
|
class coordinateSystems;
|
||||||
|
object coordinateSystems;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
(
|
||||||
|
cs1
|
||||||
|
{
|
||||||
|
type cartesian;
|
||||||
|
origin (1 2 3);
|
||||||
|
rotation
|
||||||
|
{
|
||||||
|
type axes;
|
||||||
|
e1 (0 0 1);
|
||||||
|
e2 (0 1 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cs2
|
||||||
|
{
|
||||||
|
type cartesian;
|
||||||
|
origin (0 3 5);
|
||||||
|
e1 (1 2 0);
|
||||||
|
e2 (2 0 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
cs3
|
||||||
|
{
|
||||||
|
type cartesian;
|
||||||
|
origin (0 3 5);
|
||||||
|
coordinateRotation // older name
|
||||||
|
{
|
||||||
|
type euler;
|
||||||
|
angles (90 0 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cs4
|
||||||
|
{
|
||||||
|
type cylindrical;
|
||||||
|
origin (0 3 5);
|
||||||
|
rotation
|
||||||
|
{
|
||||||
|
type euler;
|
||||||
|
angles (90 0 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cyl
|
||||||
|
{
|
||||||
|
type cylindrical;
|
||||||
|
origin (0 0 0);
|
||||||
|
degrees false;
|
||||||
|
|
||||||
|
rotation
|
||||||
|
{
|
||||||
|
type axisAngle;
|
||||||
|
axis (0 0 1);
|
||||||
|
angle 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ident
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
rotation
|
||||||
|
{
|
||||||
|
type none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
application simpleFoam;
|
||||||
|
|
||||||
|
startFrom latestTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 4;
|
||||||
|
|
||||||
|
deltaT 1;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
|
||||||
|
writeInterval 100;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat binary;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression off;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -10,12 +10,19 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
object testDict;
|
object testCsys1;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Rotate 90 deg around x: y -> z, z -> -y
|
// Rotate 90 deg around x: y -> z, z -> -y
|
||||||
|
|
||||||
|
rot_x90
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
e1 (1 0 0);
|
||||||
|
e3 (0 -1 0);
|
||||||
|
}
|
||||||
|
|
||||||
rot_x90_axesRotation
|
rot_x90_axesRotation
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
@ -27,13 +34,24 @@ rot_x90_axesRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rot_x90_axisAngle
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type axisAngle;
|
||||||
|
axis (1 0 0); // non-unit also OK
|
||||||
|
angle 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rot_x90_euler
|
rot_x90_euler
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type EulerRotation;
|
type euler;
|
||||||
rotation (0 90 0); // z-x'-z''
|
angles (0 90 0); // z-x'-z''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,18 +69,40 @@ rot_z45_axesRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rot_z45_axisAngle
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type axisAngle;
|
||||||
|
axis (0 0 10); // non-unit also OK
|
||||||
|
angle 45;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rot_z45_euler
|
rot_z45_euler
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type EulerRotation;
|
type euler;
|
||||||
rotation (45 0 0); // z-x'-z''
|
angles (45 0 0); // z-x'-z''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rot_z45_starcd
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type starcd;
|
||||||
|
angles (45 0 0); // z-x'-y''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Rotate -45 deg around z: x -> (1 -1 0), y = (1 1 0)
|
// Rotate -45 deg around z: x -> (1 -1 0), y = (1 1 0)
|
||||||
|
|
||||||
rot_zm45_axesRotation
|
rot_zm45_axesRotation
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
@ -74,13 +114,24 @@ rot_zm45_axesRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rot_zm45_axisAngle
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type axisAngle;
|
||||||
|
axis (0 0 10); // non-unit also OK
|
||||||
|
angle -45;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rot_zm45_euler
|
rot_zm45_euler
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type EulerRotation;
|
type euler;
|
||||||
rotation (-45 0 0); // z-x'-z''
|
angles (-45 0 0); // z-x'-z''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,13 +149,35 @@ null_axesRotation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
null_axisAngle0
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type axisAngle;
|
||||||
|
axis (0 0 0); // non-unit also OK
|
||||||
|
angle 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
null_axisAngle1
|
||||||
|
{
|
||||||
|
origin (0 0 0);
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type axisAngle;
|
||||||
|
axis (1 1 1); // non-unit also OK
|
||||||
|
angle 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
null_euler
|
null_euler
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type EulerRotation;
|
type euler;
|
||||||
rotation (0 0 0); // z-x'-z''
|
angles (0 0 0); // z-x'-z''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
59
applications/test/coordinateSystem/testCsys2
Normal file
59
applications/test/coordinateSystem/testCsys2
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v1806 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object testCsys1;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// This dictionary only works in combination with constant/coordinateSystems
|
||||||
|
|
||||||
|
mycs1
|
||||||
|
{
|
||||||
|
type indirect;
|
||||||
|
name cs1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mycs2
|
||||||
|
{
|
||||||
|
type indirect;
|
||||||
|
name cs2;
|
||||||
|
}
|
||||||
|
|
||||||
|
mycs3
|
||||||
|
{
|
||||||
|
type indirect;
|
||||||
|
name cs3;
|
||||||
|
}
|
||||||
|
|
||||||
|
mycyl
|
||||||
|
{
|
||||||
|
type indirect;
|
||||||
|
name cyl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mycy2
|
||||||
|
{
|
||||||
|
coordinateSystem
|
||||||
|
{
|
||||||
|
type indirect;
|
||||||
|
name cyl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mycy3
|
||||||
|
{
|
||||||
|
coordinateSystem cyl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -9,74 +9,74 @@ FoamFile
|
|||||||
{
|
{
|
||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class IOPtrList<coordinateSystem>;
|
class coordinateSystems;
|
||||||
object coordinateSystems;
|
object coordinateSystems;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
7
|
|
||||||
(
|
(
|
||||||
system_9
|
_9
|
||||||
{
|
{
|
||||||
type cartesian;
|
type cartesian;
|
||||||
origin (1.03291515 -0.114391257 -0.0826236662);
|
origin (1.03291515 -0.114391257 -0.0826236662);
|
||||||
e3 (1 0 0);
|
|
||||||
e1 (0 1 0);
|
e1 (0 1 0);
|
||||||
// STARCDRotation (0 90 90);
|
e3 (1 0 0);
|
||||||
|
// rotation { type starcd; angles (0 90 90); }
|
||||||
}
|
}
|
||||||
|
|
||||||
system_10
|
_10
|
||||||
{
|
{
|
||||||
type cartesian;
|
type cartesian;
|
||||||
origin (0.623151719 -0.286472935 -0.113933262);
|
origin (0.623151719 -0.286472935 -0.113933262);
|
||||||
e3 (0.99508851 0.09829095 0.01173645);
|
|
||||||
e1 (0.01179356 0 -0.99993045);
|
e1 (0.01179356 0 -0.99993045);
|
||||||
// STARCDRotation (5.6403745 -0.0664172952 89.3275351);
|
e3 (0.99508851 0.09829095 0.01173645);
|
||||||
|
// rotation { type starcd; angles (5.6403745 -0.0664172952 89.3275351); }
|
||||||
}
|
}
|
||||||
|
|
||||||
system_15
|
_15
|
||||||
{
|
{
|
||||||
type cartesian;
|
type cartesian;
|
||||||
origin (0.644772231 -0.240036493 0.155972187);
|
origin (0.644772231 -0.240036493 0.155972187);
|
||||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
|
||||||
e1 (0.00627978 0.42265304 -0.90626981);
|
e1 (0.00627978 0.42265304 -0.90626981);
|
||||||
// STARCDRotation (-90.8512386 0 115.005148);
|
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||||
|
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||||
}
|
}
|
||||||
|
|
||||||
system_16
|
_16
|
||||||
{
|
{
|
||||||
type cartesian;
|
type cartesian;
|
||||||
origin (0.540824938 -0.240036415 0.15928296);
|
origin (0.540824938 -0.240036415 0.15928296);
|
||||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
|
||||||
e1 (0.00627978 0.42265304 -0.90626981);
|
e1 (0.00627978 0.42265304 -0.90626981);
|
||||||
// STARCDRotation (-90.8512386 0 115.005148);
|
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||||
|
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||||
}
|
}
|
||||||
|
|
||||||
system_17
|
_17
|
||||||
{
|
{
|
||||||
type cartesian;
|
type cartesian;
|
||||||
origin (0.436877646 -0.240036339 0.162593737);
|
origin (0.436877646 -0.240036339 0.162593737);
|
||||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
|
||||||
e1 (0.00627978 0.42265304 -0.90626981);
|
e1 (0.00627978 0.42265304 -0.90626981);
|
||||||
// STARCDRotation (-90.8512386 0 115.005148);
|
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||||
|
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||||
}
|
}
|
||||||
|
|
||||||
system_18
|
_18
|
||||||
{
|
{
|
||||||
type cartesian;
|
type cartesian;
|
||||||
origin (0.332930354 -0.240036261 0.16590451);
|
origin (0.332930354 -0.240036261 0.16590451);
|
||||||
e3 (-0.01346388 -0.90616979 -0.42269969);
|
|
||||||
e1 (0.00627978 0.42265304 -0.90626981);
|
e1 (0.00627978 0.42265304 -0.90626981);
|
||||||
// STARCDRotation (-90.8512386 0 115.005148);
|
e3 (-0.01346388 -0.90616979 -0.42269969);
|
||||||
|
// rotation { type starcd; angles (-90.8512386 0 115.005148); }
|
||||||
}
|
}
|
||||||
|
|
||||||
system_21
|
_21
|
||||||
{
|
{
|
||||||
type cartesian;
|
type cartesian;
|
||||||
origin (0.55863733 -0.300866705 0.00317260982);
|
origin (0.55863733 -0.300866705 0.00317260982);
|
||||||
e3 (0.42110287 0.02470132 -0.90667647);
|
|
||||||
e1 (0.90646036 0.02342535 0.42164069);
|
e1 (0.90646036 0.02342535 0.42164069);
|
||||||
// STARCDRotation (-178.185897 -0.71772221 -155.059695);
|
e3 (0.42110287 0.02470132 -0.90667647);
|
||||||
|
// rotation { type starcd; angles (-178.185897 -0.71772221 -155.059695); }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,7 @@ Note
|
|||||||
|
|
||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "coordinateSystems.H"
|
#include "coordinateSystems.H"
|
||||||
|
#include "cartesianCS.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -146,9 +147,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get the coordinate transformations
|
// The coordinate transformations (must be cartesian)
|
||||||
autoPtr<coordinateSystem> fromCsys;
|
autoPtr<coordSystem::cartesian> fromCsys;
|
||||||
autoPtr<coordinateSystem> toCsys;
|
autoPtr<coordSystem::cartesian> toCsys;
|
||||||
|
|
||||||
if (args.found("from") || args.found("to"))
|
if (args.found("from") || args.found("to"))
|
||||||
{
|
{
|
||||||
@ -174,46 +175,47 @@ int main(int argc, char *argv[])
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
coordinateSystems csLst(ioCsys);
|
coordinateSystems globalCoords(ioCsys);
|
||||||
|
|
||||||
if (args.found("from"))
|
if (args.found("from"))
|
||||||
{
|
{
|
||||||
const word csName = args["from"];
|
const word csName(args["from"]);
|
||||||
|
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||||
|
|
||||||
const label csIndex = csLst.findIndex(csName);
|
if (!csPtr)
|
||||||
if (csIndex < 0)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot find -from " << csName << nl
|
<< "Cannot find -from " << csName << nl
|
||||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
<< "available coordinateSystems: "
|
||||||
|
<< flatOutput(globalCoords.names()) << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
fromCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.found("to"))
|
if (args.found("to"))
|
||||||
{
|
{
|
||||||
const word csName = args["to"];
|
const word csName(args["to"]);
|
||||||
|
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||||
|
|
||||||
const label csIndex = csLst.findIndex(csName);
|
if (!csPtr)
|
||||||
if (csIndex < 0)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot find -to " << csName << nl
|
<< "Cannot find -to " << csName << nl
|
||||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
<< "available coordinateSystems: "
|
||||||
|
<< flatOutput(globalCoords.names()) << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
toCsys.reset(new coordinateSystem(csLst[csIndex]));
|
toCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Maybe fix this later
|
||||||
// maybe fix this later
|
if (fromCsys && toCsys)
|
||||||
if (fromCsys.valid() && toCsys.valid())
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Only allowed '-from' or '-to' option at the moment."
|
<< "Only allowed '-from' or '-to' option at the moment."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,29 +232,30 @@ int main(int argc, char *argv[])
|
|||||||
scalar scaleIn = 0;
|
scalar scaleIn = 0;
|
||||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||||
{
|
{
|
||||||
Info<< " -scaleIn " << scaleIn << endl;
|
Info<< "scale input " << scaleIn << endl;
|
||||||
surf.scalePoints(scaleIn);
|
surf.scalePoints(scaleIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fromCsys)
|
||||||
if (fromCsys.valid())
|
|
||||||
{
|
{
|
||||||
Info<< " -from " << fromCsys().name() << endl;
|
Info<< "move points from coordinate system: "
|
||||||
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
|
<< fromCsys->name() << endl;
|
||||||
|
tmp<pointField> tpf = fromCsys->localPosition(surf.points());
|
||||||
surf.movePoints(tpf());
|
surf.movePoints(tpf());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toCsys.valid())
|
if (toCsys)
|
||||||
{
|
{
|
||||||
Info<< " -to " << toCsys().name() << endl;
|
Info<< "move points to coordinate system: "
|
||||||
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
|
<< toCsys->name() << endl;
|
||||||
|
tmp<pointField> tpf = toCsys->globalPosition(surf.points());
|
||||||
surf.movePoints(tpf());
|
surf.movePoints(tpf());
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar scaleOut = 0;
|
scalar scaleOut = 0;
|
||||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||||
{
|
{
|
||||||
Info<< " -scaleOut " << scaleOut << endl;
|
Info<< "scale output " << scaleOut << endl;
|
||||||
surf.scalePoints(scaleOut);
|
surf.scalePoints(scaleOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,6 +67,7 @@ Note
|
|||||||
|
|
||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "coordinateSystems.H"
|
#include "coordinateSystems.H"
|
||||||
|
#include "cartesianCS.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -135,9 +136,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get the coordinate transformations
|
// The coordinate transformations (must be cartesian)
|
||||||
autoPtr<coordinateSystem> fromCsys;
|
autoPtr<coordSystem::cartesian> fromCsys;
|
||||||
autoPtr<coordinateSystem> toCsys;
|
autoPtr<coordSystem::cartesian> toCsys;
|
||||||
|
|
||||||
if (args.found("from") || args.found("to"))
|
if (args.found("from") || args.found("to"))
|
||||||
{
|
{
|
||||||
@ -162,45 +163,47 @@ int main(int argc, char *argv[])
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
coordinateSystems csLst(ioCsys);
|
coordinateSystems globalCoords(ioCsys);
|
||||||
|
|
||||||
if (args.found("from"))
|
if (args.found("from"))
|
||||||
{
|
{
|
||||||
const word csName = args["from"];
|
const word csName(args["from"]);
|
||||||
|
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||||
|
|
||||||
const label csIndex = csLst.findIndex(csName);
|
if (!csPtr)
|
||||||
if (csIndex < 0)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot find -from " << csName << nl
|
<< "Cannot find -from " << csName << nl
|
||||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
<< "available coordinateSystems: "
|
||||||
|
<< flatOutput(globalCoords.names()) << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
fromCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.found("to"))
|
if (args.found("to"))
|
||||||
{
|
{
|
||||||
const word csName = args["to"];
|
const word csName(args["to"]);
|
||||||
|
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||||
|
|
||||||
const label csIndex = csLst.findIndex(csName);
|
if (!csPtr)
|
||||||
if (csIndex < 0)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot find -to " << csName << nl
|
<< "Cannot find -to " << csName << nl
|
||||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
<< "available coordinateSystems: "
|
||||||
|
<< flatOutput(globalCoords.names()) << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
toCsys.reset(new coordinateSystem(csLst[csIndex]));
|
toCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Maybe fix this later
|
||||||
// maybe fix this later
|
if (fromCsys && toCsys)
|
||||||
if (fromCsys.valid() && toCsys.valid())
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
<< "Only allowed '-from' or '-to' option at the moment."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,28 +236,30 @@ int main(int argc, char *argv[])
|
|||||||
scalar scaleIn = 0;
|
scalar scaleIn = 0;
|
||||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||||
{
|
{
|
||||||
Info<< " -scaleIn " << scaleIn << endl;
|
Info<< "scale input " << scaleIn << endl;
|
||||||
surf.scalePoints(scaleIn);
|
surf.scalePoints(scaleIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromCsys.valid())
|
if (fromCsys.valid())
|
||||||
{
|
{
|
||||||
Info<< " -from " << fromCsys().name() << endl;
|
Info<< "move points from coordinate system: "
|
||||||
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
|
<< fromCsys->name() << endl;
|
||||||
|
tmp<pointField> tpf = fromCsys->localPosition(surf.points());
|
||||||
surf.movePoints(tpf());
|
surf.movePoints(tpf());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toCsys.valid())
|
if (toCsys.valid())
|
||||||
{
|
{
|
||||||
Info<< " -to " << toCsys().name() << endl;
|
Info<< "move points to coordinate system: "
|
||||||
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
|
<< toCsys->name() << endl;
|
||||||
|
tmp<pointField> tpf = toCsys->globalPosition(surf.points());
|
||||||
surf.movePoints(tpf());
|
surf.movePoints(tpf());
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar scaleOut = 0;
|
scalar scaleOut = 0;
|
||||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||||
{
|
{
|
||||||
Info<< " -scaleOut " << scaleOut << endl;
|
Info<< "scale output " << scaleOut << endl;
|
||||||
surf.scalePoints(scaleOut);
|
surf.scalePoints(scaleOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,6 +67,7 @@ Note
|
|||||||
|
|
||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "coordinateSystems.H"
|
#include "coordinateSystems.H"
|
||||||
|
#include "cartesianCS.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -148,9 +149,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// get the coordinate transformations
|
// The coordinate transformations (must be cartesian)
|
||||||
autoPtr<coordinateSystem> fromCsys;
|
autoPtr<coordSystem::cartesian> fromCsys;
|
||||||
autoPtr<coordinateSystem> toCsys;
|
autoPtr<coordSystem::cartesian> toCsys;
|
||||||
|
|
||||||
if (args.found("from") || args.found("to"))
|
if (args.found("from") || args.found("to"))
|
||||||
{
|
{
|
||||||
@ -175,51 +176,52 @@ int main(int argc, char *argv[])
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
coordinateSystems csLst(ioCsys);
|
coordinateSystems globalCoords(ioCsys);
|
||||||
|
|
||||||
if (args.found("from"))
|
if (args.found("from"))
|
||||||
{
|
{
|
||||||
const word csName = args["from"];
|
const word csName(args["from"]);
|
||||||
|
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||||
|
|
||||||
const label csIndex = csLst.findIndex(csName);
|
if (!csPtr)
|
||||||
if (csIndex < 0)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot find -from " << csName << nl
|
<< "Cannot find -from " << csName << nl
|
||||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
<< "available coordinateSystems: "
|
||||||
|
<< flatOutput(globalCoords.names()) << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
fromCsys.reset(new coordinateSystem(csLst[csIndex]));
|
fromCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.found("to"))
|
if (args.found("to"))
|
||||||
{
|
{
|
||||||
const word csName = args["to"];
|
const word csName(args["to"]);
|
||||||
|
const auto* csPtr = globalCoords.lookupPtr(csName);
|
||||||
|
|
||||||
const label csIndex = csLst.findIndex(csName);
|
if (!csPtr)
|
||||||
if (csIndex < 0)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot find -to " << csName << nl
|
<< "Cannot find -to " << csName << nl
|
||||||
<< "available coordinateSystems: " << csLst.toc() << nl
|
<< "available coordinateSystems: "
|
||||||
|
<< flatOutput(globalCoords.names()) << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
toCsys.reset(new coordinateSystem(csLst[csIndex]));
|
toCsys = autoPtr<coordSystem::cartesian>::New(*csPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Maybe fix this later
|
||||||
// maybe fix this later
|
if (fromCsys && toCsys)
|
||||||
if (fromCsys.valid() && toCsys.valid())
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
|
<< "Only allowed '-from' or '-to' option at the moment."
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MeshedSurface<face> surf(importName);
|
MeshedSurface<face> surf(importName);
|
||||||
|
|
||||||
if (args.found("clean"))
|
if (args.found("clean"))
|
||||||
@ -231,28 +233,30 @@ int main(int argc, char *argv[])
|
|||||||
scalar scaleIn = 0;
|
scalar scaleIn = 0;
|
||||||
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
if (args.readIfPresent("scaleIn", scaleIn) && scaleIn > 0)
|
||||||
{
|
{
|
||||||
Info<< " -scaleIn " << scaleIn << endl;
|
Info<< "scale input " << scaleIn << endl;
|
||||||
surf.scalePoints(scaleIn);
|
surf.scalePoints(scaleIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromCsys.valid())
|
if (fromCsys)
|
||||||
{
|
{
|
||||||
Info<< " -from " << fromCsys().name() << endl;
|
Info<< "move points from coordinate system: "
|
||||||
tmp<pointField> tpf = fromCsys().localPosition(surf.points());
|
<< fromCsys->name() << endl;
|
||||||
|
tmp<pointField> tpf = fromCsys->localPosition(surf.points());
|
||||||
surf.movePoints(tpf());
|
surf.movePoints(tpf());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toCsys.valid())
|
if (toCsys)
|
||||||
{
|
{
|
||||||
Info<< " -to " << toCsys().name() << endl;
|
Info<< "move points to coordinate system: "
|
||||||
tmp<pointField> tpf = toCsys().globalPosition(surf.points());
|
<< toCsys->name() << endl;
|
||||||
|
tmp<pointField> tpf = toCsys->globalPosition(surf.points());
|
||||||
surf.movePoints(tpf());
|
surf.movePoints(tpf());
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar scaleOut = 0;
|
scalar scaleOut = 0;
|
||||||
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
if (args.readIfPresent("scaleOut", scaleOut) && scaleOut > 0)
|
||||||
{
|
{
|
||||||
Info<< " -scaleOut " << scaleOut << endl;
|
Info<< "scale output " << scaleOut << endl;
|
||||||
surf.scalePoints(scaleOut);
|
surf.scalePoints(scaleOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,10 +15,12 @@ FoamFile
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
type cartesian;
|
type cartesian;
|
||||||
|
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
|
||||||
|
rotation
|
||||||
{
|
{
|
||||||
type axesRotation;
|
type axes;
|
||||||
e1 $x;
|
e1 $x;
|
||||||
e2 $y;
|
e2 $y;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,10 +15,12 @@ FoamFile
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
type cartesian;
|
type cartesian;
|
||||||
|
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
|
||||||
|
rotation
|
||||||
{
|
{
|
||||||
type axesRotation;
|
type axes;
|
||||||
e1 $x;
|
e1 $x;
|
||||||
e3 $z;
|
e3 $z;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,12 +15,14 @@ FoamFile
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
type cartesian;
|
type cartesian;
|
||||||
|
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
|
||||||
|
rotation
|
||||||
{
|
{
|
||||||
type axesRotation;
|
type axes;
|
||||||
e2 $y;
|
e2 $y;
|
||||||
e3 $z
|
e3 $z;
|
||||||
}
|
}
|
||||||
|
|
||||||
//************************************************************************* //
|
//************************************************************************* //
|
||||||
|
|||||||
@ -14,8 +14,9 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
type cartesian;
|
type cylindrical;
|
||||||
coordinateRotation
|
|
||||||
|
rotation
|
||||||
{
|
{
|
||||||
type cylindrical;
|
type cylindrical;
|
||||||
e3 $axis;
|
e3 $axis;
|
||||||
|
|||||||
@ -208,7 +208,6 @@ DebugSwitches
|
|||||||
Ergun 0;
|
Ergun 0;
|
||||||
Euler 0;
|
Euler 0;
|
||||||
EulerImplicit 0;
|
EulerImplicit 0;
|
||||||
EulerRotation 0;
|
|
||||||
extendedCellToFaceStencil 0;
|
extendedCellToFaceStencil 0;
|
||||||
FDIC 0;
|
FDIC 0;
|
||||||
FaceCellWave 0;
|
FaceCellWave 0;
|
||||||
@ -239,7 +238,6 @@ DebugSwitches
|
|||||||
IFstream 0;
|
IFstream 0;
|
||||||
IOMap<dictionary> 0;
|
IOMap<dictionary> 0;
|
||||||
IOPtrList<MRFZone> 0;
|
IOPtrList<MRFZone> 0;
|
||||||
IOPtrList<coordinateSystem> 0;
|
|
||||||
IOPtrList<injector> 0;
|
IOPtrList<injector> 0;
|
||||||
IOPtrList<porousZone> 0;
|
IOPtrList<porousZone> 0;
|
||||||
IOobject 0;
|
IOobject 0;
|
||||||
@ -336,7 +334,6 @@ DebugSwitches
|
|||||||
SLTS 0;
|
SLTS 0;
|
||||||
SRFModel 0;
|
SRFModel 0;
|
||||||
SRFVelocity 0;
|
SRFVelocity 0;
|
||||||
STARCDRotation 0;
|
|
||||||
Schaeffer 0;
|
Schaeffer 0;
|
||||||
SchillerNaumann 0;
|
SchillerNaumann 0;
|
||||||
SinclairJackson 0;
|
SinclairJackson 0;
|
||||||
@ -456,9 +453,7 @@ DebugSwitches
|
|||||||
constantAbsorptionEmission 0;
|
constantAbsorptionEmission 0;
|
||||||
constantAlphaContactAngle 0;
|
constantAlphaContactAngle 0;
|
||||||
constantScatter 0;
|
constantScatter 0;
|
||||||
coordinateRotation 0;
|
|
||||||
coordinateSystem 0;
|
coordinateSystem 0;
|
||||||
coordinateSystems 0;
|
|
||||||
corrected 0;
|
corrected 0;
|
||||||
coupled 0;
|
coupled 0;
|
||||||
cubeRootVol 0;
|
cubeRootVol 0;
|
||||||
@ -478,9 +473,9 @@ DebugSwitches
|
|||||||
diagonal 0;
|
diagonal 0;
|
||||||
dictionary 0;
|
dictionary 0;
|
||||||
dimensionSet 1;
|
dimensionSet 1;
|
||||||
mappedBase 0;
|
mappedBase 0;
|
||||||
mappedPatch 0;
|
mappedPatch 0;
|
||||||
mappedVelocityFlux 0;
|
mappedVelocityFlux 0;
|
||||||
directionMixed 0;
|
directionMixed 0;
|
||||||
directional 0;
|
directional 0;
|
||||||
disallowGenericFvPatchField 0;
|
disallowGenericFvPatchField 0;
|
||||||
@ -745,7 +740,6 @@ DebugSwitches
|
|||||||
outletInlet 0;
|
outletInlet 0;
|
||||||
outletStabilised 0;
|
outletStabilised 0;
|
||||||
pair 0;
|
pair 0;
|
||||||
parabolicCylindrical 0;
|
|
||||||
parcel 0;
|
parcel 0;
|
||||||
partialSlip 0;
|
partialSlip 0;
|
||||||
passiveParticle 0;
|
passiveParticle 0;
|
||||||
@ -1101,5 +1095,4 @@ DimensionSets
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -242,11 +242,6 @@ public:
|
|||||||
//- Inner-product of this with another Tensor.
|
//- Inner-product of this with another Tensor.
|
||||||
inline Tensor<Cmpt> inner(const Tensor<Cmpt>& t2) const;
|
inline Tensor<Cmpt> inner(const Tensor<Cmpt>& t2) const;
|
||||||
|
|
||||||
//- Inner-product of this with transpose of another Tensor.
|
|
||||||
// Primarily useful for coordinate transformations
|
|
||||||
// (where transpose is the same as the inverse).
|
|
||||||
inline Tensor<Cmpt> innerT(const Tensor<Cmpt>& t2) const;
|
|
||||||
|
|
||||||
//- Schur-product of this with another Tensor.
|
//- Schur-product of this with another Tensor.
|
||||||
inline Tensor<Cmpt> schur(const Tensor<Cmpt>& t2) const;
|
inline Tensor<Cmpt> schur(const Tensor<Cmpt>& t2) const;
|
||||||
|
|
||||||
|
|||||||
@ -504,29 +504,6 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Cmpt>
|
|
||||||
inline Foam::Tensor<Cmpt>
|
|
||||||
Foam::Tensor<Cmpt>::innerT(const Tensor<Cmpt>& t2) const
|
|
||||||
{
|
|
||||||
const Tensor<Cmpt>& t1 = *this;
|
|
||||||
|
|
||||||
return Tensor<Cmpt>
|
|
||||||
(
|
|
||||||
t1.xx()*t2.xx() + t1.xy()*t2.xy() + t1.xz()*t2.xz(),
|
|
||||||
t1.xx()*t2.yx() + t1.xy()*t2.yy() + t1.xz()*t2.yz(),
|
|
||||||
t1.xx()*t2.zx() + t1.xy()*t2.zy() + t1.xz()*t2.zz(),
|
|
||||||
|
|
||||||
t1.yx()*t2.xx() + t1.yy()*t2.xy() + t1.yz()*t2.xz(),
|
|
||||||
t1.yx()*t2.yx() + t1.yy()*t2.yy() + t1.yz()*t2.yz(),
|
|
||||||
t1.yx()*t2.zx() + t1.yy()*t2.zy() + t1.yz()*t2.zz(),
|
|
||||||
|
|
||||||
t1.zx()*t2.xx() + t1.zy()*t2.xy() + t1.zz()*t2.xz(),
|
|
||||||
t1.zx()*t2.yx() + t1.zy()*t2.yy() + t1.zz()*t2.yz(),
|
|
||||||
t1.zx()*t2.zx() + t1.zy()*t2.zy() + t1.zz()*t2.zz()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline Foam::Tensor<Cmpt>
|
inline Foam::Tensor<Cmpt>
|
||||||
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
|
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
|
||||||
|
|||||||
@ -156,11 +156,6 @@ public:
|
|||||||
//- Inner-product of this with another Tensor2D.
|
//- Inner-product of this with another Tensor2D.
|
||||||
inline Tensor2D<Cmpt> inner(const Tensor2D<Cmpt>& t2) const;
|
inline Tensor2D<Cmpt> inner(const Tensor2D<Cmpt>& t2) const;
|
||||||
|
|
||||||
//- Inner-product of this with transpose of another Tensor2D.
|
|
||||||
// Primarily useful for coordinate transformations
|
|
||||||
// (where transpose is the same as the inverse).
|
|
||||||
inline Tensor2D<Cmpt> innerT(const Tensor2D<Cmpt>& t2) const;
|
|
||||||
|
|
||||||
//- Schur-product of this with another Tensor2D.
|
//- Schur-product of this with another Tensor2D.
|
||||||
inline Tensor2D<Cmpt> schur(const Tensor2D<Cmpt>& t2) const;
|
inline Tensor2D<Cmpt> schur(const Tensor2D<Cmpt>& t2) const;
|
||||||
|
|
||||||
|
|||||||
@ -202,23 +202,6 @@ Foam::Tensor2D<Cmpt>::inner(const Tensor2D<Cmpt>& t2) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Cmpt>
|
|
||||||
inline Foam::Tensor2D<Cmpt>
|
|
||||||
Foam::Tensor2D<Cmpt>::innerT(const Tensor2D<Cmpt>& t2) const
|
|
||||||
{
|
|
||||||
const Tensor2D<Cmpt>& t1 = *this;
|
|
||||||
|
|
||||||
return Tensor2D<Cmpt>
|
|
||||||
(
|
|
||||||
t1.xx()*t2.xx() + t1.xy()*t2.xy(),
|
|
||||||
t1.xx()*t2.yx() + t1.xy()*t2.yy(),
|
|
||||||
|
|
||||||
t1.yx()*t2.xx() + t1.yy()*t2.xy(),
|
|
||||||
t1.yx()*t2.yx() + t1.yy()*t2.yy()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Cmpt>
|
template<class Cmpt>
|
||||||
inline Foam::Tensor2D<Cmpt>
|
inline Foam::Tensor2D<Cmpt>
|
||||||
Foam::Tensor2D<Cmpt>::schur(const Tensor2D<Cmpt>& t2) const
|
Foam::Tensor2D<Cmpt>::schur(const Tensor2D<Cmpt>& t2) const
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Description
|
|||||||
U_f | frictional velocity
|
U_f | frictional velocity
|
||||||
K | Von Karman's constant
|
K | Von Karman's constant
|
||||||
z_0 | surface roughness length
|
z_0 | surface roughness length
|
||||||
z | vertical co-ordinate
|
z | vertical coordinate
|
||||||
\endvartable
|
\endvartable
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
|||||||
@ -276,7 +276,7 @@ Foam::directions::directions
|
|||||||
List<vectorField>(wordList(dict.lookup("directions")).size())
|
List<vectorField>(wordList(dict.lookup("directions")).size())
|
||||||
{
|
{
|
||||||
const wordList wantedDirs(dict.lookup("directions"));
|
const wordList wantedDirs(dict.lookup("directions"));
|
||||||
const word coordSystem(dict.lookup("coordinateSystem"));
|
const word coordSystem(dict.get<word>("coordinateSystem"));
|
||||||
|
|
||||||
bool wantNormal = false;
|
bool wantNormal = false;
|
||||||
bool wantTan1 = false;
|
bool wantTan1 = false;
|
||||||
|
|||||||
@ -230,8 +230,8 @@ void Foam::points0MotionSolver::updateMesh(const mapPolyMesh& mpm)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Cannot determine co-ordinates of introduced vertices."
|
<< "Cannot determine coordinates of introduced vertices."
|
||||||
<< " New vertex " << pointi << " at co-ordinate "
|
<< " New vertex " << pointi << " at coordinate "
|
||||||
<< points[pointi] << exit(FatalError);
|
<< points[pointi] << exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,6 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
Foam::enginePiston::enginePiston
|
Foam::enginePiston::enginePiston
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -43,13 +42,12 @@ Foam::enginePiston::enginePiston
|
|||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
engineDB_(refCast<const engineTime>(mesh.time())),
|
engineDB_(refCast<const engineTime>(mesh.time())),
|
||||||
patchID_(pistonPatchName, mesh.boundaryMesh()),
|
patchID_(pistonPatchName, mesh.boundaryMesh()),
|
||||||
csPtr_(pistonCS),
|
csysPtr_(pistonCS),
|
||||||
minLayer_(minLayer),
|
minLayer_(minLayer),
|
||||||
maxLayer_(maxLayer)
|
maxLayer_(maxLayer)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Construct from dictionary
|
|
||||||
Foam::enginePiston::enginePiston
|
Foam::enginePiston::enginePiston
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -59,22 +57,15 @@ Foam::enginePiston::enginePiston
|
|||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
engineDB_(refCast<const engineTime>(mesh_.time())),
|
engineDB_(refCast<const engineTime>(mesh_.time())),
|
||||||
patchID_(dict.lookup("patch"), mesh.boundaryMesh()),
|
patchID_(dict.lookup("patch"), mesh.boundaryMesh()),
|
||||||
csPtr_
|
csysPtr_
|
||||||
(
|
(
|
||||||
coordinateSystem::New
|
coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_())
|
||||||
(
|
|
||||||
mesh_,
|
|
||||||
dict.subDict("coordinateSystem")
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
minLayer_(readScalar(dict.lookup("minLayer"))),
|
minLayer_(dict.get<scalar>("minLayer")),
|
||||||
maxLayer_(readScalar(dict.lookup("maxLayer")))
|
maxLayer_(dict.get<scalar>("maxLayer"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::enginePiston::writeDict(Ostream& os) const
|
void Foam::enginePiston::writeDict(Ostream& os) const
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class enginePiston
|
|||||||
polyPatchID patchID_;
|
polyPatchID patchID_;
|
||||||
|
|
||||||
//- Coordinate system
|
//- Coordinate system
|
||||||
autoPtr<coordinateSystem> csPtr_;
|
autoPtr<coordinateSystem> csysPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Piston layering data
|
// Piston layering data
|
||||||
@ -112,7 +112,8 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Destructor - default
|
//- Destructor
|
||||||
|
~enginePiston() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -120,7 +121,7 @@ public:
|
|||||||
//- Return coordinate system
|
//- Return coordinate system
|
||||||
const coordinateSystem& cs() const
|
const coordinateSystem& cs() const
|
||||||
{
|
{
|
||||||
return *csPtr_;
|
return *csysPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return ID of piston patch
|
//- Return ID of piston patch
|
||||||
|
|||||||
@ -63,7 +63,6 @@ Foam::scalar Foam::engineValve::adjustCrankAngle(const scalar theta) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
Foam::engineValve::engineValve
|
Foam::engineValve::engineValve
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -89,7 +88,7 @@ Foam::engineValve::engineValve
|
|||||||
name_(name),
|
name_(name),
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
engineDB_(refCast<const engineTime>(mesh.time())),
|
engineDB_(refCast<const engineTime>(mesh.time())),
|
||||||
csPtr_(valveCS),
|
csysPtr_(valveCS.clone()),
|
||||||
bottomPatch_(bottomPatchName, mesh.boundaryMesh()),
|
bottomPatch_(bottomPatchName, mesh.boundaryMesh()),
|
||||||
poppetPatch_(poppetPatchName, mesh.boundaryMesh()),
|
poppetPatch_(poppetPatchName, mesh.boundaryMesh()),
|
||||||
stemPatch_(stemPatchName, mesh.boundaryMesh()),
|
stemPatch_(stemPatchName, mesh.boundaryMesh()),
|
||||||
@ -110,7 +109,6 @@ Foam::engineValve::engineValve
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Construct from dictionary
|
|
||||||
Foam::engineValve::engineValve
|
Foam::engineValve::engineValve
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -121,13 +119,9 @@ Foam::engineValve::engineValve
|
|||||||
name_(name),
|
name_(name),
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
engineDB_(refCast<const engineTime>(mesh_.time())),
|
engineDB_(refCast<const engineTime>(mesh_.time())),
|
||||||
csPtr_
|
csysPtr_
|
||||||
(
|
(
|
||||||
coordinateSystem::New
|
coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_())
|
||||||
(
|
|
||||||
mesh_,
|
|
||||||
dict.subDict("coordinateSystem")
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
bottomPatch_(dict.lookup("bottomPatch"), mesh.boundaryMesh()),
|
bottomPatch_(dict.lookup("bottomPatch"), mesh.boundaryMesh()),
|
||||||
poppetPatch_(dict.lookup("poppetPatch"), mesh.boundaryMesh()),
|
poppetPatch_(dict.lookup("poppetPatch"), mesh.boundaryMesh()),
|
||||||
@ -156,18 +150,15 @@ Foam::engineValve::engineValve
|
|||||||
liftProfile_("theta", "lift", name_, dict.lookup("liftProfile")),
|
liftProfile_("theta", "lift", name_, dict.lookup("liftProfile")),
|
||||||
liftProfileStart_(min(liftProfile_.x())),
|
liftProfileStart_(min(liftProfile_.x())),
|
||||||
liftProfileEnd_(max(liftProfile_.x())),
|
liftProfileEnd_(max(liftProfile_.x())),
|
||||||
minLift_(readScalar(dict.lookup("minLift"))),
|
minLift_(dict.get<scalar>("minLift")),
|
||||||
minTopLayer_(readScalar(dict.lookup("minTopLayer"))),
|
minTopLayer_(dict.get<scalar>("minTopLayer")),
|
||||||
maxTopLayer_(readScalar(dict.lookup("maxTopLayer"))),
|
maxTopLayer_(dict.get<scalar>("maxTopLayer")),
|
||||||
minBottomLayer_(readScalar(dict.lookup("minBottomLayer"))),
|
minBottomLayer_(dict.get<scalar>("minBottomLayer")),
|
||||||
maxBottomLayer_(readScalar(dict.lookup("maxBottomLayer"))),
|
maxBottomLayer_(dict.get<scalar>("maxBottomLayer")),
|
||||||
diameter_(readScalar(dict.lookup("diameter")))
|
diameter_(dict.get<scalar>("diameter"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::scalar Foam::engineValve::lift(const scalar theta) const
|
Foam::scalar Foam::engineValve::lift(const scalar theta) const
|
||||||
@ -238,7 +229,7 @@ void Foam::engineValve::writeDict(Ostream& os) const
|
|||||||
{
|
{
|
||||||
os << nl << name() << nl << token::BEGIN_BLOCK;
|
os << nl << name() << nl << token::BEGIN_BLOCK;
|
||||||
|
|
||||||
cs().writeDict(os);
|
cs().writeEntry(coordinateSystem::typeName_(), os);
|
||||||
|
|
||||||
os << "bottomPatch " << bottomPatch_.name() << token::END_STATEMENT << nl
|
os << "bottomPatch " << bottomPatch_.name() << token::END_STATEMENT << nl
|
||||||
<< "poppetPatch " << poppetPatch_.name() << token::END_STATEMENT << nl
|
<< "poppetPatch " << poppetPatch_.name() << token::END_STATEMENT << nl
|
||||||
|
|||||||
@ -45,7 +45,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declarations
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
class engineTime;
|
class engineTime;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class engineValve
|
|||||||
const engineTime& engineDB_;
|
const engineTime& engineDB_;
|
||||||
|
|
||||||
//- Coordinate system
|
//- Coordinate system
|
||||||
autoPtr<coordinateSystem> csPtr_;
|
autoPtr<coordinateSystem> csysPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Patch and zone names
|
// Patch and zone names
|
||||||
@ -145,9 +145,6 @@ class engineValve
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data members
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
@ -171,7 +168,6 @@ public:
|
|||||||
const scalar minBottomLayer,
|
const scalar minBottomLayer,
|
||||||
const scalar maxBottomLayer,
|
const scalar maxBottomLayer,
|
||||||
const scalar diameter
|
const scalar diameter
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
@ -183,7 +179,8 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Destructor - default
|
//- Destructor
|
||||||
|
~engineValve() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -197,7 +194,7 @@ public:
|
|||||||
//- Return coordinate system
|
//- Return coordinate system
|
||||||
const coordinateSystem& cs() const
|
const coordinateSystem& cs() const
|
||||||
{
|
{
|
||||||
return *csPtr_;
|
return *csysPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return lift profile
|
//- Return lift profile
|
||||||
@ -308,7 +305,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Write dictionary
|
//- Write dictionary
|
||||||
void writeDict(Ostream&) const;
|
void writeDict(Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ License
|
|||||||
#include "processorFaPatch.H"
|
#include "processorFaPatch.H"
|
||||||
#include "wedgeFaPatch.H"
|
#include "wedgeFaPatch.H"
|
||||||
#include "PstreamCombineReduceOps.H"
|
#include "PstreamCombineReduceOps.H"
|
||||||
#include "coordinateSystem.H"
|
#include "cartesianCS.H"
|
||||||
#include "scalarMatrices.H"
|
#include "scalarMatrices.H"
|
||||||
#include "processorFaPatchFields.H"
|
#include "processorFaPatchFields.H"
|
||||||
#include "emptyFaPatchFields.H"
|
#include "emptyFaPatchFields.H"
|
||||||
@ -1271,7 +1271,7 @@ void Foam::faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||||||
curPoints = pointSet.toc();
|
curPoints = pointSet.toc();
|
||||||
}
|
}
|
||||||
|
|
||||||
vectorField allPoints(curPoints.size());
|
pointField allPoints(curPoints.size());
|
||||||
scalarField W(curPoints.size(), 1.0);
|
scalarField W(curPoints.size(), 1.0);
|
||||||
for (label i=0; i<curPoints.size(); ++i)
|
for (label i=0; i<curPoints.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -1280,17 +1280,16 @@ void Foam::faMesh::calcPointAreaNormalsByQuadricsFit() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transform points
|
// Transform points
|
||||||
const vector& origin = points[curPoint];
|
coordSystem::cartesian cs
|
||||||
const vector axis = normalised(result[curPoint]);
|
(
|
||||||
vector dir(allPoints[0] - points[curPoint]);
|
points[curPoint], // origin
|
||||||
dir -= axis*(axis&dir);
|
result[curPoint], // axis [e3] (normalized by constructor)
|
||||||
dir.normalise();
|
allPoints[0] - points[curPoint] // direction [e1]
|
||||||
|
);
|
||||||
|
|
||||||
coordinateSystem cs("cs", origin, axis, dir);
|
for (point& p : allPoints)
|
||||||
|
|
||||||
forAll(allPoints, pI)
|
|
||||||
{
|
{
|
||||||
allPoints[pI] = cs.localPosition(allPoints[pI]);
|
p = cs.localPosition(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
scalarRectangularMatrix M
|
scalarRectangularMatrix M
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "DarcyForchheimer.H"
|
#include "DarcyForchheimer.H"
|
||||||
#include "geometricOneField.H"
|
#include "geometricOneField.H"
|
||||||
#include "fvMatrices.H"
|
#include "fvMatrices.H"
|
||||||
|
#include "pointIndList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -67,69 +68,50 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::porosityModels::DarcyForchheimer::~DarcyForchheimer()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::porosityModels::DarcyForchheimer::calcTransformModelData()
|
void Foam::porosityModels::DarcyForchheimer::calcTransformModelData()
|
||||||
{
|
{
|
||||||
if (coordSys_.R().uniform())
|
// The Darcy coefficient as a tensor
|
||||||
|
tensor darcyCoeff(Zero);
|
||||||
|
darcyCoeff.xx() = dXYZ_.value().x();
|
||||||
|
darcyCoeff.yy() = dXYZ_.value().y();
|
||||||
|
darcyCoeff.zz() = dXYZ_.value().z();
|
||||||
|
|
||||||
|
// The Forchheimer coefficient as a tensor
|
||||||
|
// - the leading 0.5 is from 1/2*rho
|
||||||
|
tensor forchCoeff(Zero);
|
||||||
|
forchCoeff.xx() = 0.5*fXYZ_.value().x();
|
||||||
|
forchCoeff.yy() = 0.5*fXYZ_.value().y();
|
||||||
|
forchCoeff.zz() = 0.5*fXYZ_.value().z();
|
||||||
|
|
||||||
|
if (csys().uniform())
|
||||||
{
|
{
|
||||||
forAll(cellZoneIDs_, zoneI)
|
forAll(cellZoneIDs_, zonei)
|
||||||
{
|
{
|
||||||
D_[zoneI].setSize(1);
|
D_[zonei].resize(1);
|
||||||
F_[zoneI].setSize(1);
|
F_[zonei].resize(1);
|
||||||
|
|
||||||
D_[zoneI][0] = Zero;
|
D_[zonei] = csys().transform(darcyCoeff);
|
||||||
D_[zoneI][0].xx() = dXYZ_.value().x();
|
F_[zonei] = csys().transform(forchCoeff);
|
||||||
D_[zoneI][0].yy() = dXYZ_.value().y();
|
|
||||||
D_[zoneI][0].zz() = dXYZ_.value().z();
|
|
||||||
|
|
||||||
D_[zoneI][0] = coordSys_.R().transformTensor(D_[zoneI][0]);
|
|
||||||
|
|
||||||
// leading 0.5 is from 1/2*rho
|
|
||||||
F_[zoneI][0] = Zero;
|
|
||||||
F_[zoneI][0].xx() = 0.5*fXYZ_.value().x();
|
|
||||||
F_[zoneI][0].yy() = 0.5*fXYZ_.value().y();
|
|
||||||
F_[zoneI][0].zz() = 0.5*fXYZ_.value().z();
|
|
||||||
|
|
||||||
F_[zoneI][0] = coordSys_.R().transformTensor(F_[zoneI][0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forAll(cellZoneIDs_, zoneI)
|
forAll(cellZoneIDs_, zonei)
|
||||||
{
|
{
|
||||||
const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
|
const pointUIndList cc
|
||||||
|
(
|
||||||
|
mesh_.cellCentres(),
|
||||||
|
mesh_.cellZones()[cellZoneIDs_[zonei]]
|
||||||
|
);
|
||||||
|
|
||||||
D_[zoneI].setSize(cells.size());
|
D_[zonei] = csys().transform(cc, darcyCoeff);
|
||||||
F_[zoneI].setSize(cells.size());
|
F_[zonei] = csys().transform(cc, forchCoeff);
|
||||||
|
|
||||||
forAll(cells, i)
|
|
||||||
{
|
|
||||||
D_[zoneI][i] = Zero;
|
|
||||||
D_[zoneI][i].xx() = dXYZ_.value().x();
|
|
||||||
D_[zoneI][i].yy() = dXYZ_.value().y();
|
|
||||||
D_[zoneI][i].zz() = dXYZ_.value().z();
|
|
||||||
|
|
||||||
// leading 0.5 is from 1/2*rho
|
|
||||||
F_[zoneI][i] = Zero;
|
|
||||||
F_[zoneI][i].xx() = 0.5*fXYZ_.value().x();
|
|
||||||
F_[zoneI][i].yy() = 0.5*fXYZ_.value().y();
|
|
||||||
F_[zoneI][i].zz() = 0.5*fXYZ_.value().z();
|
|
||||||
}
|
|
||||||
|
|
||||||
const coordinateRotation& R = coordSys_.R(mesh_, cells);
|
|
||||||
|
|
||||||
D_[zoneI] = R.transformTensor(D_[zoneI], cells);
|
|
||||||
F_[zoneI] = R.transformTensor(F_[zoneI], cells);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (debug && mesh_.time().writeTime())
|
if (debug && mesh_.time().writeTime())
|
||||||
{
|
{
|
||||||
volTensorField Dout
|
volTensorField Dout
|
||||||
@ -159,8 +141,22 @@ void Foam::porosityModels::DarcyForchheimer::calcTransformModelData()
|
|||||||
dimensionedTensor(fXYZ_.dimensions(), Zero)
|
dimensionedTensor(fXYZ_.dimensions(), Zero)
|
||||||
);
|
);
|
||||||
|
|
||||||
UIndirectList<tensor>(Dout, mesh_.cellZones()[cellZoneIDs_[0]]) = D_[0];
|
|
||||||
UIndirectList<tensor>(Fout, mesh_.cellZones()[cellZoneIDs_[0]]) = F_[0];
|
forAll(cellZoneIDs_, zonei)
|
||||||
|
{
|
||||||
|
const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zonei]];
|
||||||
|
|
||||||
|
if (csys().uniform())
|
||||||
|
{
|
||||||
|
UIndirectList<tensor>(Dout, cells) = D_[zonei].first();
|
||||||
|
UIndirectList<tensor>(Fout, cells) = F_[zonei].first();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UIndirectList<tensor>(Dout, cells) = D_[zonei];
|
||||||
|
UIndirectList<tensor>(Fout, cells) = F_[zonei];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Dout.write();
|
Dout.write();
|
||||||
Fout.write();
|
Fout.write();
|
||||||
@ -176,7 +172,7 @@ void Foam::porosityModels::DarcyForchheimer::calcForce
|
|||||||
vectorField& force
|
vectorField& force
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalarField Udiag(U.size(), 0.0);
|
scalarField Udiag(U.size(), Zero);
|
||||||
vectorField Usource(U.size(), Zero);
|
vectorField Usource(U.size(), Zero);
|
||||||
const scalarField& V = mesh_.V();
|
const scalarField& V = mesh_.V();
|
||||||
|
|
||||||
@ -202,19 +198,17 @@ void Foam::porosityModels::DarcyForchheimer::correct
|
|||||||
|
|
||||||
if (UEqn.dimensions() == dimForce)
|
if (UEqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
const volScalarField& rho = mesh_.lookupObject<volScalarField>(rhoName);
|
const auto& rho = mesh_.lookupObject<volScalarField>(rhoName);
|
||||||
|
|
||||||
if (mesh_.foundObject<volScalarField>(muName))
|
if (mesh_.foundObject<volScalarField>(muName))
|
||||||
{
|
{
|
||||||
const volScalarField& mu =
|
const auto& mu = mesh_.lookupObject<volScalarField>(muName);
|
||||||
mesh_.lookupObject<volScalarField>(muName);
|
|
||||||
|
|
||||||
apply(Udiag, Usource, V, rho, mu, U);
|
apply(Udiag, Usource, V, rho, mu, U);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const volScalarField& nu =
|
const auto& nu = mesh_.lookupObject<volScalarField>(nuName);
|
||||||
mesh_.lookupObject<volScalarField>(nuName);
|
|
||||||
|
|
||||||
apply(Udiag, Usource, V, rho, rho*nu, U);
|
apply(Udiag, Usource, V, rho, rho*nu, U);
|
||||||
}
|
}
|
||||||
@ -223,17 +217,14 @@ void Foam::porosityModels::DarcyForchheimer::correct
|
|||||||
{
|
{
|
||||||
if (mesh_.foundObject<volScalarField>(nuName))
|
if (mesh_.foundObject<volScalarField>(nuName))
|
||||||
{
|
{
|
||||||
const volScalarField& nu =
|
const auto& nu = mesh_.lookupObject<volScalarField>(nuName);
|
||||||
mesh_.lookupObject<volScalarField>(nuName);
|
|
||||||
|
|
||||||
apply(Udiag, Usource, V, geometricOneField(), nu, U);
|
apply(Udiag, Usource, V, geometricOneField(), nu, U);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const volScalarField& rho =
|
const auto& rho = mesh_.lookupObject<volScalarField>(rhoName);
|
||||||
mesh_.lookupObject<volScalarField>(rhoName);
|
const auto& mu = mesh_.lookupObject<volScalarField>(muName);
|
||||||
const volScalarField& mu =
|
|
||||||
mesh_.lookupObject<volScalarField>(muName);
|
|
||||||
|
|
||||||
apply(Udiag, Usource, V, geometricOneField(), mu/rho, U);
|
apply(Udiag, Usource, V, geometricOneField(), mu/rho, U);
|
||||||
}
|
}
|
||||||
@ -271,8 +262,8 @@ void Foam::porosityModels::DarcyForchheimer::correct
|
|||||||
|
|
||||||
if (UEqn.dimensions() == dimForce)
|
if (UEqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
const volScalarField& rho = mesh_.lookupObject<volScalarField>(rhoName);
|
const auto& rho = mesh_.lookupObject<volScalarField>(rhoName);
|
||||||
const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName);
|
const auto& mu = mesh_.lookupObject<volScalarField>(muName);
|
||||||
|
|
||||||
apply(AU, rho, mu, U);
|
apply(AU, rho, mu, U);
|
||||||
}
|
}
|
||||||
@ -280,17 +271,14 @@ void Foam::porosityModels::DarcyForchheimer::correct
|
|||||||
{
|
{
|
||||||
if (mesh_.foundObject<volScalarField>(nuName))
|
if (mesh_.foundObject<volScalarField>(nuName))
|
||||||
{
|
{
|
||||||
const volScalarField& nu =
|
const auto& nu = mesh_.lookupObject<volScalarField>(nuName);
|
||||||
mesh_.lookupObject<volScalarField>(nuName);
|
|
||||||
|
|
||||||
apply(AU, geometricOneField(), nu, U);
|
apply(AU, geometricOneField(), nu, U);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const volScalarField& rho =
|
const auto& rho = mesh_.lookupObject<volScalarField>(rhoName);
|
||||||
mesh_.lookupObject<volScalarField>(rhoName);
|
const auto& mu = mesh_.lookupObject<volScalarField>(muName);
|
||||||
const volScalarField& mu =
|
|
||||||
mesh_.lookupObject<volScalarField>(muName);
|
|
||||||
|
|
||||||
apply(AU, geometricOneField(), mu/rho, U);
|
apply(AU, geometricOneField(), mu/rho, U);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ Description
|
|||||||
to specify a multiplier (of the max component).
|
to specify a multiplier (of the max component).
|
||||||
|
|
||||||
The orientation of the porous region is defined with the same notation as
|
The orientation of the porous region is defined with the same notation as
|
||||||
a co-ordinate system, but only a Cartesian co-ordinate system is valid.
|
a coordinate system, but only a Cartesian coordinate system is valid.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
DarcyForchheimer.C
|
DarcyForchheimer.C
|
||||||
@ -141,7 +141,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~DarcyForchheimer();
|
virtual ~DarcyForchheimer() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "fixedCoeff.H"
|
#include "fixedCoeff.H"
|
||||||
#include "fvMatrices.H"
|
#include "fvMatrices.H"
|
||||||
|
#include "pointIndList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -78,7 +79,6 @@ void Foam::porosityModels::fixedCoeff::apply
|
|||||||
const scalar rho
|
const scalar rho
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
|
||||||
forAll(cellZoneIDs_, zoneI)
|
forAll(cellZoneIDs_, zoneI)
|
||||||
{
|
{
|
||||||
const tensorField& alphaZones = alpha_[zoneI];
|
const tensorField& alphaZones = alpha_[zoneI];
|
||||||
@ -123,62 +123,45 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::porosityModels::fixedCoeff::~fixedCoeff()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::porosityModels::fixedCoeff::calcTransformModelData()
|
void Foam::porosityModels::fixedCoeff::calcTransformModelData()
|
||||||
{
|
{
|
||||||
if (coordSys_.R().uniform())
|
// The alpha coefficient as a tensor
|
||||||
|
tensor alphaCoeff(Zero);
|
||||||
|
alphaCoeff.xx() = alphaXYZ_.value().x();
|
||||||
|
alphaCoeff.yy() = alphaXYZ_.value().y();
|
||||||
|
alphaCoeff.zz() = alphaXYZ_.value().z();
|
||||||
|
|
||||||
|
// The beta coefficient as a tensor
|
||||||
|
tensor betaCoeff(Zero);
|
||||||
|
betaCoeff.xx() = betaXYZ_.value().x();
|
||||||
|
betaCoeff.yy() = betaXYZ_.value().y();
|
||||||
|
betaCoeff.zz() = betaXYZ_.value().z();
|
||||||
|
|
||||||
|
if (csys().uniform())
|
||||||
{
|
{
|
||||||
forAll(cellZoneIDs_, zoneI)
|
forAll(cellZoneIDs_, zonei)
|
||||||
{
|
{
|
||||||
alpha_[zoneI].setSize(1);
|
alpha_[zonei].resize(1);
|
||||||
beta_[zoneI].setSize(1);
|
beta_[zonei].resize(1);
|
||||||
|
|
||||||
alpha_[zoneI][0] = Zero;
|
alpha_[zonei] = csys().transform(alphaCoeff);
|
||||||
alpha_[zoneI][0].xx() = alphaXYZ_.value().x();
|
beta_[zonei] = csys().transform(betaCoeff);
|
||||||
alpha_[zoneI][0].yy() = alphaXYZ_.value().y();
|
|
||||||
alpha_[zoneI][0].zz() = alphaXYZ_.value().z();
|
|
||||||
alpha_[zoneI][0] = coordSys_.R().transformTensor(alpha_[zoneI][0]);
|
|
||||||
|
|
||||||
beta_[zoneI][0] = Zero;
|
|
||||||
beta_[zoneI][0].xx() = betaXYZ_.value().x();
|
|
||||||
beta_[zoneI][0].yy() = betaXYZ_.value().y();
|
|
||||||
beta_[zoneI][0].zz() = betaXYZ_.value().z();
|
|
||||||
beta_[zoneI][0] = coordSys_.R().transformTensor(beta_[zoneI][0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forAll(cellZoneIDs_, zoneI)
|
forAll(cellZoneIDs_, zonei)
|
||||||
{
|
{
|
||||||
const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
|
const pointUIndList cc
|
||||||
|
(
|
||||||
|
mesh_.cellCentres(),
|
||||||
|
mesh_.cellZones()[cellZoneIDs_[zonei]]
|
||||||
|
);
|
||||||
|
|
||||||
alpha_[zoneI].setSize(cells.size());
|
alpha_[zonei] = csys().transform(cc, alphaCoeff);
|
||||||
beta_[zoneI].setSize(cells.size());
|
beta_[zonei] = csys().transform(cc, betaCoeff);
|
||||||
|
|
||||||
forAll(cells, i)
|
|
||||||
{
|
|
||||||
alpha_[zoneI][i] = Zero;
|
|
||||||
alpha_[zoneI][i].xx() = alphaXYZ_.value().x();
|
|
||||||
alpha_[zoneI][i].yy() = alphaXYZ_.value().y();
|
|
||||||
alpha_[zoneI][i].zz() = alphaXYZ_.value().z();
|
|
||||||
|
|
||||||
beta_[zoneI][i] = Zero;
|
|
||||||
beta_[zoneI][i].xx() = betaXYZ_.value().x();
|
|
||||||
beta_[zoneI][i].yy() = betaXYZ_.value().y();
|
|
||||||
beta_[zoneI][i].zz() = betaXYZ_.value().z();
|
|
||||||
}
|
|
||||||
|
|
||||||
const coordinateRotation& R = coordSys_.R(mesh_, cells);
|
|
||||||
|
|
||||||
alpha_[zoneI] = R.transformTensor(alpha_[zoneI], cells);
|
|
||||||
beta_[zoneI] = R.transformTensor(beta_[zoneI], cells);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +178,7 @@ void Foam::porosityModels::fixedCoeff::calcForce
|
|||||||
scalarField Udiag(U.size(), 0.0);
|
scalarField Udiag(U.size(), 0.0);
|
||||||
vectorField Usource(U.size(), Zero);
|
vectorField Usource(U.size(), Zero);
|
||||||
const scalarField& V = mesh_.V();
|
const scalarField& V = mesh_.V();
|
||||||
scalar rhoRef = readScalar(coeffs_.lookup("rhoRef"));
|
const scalar rhoRef = coeffs_.get<scalar>("rhoRef");
|
||||||
|
|
||||||
apply(Udiag, Usource, V, U, rhoRef);
|
apply(Udiag, Usource, V, U, rhoRef);
|
||||||
|
|
||||||
|
|||||||
@ -118,7 +118,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~fixedCoeff();
|
virtual ~fixedCoeff() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -48,15 +48,15 @@ Foam::IOobject Foam::IOporosityModelList::createIOobject
|
|||||||
Info<< "Creating porosity model list from " << io.name() << nl << endl;
|
Info<< "Creating porosity model list from " << io.name() << nl << endl;
|
||||||
|
|
||||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||||
return io;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "No porosity models present" << nl << endl;
|
Info<< "No porosity models present" << nl << endl;
|
||||||
|
|
||||||
io.readOpt() = IOobject::NO_READ;
|
io.readOpt() = IOobject::NO_READ;
|
||||||
return io;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -79,10 +79,8 @@ bool Foam::IOporosityModelList::read()
|
|||||||
porosityModelList::read(*this);
|
porosityModelList::read(*this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -71,12 +71,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh
|
||||||
IOporosityModelList(const fvMesh& mesh);
|
explicit IOporosityModelList(const fvMesh& mesh);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~IOporosityModelList()
|
virtual ~IOporosityModelList() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -61,17 +61,6 @@ void Foam::porosityModel::adjustNegativeResistance(dimensionedVector& resist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::porosityModel::fieldIndex(const label i) const
|
|
||||||
{
|
|
||||||
label index = 0;
|
|
||||||
if (!coordSys_.R().uniform())
|
|
||||||
{
|
|
||||||
index = i;
|
|
||||||
}
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::porosityModel::porosityModel
|
Foam::porosityModel::porosityModel
|
||||||
@ -101,7 +90,10 @@ Foam::porosityModel::porosityModel
|
|||||||
active_(true),
|
active_(true),
|
||||||
zoneName_(cellZoneName),
|
zoneName_(cellZoneName),
|
||||||
cellZoneIDs_(),
|
cellZoneIDs_(),
|
||||||
coordSys_(*(coordinateSystem::New(mesh, coeffs_)))
|
csysPtr_
|
||||||
|
(
|
||||||
|
coordinateSystem::New(mesh, coeffs_, coordinateSystem::typeName_())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (zoneName_ == word::null)
|
if (zoneName_ == word::null)
|
||||||
{
|
{
|
||||||
@ -123,45 +115,36 @@ Foam::porosityModel::porosityModel
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< incrIndent << indent << coordSys_ << decrIndent << endl;
|
Info<< incrIndent << indent << csys() << decrIndent << endl;
|
||||||
|
|
||||||
const pointField& points = mesh_.points();
|
const pointField& points = mesh_.points();
|
||||||
const cellList& cells = mesh_.cells();
|
const cellList& cells = mesh_.cells();
|
||||||
const faceList& faces = mesh_.faces();
|
const faceList& faces = mesh_.faces();
|
||||||
forAll(cellZoneIDs_, zoneI)
|
|
||||||
{
|
|
||||||
const cellZone& cZone = mesh_.cellZones()[cellZoneIDs_[zoneI]];
|
|
||||||
point bbMin = point::max;
|
|
||||||
point bbMax = point::min;
|
|
||||||
|
|
||||||
forAll(cZone, i)
|
for (const label zonei : cellZoneIDs_)
|
||||||
|
{
|
||||||
|
const cellZone& cZone = mesh_.cellZones()[zonei];
|
||||||
|
|
||||||
|
boundBox bb;
|
||||||
|
|
||||||
|
for (const label celli : cZone)
|
||||||
{
|
{
|
||||||
const label cellI = cZone[i];
|
const cell& c = cells[celli];
|
||||||
const cell& c = cells[cellI];
|
|
||||||
const pointField cellPoints(c.points(faces, points));
|
const pointField cellPoints(c.points(faces, points));
|
||||||
|
|
||||||
forAll(cellPoints, pointI)
|
for (const point& pt : cellPoints)
|
||||||
{
|
{
|
||||||
const point pt = coordSys_.localPosition(cellPoints[pointI]);
|
bb.add(csys().localPosition(pt));
|
||||||
bbMin = min(bbMin, pt);
|
|
||||||
bbMax = max(bbMax, pt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reduce(bbMin, minOp<point>());
|
bb.reduce();
|
||||||
reduce(bbMax, maxOp<point>());
|
|
||||||
|
|
||||||
Info<< " local bounds: " << (bbMax - bbMin) << nl << endl;
|
Info<< " local bounds: " << bb.span() << nl << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::porosityModel::~porosityModel()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::porosityModel::transformModelData()
|
void Foam::porosityModel::transformModelData()
|
||||||
|
|||||||
@ -91,13 +91,12 @@ protected:
|
|||||||
//- Cell zone IDs
|
//- Cell zone IDs
|
||||||
labelList cellZoneIDs_;
|
labelList cellZoneIDs_;
|
||||||
|
|
||||||
//- Local co-ordinate system
|
//- Local coordinate system
|
||||||
coordinateSystem coordSys_;
|
autoPtr<coordinateSystem> csysPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
|
||||||
//- Transform the model data wrt mesh changes
|
//- Transform the model data wrt mesh changes
|
||||||
virtual void calcTransformModelData() = 0;
|
virtual void calcTransformModelData() = 0;
|
||||||
|
|
||||||
@ -128,8 +127,12 @@ protected:
|
|||||||
volTensorField& AU
|
volTensorField& AU
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
//- Local coordinate system
|
||||||
|
inline const coordinateSystem& csys() const;
|
||||||
|
|
||||||
//- Return label index
|
//- Return label index
|
||||||
label fieldIndex(const label index) const;
|
inline label fieldIndex(const label index) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -209,7 +212,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~porosityModel();
|
virtual ~porosityModel() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -23,6 +23,22 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline const Foam::coordinateSystem& Foam::porosityModel::csys() const
|
||||||
|
{
|
||||||
|
return *csysPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::porosityModel::fieldIndex(const label i) const
|
||||||
|
{
|
||||||
|
return (csysPtr_->uniform() ? 0 : i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline const Foam::word& Foam::porosityModel::name() const
|
inline const Foam::word& Foam::porosityModel::name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
|
|||||||
@ -38,33 +38,26 @@ Foam::porosityModelList::porosityModelList
|
|||||||
mesh_(mesh)
|
mesh_(mesh)
|
||||||
{
|
{
|
||||||
reset(dict);
|
reset(dict);
|
||||||
|
|
||||||
active(true);
|
active(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::porosityModelList::~porosityModelList()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::porosityModelList::active(const bool warn) const
|
bool Foam::porosityModelList::active(const bool warn) const
|
||||||
{
|
{
|
||||||
bool a = false;
|
bool anyOk = false;
|
||||||
forAll(*this, i)
|
forAll(*this, i)
|
||||||
{
|
{
|
||||||
a = a || this->operator[](i).active();
|
anyOk = anyOk || this->operator[](i).active();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (warn && this->size() && !a)
|
if (warn && this->size() && !anyOk)
|
||||||
{
|
{
|
||||||
Info<< "No porosity models active" << endl;
|
Info<< "No porosity models active" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return anyOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
// Forward declarations
|
||||||
class porosityModelList;
|
class porosityModelList;
|
||||||
Ostream& operator<<(Ostream& os, const porosityModelList& models);
|
Ostream& operator<<(Ostream& os, const porosityModelList& models);
|
||||||
|
|
||||||
@ -82,13 +82,13 @@ public:
|
|||||||
porosityModelList(const fvMesh& mesh, const dictionary& dict);
|
porosityModelList(const fvMesh& mesh, const dictionary& dict);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~porosityModelList();
|
~porosityModelList() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return active status
|
//- Return active status
|
||||||
bool active(const bool active = false) const;
|
bool active(const bool warn = false) const;
|
||||||
|
|
||||||
//- Reset the source list
|
//- Reset the source list
|
||||||
void reset(const dictionary& dict);
|
void reset(const dictionary& dict);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
|
|||||||
const word& cellZoneName
|
const word& cellZoneName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word modelType(dict.lookup("type"));
|
const word modelType(dict.get<word>("type"));
|
||||||
|
|
||||||
Info<< "Porosity region " << name << ":" << nl
|
Info<< "Porosity region " << name << ":" << nl
|
||||||
<< " selecting model: " << modelType << endl;
|
<< " selecting model: " << modelType << endl;
|
||||||
@ -46,7 +46,7 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
|
|||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unknown " << typeName << " type " << modelType << nl << nl
|
<< "Unknown " << typeName << " type " << modelType << nl << nl
|
||||||
<< "Valid " << typeName << " types are:" << nl
|
<< "Valid types are:" << nl
|
||||||
<< meshConstructorTablePtr_->sortedToc()
|
<< meshConstructorTablePtr_->sortedToc()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,18 +52,12 @@ Foam::porosityModels::powerLaw::powerLaw
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
porosityModel(name, modelType, mesh, dict, cellZoneName),
|
porosityModel(name, modelType, mesh, dict, cellZoneName),
|
||||||
C0_(readScalar(coeffs_.lookup("C0"))),
|
C0_(coeffs_.get<scalar>("C0")),
|
||||||
C1_(readScalar(coeffs_.lookup("C1"))),
|
C1_(coeffs_.get<scalar>("C1")),
|
||||||
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho"))
|
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::porosityModels::powerLaw::~powerLaw()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::porosityModels::powerLaw::calcTransformModelData()
|
void Foam::porosityModels::powerLaw::calcTransformModelData()
|
||||||
@ -100,7 +94,7 @@ void Foam::porosityModels::powerLaw::correct
|
|||||||
|
|
||||||
if (UEqn.dimensions() == dimForce)
|
if (UEqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
const volScalarField& rho = mesh_.lookupObject<volScalarField>
|
const auto& rho = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(rhoName_, U.group())
|
IOobject::groupName(rhoName_, U.group())
|
||||||
);
|
);
|
||||||
@ -139,7 +133,7 @@ void Foam::porosityModels::powerLaw::correct
|
|||||||
|
|
||||||
if (UEqn.dimensions() == dimForce)
|
if (UEqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
const volScalarField& rho = mesh_.lookupObject<volScalarField>
|
const auto& rho = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(rhoName_, U.group())
|
IOobject::groupName(rhoName_, U.group())
|
||||||
);
|
);
|
||||||
|
|||||||
@ -119,7 +119,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~powerLaw();
|
virtual ~powerLaw() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,14 +37,12 @@ void Foam::porosityModels::powerLaw::apply
|
|||||||
const scalar C0 = C0_;
|
const scalar C0 = C0_;
|
||||||
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
|
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
|
||||||
|
|
||||||
forAll(cellZoneIDs_, zoneI)
|
for (const label zonei : cellZoneIDs_)
|
||||||
{
|
{
|
||||||
const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
|
const labelList& cells = mesh_.cellZones()[zonei];
|
||||||
|
|
||||||
forAll(cells, i)
|
for (const label celli : cells)
|
||||||
{
|
{
|
||||||
const label celli = cells[i];
|
|
||||||
|
|
||||||
Udiag[celli] +=
|
Udiag[celli] +=
|
||||||
V[celli]*rho[celli]*C0*pow(magSqr(U[celli]), C1m1b2);
|
V[celli]*rho[celli]*C0*pow(magSqr(U[celli]), C1m1b2);
|
||||||
}
|
}
|
||||||
@ -63,14 +61,12 @@ void Foam::porosityModels::powerLaw::apply
|
|||||||
const scalar C0 = C0_;
|
const scalar C0 = C0_;
|
||||||
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
|
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
|
||||||
|
|
||||||
forAll(cellZoneIDs_, zoneI)
|
for (const label zonei : cellZoneIDs_)
|
||||||
{
|
{
|
||||||
const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
|
const labelList& cells = mesh_.cellZones()[zonei];
|
||||||
|
|
||||||
forAll(cells, i)
|
for (const label celli : cells)
|
||||||
{
|
{
|
||||||
const label celli = cells[i];
|
|
||||||
|
|
||||||
AU[celli] =
|
AU[celli] =
|
||||||
AU[celli] + I*(rho[celli]*C0*pow(magSqr(U[celli]), C1m1b2));
|
AU[celli] + I*(rho[celli]*C0*pow(magSqr(U[celli]), C1m1b2));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,7 @@ void Foam::porosityModels::solidification::correct
|
|||||||
|
|
||||||
if (UEqn.dimensions() == dimForce)
|
if (UEqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
const volScalarField& rho = mesh_.lookupObject<volScalarField>
|
const auto& rho = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(rhoName_, U.group())
|
IOobject::groupName(rhoName_, U.group())
|
||||||
);
|
);
|
||||||
@ -138,7 +138,7 @@ void Foam::porosityModels::solidification::correct
|
|||||||
|
|
||||||
if (UEqn.dimensions() == dimForce)
|
if (UEqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
const volScalarField& rho = mesh_.lookupObject<volScalarField>
|
const auto& rho = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(rhoName_, U.group())
|
IOobject::groupName(rhoName_, U.group())
|
||||||
);
|
);
|
||||||
|
|||||||
@ -63,14 +63,9 @@ Description
|
|||||||
// use the global coordinate system
|
// use the global coordinate system
|
||||||
coordinateSystem
|
coordinateSystem
|
||||||
{
|
{
|
||||||
type cartesian;
|
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
e1 (1 0 0);
|
||||||
{
|
e2 (0 1 0);
|
||||||
type axesRotation;
|
|
||||||
e1 (1 0 0);
|
|
||||||
e2 (0 1 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|||||||
@ -38,18 +38,17 @@ void Foam::porosityModels::solidification::apply
|
|||||||
const volVectorField& U
|
const volVectorField& U
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const volScalarField& T = mesh_.lookupObject<volScalarField>
|
const auto& T = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(TName_, U.group())
|
IOobject::groupName(TName_, U.group())
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(cellZoneIDs_, zoneI)
|
for (const label zonei : cellZoneIDs_)
|
||||||
{
|
{
|
||||||
const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
|
const labelList& cells = mesh_.cellZones()[zonei];
|
||||||
|
|
||||||
forAll(cells, i)
|
for (const label celli : cells)
|
||||||
{
|
{
|
||||||
const label celli = cells[i];
|
|
||||||
Udiag[celli] +=
|
Udiag[celli] +=
|
||||||
V[celli]*alpha[celli]*rho[celli]*D_->value(T[celli]);
|
V[celli]*alpha[celli]*rho[celli]*D_->value(T[celli]);
|
||||||
}
|
}
|
||||||
@ -66,18 +65,17 @@ void Foam::porosityModels::solidification::apply
|
|||||||
const volVectorField& U
|
const volVectorField& U
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const volScalarField& T = mesh_.lookupObject<volScalarField>
|
const auto& T = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(TName_, U.group())
|
IOobject::groupName(TName_, U.group())
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(cellZoneIDs_, zoneI)
|
for (const label zonei : cellZoneIDs_)
|
||||||
{
|
{
|
||||||
const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
|
const labelList& cells = mesh_.cellZones()[zonei];
|
||||||
|
|
||||||
forAll(cells, i)
|
for (const label celli : cells)
|
||||||
{
|
{
|
||||||
const label celli = cells[i];
|
|
||||||
AU[celli] +=
|
AU[celli] +=
|
||||||
tensor::I*alpha[celli]*rho[celli]*D_->value(T[celli]);
|
tensor::I*alpha[celli]*rho[celli]*D_->value(T[celli]);
|
||||||
}
|
}
|
||||||
@ -100,7 +98,7 @@ void Foam::porosityModels::solidification::apply
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const volScalarField& alpha = mesh_.lookupObject<volScalarField>
|
const auto& alpha = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(alphaName_, U.group())
|
IOobject::groupName(alphaName_, U.group())
|
||||||
);
|
);
|
||||||
@ -124,7 +122,7 @@ void Foam::porosityModels::solidification::apply
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const volScalarField& alpha = mesh_.lookupObject<volScalarField>
|
const auto& alpha = mesh_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
IOobject::groupName(alphaName_, U.group())
|
IOobject::groupName(alphaName_, U.group())
|
||||||
);
|
);
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Group
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
This boundary condition describes an inlet vector boundary condition in
|
This boundary condition describes an inlet vector boundary condition in
|
||||||
cylindrical co-ordinates given a central axis, central point, rpm, axial
|
cylindrical coordinates given a central axis, central point, rpm, axial
|
||||||
and radial velocity.
|
and radial velocity.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Description
|
|||||||
\vartable
|
\vartable
|
||||||
p_{hyd} | hyrostatic pressure [Pa]
|
p_{hyd} | hyrostatic pressure [Pa]
|
||||||
p_{ref} | reference pressure [Pa]
|
p_{ref} | reference pressure [Pa]
|
||||||
x_{ref} | reference point in Cartesian co-ordinates
|
x_{ref} | reference point in Cartesian coordinates
|
||||||
\rho | density (assumed uniform)
|
\rho | density (assumed uniform)
|
||||||
g | acceleration due to gravity [m/s2]
|
g | acceleration due to gravity [m/s2]
|
||||||
\endtable
|
\endtable
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Description
|
|||||||
Usage
|
Usage
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
origin | origin of rotation in Cartesian co-ordinates | yes|
|
origin | origin of rotation in Cartesian coordinates | yes|
|
||||||
axis | axis of rotation | yes |
|
axis | axis of rotation | yes |
|
||||||
omega | angular velocty of the frame [rad/s] | yes |
|
omega | angular velocty of the frame [rad/s] | yes |
|
||||||
\endtable
|
\endtable
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Group
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
This boundary condition describes an inlet vector boundary condition in
|
This boundary condition describes an inlet vector boundary condition in
|
||||||
swirl co-ordinates given a central axis, central point, axial, radial and
|
swirl coordinates given a central axis, central point, axial, radial and
|
||||||
tangential velocity profiles.
|
tangential velocity profiles.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
|||||||
@ -42,19 +42,18 @@ SourceFiles
|
|||||||
#include "point.H"
|
#include "point.H"
|
||||||
#include "tensor.H"
|
#include "tensor.H"
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
#include "coordinateSystem.H"
|
#include "boundBox.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declarations
|
||||||
|
class eddy;
|
||||||
class Istream;
|
class Istream;
|
||||||
class Ostream;
|
class Ostream;
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
class eddy;
|
|
||||||
bool operator==(const eddy& a, const eddy& b);
|
bool operator==(const eddy& a, const eddy& b);
|
||||||
bool operator!=(const eddy& a, const eddy& b);
|
bool operator!=(const eddy& a, const eddy& b);
|
||||||
Istream& operator>>(Istream& is, eddy& e);
|
Istream& operator>>(Istream& is, eddy& e);
|
||||||
@ -87,7 +86,7 @@ class eddy
|
|||||||
//- Time-averaged intensity
|
//- Time-averaged intensity
|
||||||
vector alpha_;
|
vector alpha_;
|
||||||
|
|
||||||
//- Co-ordinate system transformation from local to global axes
|
//- Coordinate system transformation from local to global axes
|
||||||
// X-direction aligned with max stress eigenvalue
|
// X-direction aligned with max stress eigenvalue
|
||||||
tensor Rpg_;
|
tensor Rpg_;
|
||||||
|
|
||||||
@ -161,7 +160,7 @@ public:
|
|||||||
//- Return the time-averaged intensity
|
//- Return the time-averaged intensity
|
||||||
inline const vector& alpha() const;
|
inline const vector& alpha() const;
|
||||||
|
|
||||||
//- Return the co-ordinate system transformation from local
|
//- Return the coordinate system transformation from local
|
||||||
// principal to global axes
|
// principal to global axes
|
||||||
inline const tensor& Rpg() const;
|
inline const tensor& Rpg() const;
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Description
|
|||||||
\vartable
|
\vartable
|
||||||
p_{hyd} | hyrostatic pressure [Pa]
|
p_{hyd} | hyrostatic pressure [Pa]
|
||||||
p_{ref} | reference pressure [Pa]
|
p_{ref} | reference pressure [Pa]
|
||||||
x_{ref} | reference point in Cartesian co-ordinates
|
x_{ref} | reference point in Cartesian coordinates
|
||||||
\rho | density (assumed uniform)
|
\rho | density (assumed uniform)
|
||||||
g | acceleration due to gravity [m/s2]
|
g | acceleration due to gravity [m/s2]
|
||||||
\endtable
|
\endtable
|
||||||
|
|||||||
@ -89,7 +89,7 @@ public:
|
|||||||
//- Debug switch
|
//- Debug switch
|
||||||
static int debug;
|
static int debug;
|
||||||
|
|
||||||
//- Tolerance used in calculating barycentric co-ordinates
|
//- Tolerance used in calculating barycentric coordinates
|
||||||
// (applied to normalised values)
|
// (applied to normalised values)
|
||||||
static scalar tol;
|
static scalar tol;
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ public:
|
|||||||
//- Debug switch
|
//- Debug switch
|
||||||
static int debug;
|
static int debug;
|
||||||
|
|
||||||
//- Tolerance used in calculating barycentric co-ordinates
|
//- Tolerance used in calculating barycentric coordinates
|
||||||
// (applied to normalised values)
|
// (applied to normalised values)
|
||||||
static scalar tol;
|
static scalar tol;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,23 +56,19 @@ fieldCoordinateSystemTransform
|
|||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
fieldSet_(mesh_),
|
fieldSet_(mesh_),
|
||||||
coordSys_(mesh_, dict.subDict("coordinateSystem"))
|
csysPtr_
|
||||||
|
(
|
||||||
|
coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_())
|
||||||
|
)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
Info<< type() << " " << name << ":" << nl
|
Info<< type() << " " << name << ":" << nl
|
||||||
<< " Applying transformation from global Cartesian to local "
|
<< " Applying transformation from global Cartesian to local "
|
||||||
<< coordSys_ << nl << endl;
|
<< *csysPtr_ << nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::fieldCoordinateSystemTransform::
|
|
||||||
~fieldCoordinateSystemTransform()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::word
|
Foam::word
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,7 +29,7 @@ Group
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Transforms a user-specified selection of fields from global Cartesian
|
Transforms a user-specified selection of fields from global Cartesian
|
||||||
co-ordinates to a local co-ordinate system. The fields are run-time
|
coordinates to a local coordinate system. The fields are run-time
|
||||||
modifiable.
|
modifiable.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -50,11 +50,11 @@ Usage
|
|||||||
coordinateSystem
|
coordinateSystem
|
||||||
{
|
{
|
||||||
origin (0.001 0 0);
|
origin (0.001 0 0);
|
||||||
coordinateRotation
|
rotation
|
||||||
{
|
{
|
||||||
type axesRotation;
|
type axes;
|
||||||
e1 (1 0.15 0);
|
e1 (1 0.15 0);
|
||||||
e3 (0 0 -1);
|
e3 (0 0 -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ Usage
|
|||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
type | type name: fieldCoordinateSystemTransform | yes |
|
type | type name: fieldCoordinateSystemTransform | yes |
|
||||||
fields | list of fields to be transformed |yes |
|
fields | list of fields to be transformed |yes |
|
||||||
coordinateSystem | local co-ordinate system | yes |
|
coordinateSystem | local coordinate system | yes |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
See also
|
See also
|
||||||
@ -107,8 +107,8 @@ protected:
|
|||||||
//- Fields to transform
|
//- Fields to transform
|
||||||
volFieldSelection fieldSet_;
|
volFieldSelection fieldSet_;
|
||||||
|
|
||||||
//- Co-ordinate system to transform to
|
//- Coordinate system to transform to
|
||||||
coordinateSystem coordSys_;
|
autoPtr<coordinateSystem> csysPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
@ -143,7 +143,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~fieldCoordinateSystemTransform();
|
virtual ~fieldCoordinateSystemTransform() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -41,7 +41,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transformField
|
|||||||
store
|
store
|
||||||
(
|
(
|
||||||
transFieldName,
|
transFieldName,
|
||||||
Foam::transform(dimensionedTensor(coordSys_.R().R()), field)
|
Foam::transform(dimensionedTensor(csysPtr_->R()), field)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,10 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
|
|||||||
<< type() << ": Field " << fieldName << " already in database"
|
<< type() << ": Field " << fieldName << " already in database"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
transformField<VolFieldType>(lookupObject<VolFieldType>(fieldName));
|
transformField<VolFieldType>
|
||||||
|
(
|
||||||
|
lookupObject<VolFieldType>(fieldName)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (foundObject<SurfaceFieldType>(fieldName))
|
else if (foundObject<SurfaceFieldType>(fieldName))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,12 +41,8 @@ functions
|
|||||||
coordinateSystem
|
coordinateSystem
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
e1 (1 0.15 0);
|
||||||
{
|
e3 (0 0 -1);
|
||||||
type axesRotation;
|
|
||||||
e1 (1 0.15 0);
|
|
||||||
e3 (0 0 -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -350,12 +350,19 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
|||||||
const word format(dict.get<word>("setFormat"));
|
const word format(dict.get<word>("setFormat"));
|
||||||
formatterPtr_ = writer<scalar>::New(format);
|
formatterPtr_ = writer<scalar>::New(format);
|
||||||
|
|
||||||
if (dict.found("coordinateSystem"))
|
if (dict.found(coordinateSystem::typeName_()))
|
||||||
{
|
{
|
||||||
coordSysPtr_.reset(new coordinateSystem(obr_, dict));
|
csysPtr_.reset
|
||||||
|
(
|
||||||
|
coordinateSystem::New(obr_, dict, coordinateSystem::typeName_())
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Transforming all vectorFields with coordinate system "
|
Info<< "Transforming all vectorFields with coordinate system "
|
||||||
<< coordSysPtr_().name() << endl;
|
<< csysPtr_->name() << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
csysPtr_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isoPlanes_)
|
if (isoPlanes_)
|
||||||
@ -897,14 +904,14 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
|||||||
volVectorField
|
volVectorField
|
||||||
>(fldName).primitiveField();
|
>(fldName).primitiveField();
|
||||||
|
|
||||||
if (coordSysPtr_.valid())
|
if (csysPtr_.valid())
|
||||||
{
|
{
|
||||||
Log << "Transforming vector field " << fldName
|
Log << "Transforming vector field " << fldName
|
||||||
<< " with coordinate system "
|
<< " with coordinate system "
|
||||||
<< coordSysPtr_().name()
|
<< csysPtr_->name()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
fld = coordSysPtr_().localVector(fld);
|
fld = csysPtr_->localVector(fld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -113,8 +113,8 @@ Usage
|
|||||||
maxDiameter | maximum region equivalent diameter | yes |
|
maxDiameter | maximum region equivalent diameter | yes |
|
||||||
minDiameter | minimum region equivalent diameter | no | 0
|
minDiameter | minimum region equivalent diameter | no | 0
|
||||||
setFormat | writing format | yes |
|
setFormat | writing format | yes |
|
||||||
origin | origin of local co-ordinate system | yes |
|
origin | origin of local coordinate system | yes |
|
||||||
coordinateRoation | orientation of local co-ordinate system | no
|
coordinateRoation | orientation of local coordinate system | no
|
||||||
log | Log to standard output | no | yes
|
log | Log to standard output | no | yes
|
||||||
isoPlanes | switch for isoPlanes | no | false
|
isoPlanes | switch for isoPlanes | no | false
|
||||||
origin | origin of the plane when isoPlanes is used | no | none
|
origin | origin of the plane when isoPlanes is used | no | none
|
||||||
@ -198,7 +198,7 @@ class regionSizeDistribution
|
|||||||
autoPtr<writer<scalar>> formatterPtr_;
|
autoPtr<writer<scalar>> formatterPtr_;
|
||||||
|
|
||||||
//- Optional coordinate system
|
//- Optional coordinate system
|
||||||
autoPtr<coordinateSystem> coordSysPtr_;
|
autoPtr<coordinateSystem> csysPtr_;
|
||||||
|
|
||||||
// Optional extra definition of bins on planes downstream to the origin
|
// Optional extra definition of bins on planes downstream to the origin
|
||||||
// point and maximum diameter
|
// point and maximum diameter
|
||||||
|
|||||||
@ -29,6 +29,7 @@ License
|
|||||||
#include "turbulentTransportModel.H"
|
#include "turbulentTransportModel.H"
|
||||||
#include "turbulentFluidThermoModel.H"
|
#include "turbulentFluidThermoModel.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "cartesianCS.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -37,7 +38,6 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(forces, 0);
|
defineTypeNameAndDebug(forces, 0);
|
||||||
|
|
||||||
addToRunTimeSelectionTable(functionObject, forces, dictionary);
|
addToRunTimeSelectionTable(functionObject, forces, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -857,7 +857,23 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
|||||||
// specified directly, from coordinate system, or implicitly (0 0 0)
|
// specified directly, from coordinate system, or implicitly (0 0 0)
|
||||||
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
|
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
|
||||||
{
|
{
|
||||||
coordSys_ = coordinateSystem(obr_, dict);
|
// The 'coordinateSystem' sub-dictionary is optional,
|
||||||
|
// but enforce use of a cartesian system.
|
||||||
|
|
||||||
|
if (dict.found(coordinateSystem::typeName_()))
|
||||||
|
{
|
||||||
|
// New() for access to indirect (global) coordinate system
|
||||||
|
coordSys_ =
|
||||||
|
coordinateSystem::New
|
||||||
|
(
|
||||||
|
obr_, dict, coordinateSystem::typeName_()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coordSys_ = coordSystem::cartesian(dict);
|
||||||
|
}
|
||||||
|
|
||||||
localSystem_ = true;
|
localSystem_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,21 +32,21 @@ Description
|
|||||||
skin-friction forces over a given list of patches, and the resistance
|
skin-friction forces over a given list of patches, and the resistance
|
||||||
from porous zones.
|
from porous zones.
|
||||||
|
|
||||||
Forces and moments are calculated, with optional co-ordinate system and
|
Forces and moments are calculated, with optional coordinate system and
|
||||||
writing of binned data, where force and moment contributions are collected
|
writing of binned data, where force and moment contributions are collected
|
||||||
into a user-defined number of bins that span the input geometries for a
|
into a user-defined number of bins that span the input geometries for a
|
||||||
user-defined direction vector.
|
user-defined direction vector.
|
||||||
|
|
||||||
Data is written into multiple files in the
|
Data is written into multiple files in the
|
||||||
postProcessing/\<functionObjectName\> directory:
|
postProcessing/\<functionObjectName\> directory:
|
||||||
- force.dat : forces in global Cartesian co-ordinate system
|
- force.dat : forces in global Cartesian coordinate system
|
||||||
- moment.dat : moments in global Cartesian co-ordinate system
|
- moment.dat : moments in global Cartesian coordinate system
|
||||||
- forceBin.dat : force bins in global Cartesian co-ordinate system
|
- forceBin.dat : force bins in global Cartesian coordinate system
|
||||||
- momentBin.dat : moment bins in global Cartesian co-ordinate system
|
- momentBin.dat : moment bins in global Cartesian coordinate system
|
||||||
- localForce.dat : forces in local co-ordinate system
|
- localForce.dat : forces in local Cartesian coordinate system
|
||||||
- localMoment.dat : moments in local co-ordinate system
|
- localMoment.dat : moments in local Cartesian coordinate system
|
||||||
- localForceBin.dat : force bins in local co-ordinate system
|
- localForceBin.dat : force bins in local Cartesian coordinate system
|
||||||
- localMomentBin.dat : moment bins in local co-ordinate system
|
- localMomentBin.dat : moment bins in local Cartesian coordinate system
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
Example of function object specification:
|
Example of function object specification:
|
||||||
@ -107,13 +107,19 @@ Note
|
|||||||
CofR (0 0 0);
|
CofR (0 0 0);
|
||||||
\endverbatim
|
\endverbatim
|
||||||
or
|
or
|
||||||
|
\verbatim
|
||||||
|
origin (0 0 0);
|
||||||
|
e1 (0 1 0);
|
||||||
|
e3 (0 0 1);
|
||||||
|
\endverbatim
|
||||||
|
or
|
||||||
\verbatim
|
\verbatim
|
||||||
coordinateSystem
|
coordinateSystem
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
rotation
|
||||||
{
|
{
|
||||||
type axesRotation;
|
type axes;
|
||||||
e3 (0 0 1);
|
e3 (0 0 1);
|
||||||
e1 (1 0 0);
|
e1 (1 0 0);
|
||||||
}
|
}
|
||||||
@ -136,7 +142,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fvMeshFunctionObject.H"
|
||||||
#include "writeFile.H"
|
#include "writeFile.H"
|
||||||
#include "coordinateSystem.H"
|
#include "cartesianCS.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
@ -224,9 +230,9 @@ protected:
|
|||||||
scalar pRef_;
|
scalar pRef_;
|
||||||
|
|
||||||
//- Coordinate system used when evaluting forces/moments
|
//- Coordinate system used when evaluting forces/moments
|
||||||
coordinateSystem coordSys_;
|
coordSystem::cartesian coordSys_;
|
||||||
|
|
||||||
//- Flag to indicate whether we are using a local co-ordinate sys
|
//- Flag to indicate whether we are using a local coordinates
|
||||||
bool localSystem_;
|
bool localSystem_;
|
||||||
|
|
||||||
//- Flag to include porosity effects
|
//- Flag to include porosity effects
|
||||||
|
|||||||
@ -44,14 +44,9 @@ Usage
|
|||||||
|
|
||||||
coordinateSystem
|
coordinateSystem
|
||||||
{
|
{
|
||||||
type cartesian;
|
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
e1 (0.70710678 0.70710678 0);
|
||||||
{
|
e2 (0 0 1);
|
||||||
type axesRotation;
|
|
||||||
e1 (0.70710678 0.70710678 0);
|
|
||||||
e2 (0 0 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -53,16 +53,16 @@ const Foam::word Foam::fv::jouleHeatingSource::sigmaName(typeName + ":sigma");
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::coordinateSystem& Foam::fv::jouleHeatingSource::coordSys() const
|
const Foam::coordinateSystem& Foam::fv::jouleHeatingSource::csys() const
|
||||||
{
|
{
|
||||||
if (!coordSysPtr_.valid())
|
if (!csysPtr_ || !csysPtr_.valid())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Co-ordinate system invalid"
|
<< "Coordinate system invalid"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *coordSysPtr_;
|
return *csysPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,10 +87,18 @@ Foam::fv::jouleHeatingSource::transformSigma
|
|||||||
dimensionedSymmTensor(sigmaLocal.dimensions(), Zero),
|
dimensionedSymmTensor(sigmaLocal.dimensions(), Zero),
|
||||||
zeroGradientFvPatchField<symmTensor>::typeName
|
zeroGradientFvPatchField<symmTensor>::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
auto& sigma = tsigma.ref();
|
auto& sigma = tsigma.ref();
|
||||||
|
|
||||||
sigma.primitiveFieldRef() = coordSys().R().transformVector(sigmaLocal);
|
if (csys().uniform())
|
||||||
|
{
|
||||||
|
sigma.primitiveFieldRef() =
|
||||||
|
csys().transformPrincipal(sigmaLocal);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sigma.primitiveFieldRef() =
|
||||||
|
csys().transformPrincipal(mesh_.cellCentres(), sigmaLocal);
|
||||||
|
}
|
||||||
|
|
||||||
sigma.correctBoundaryConditions();
|
sigma.correctBoundaryConditions();
|
||||||
|
|
||||||
@ -125,7 +133,7 @@ Foam::fv::jouleHeatingSource::jouleHeatingSource
|
|||||||
anisotropicElectricalConductivity_(false),
|
anisotropicElectricalConductivity_(false),
|
||||||
scalarSigmaVsTPtr_(nullptr),
|
scalarSigmaVsTPtr_(nullptr),
|
||||||
vectorSigmaVsTPtr_(nullptr),
|
vectorSigmaVsTPtr_(nullptr),
|
||||||
coordSysPtr_(nullptr),
|
csysPtr_(nullptr),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{
|
{
|
||||||
// Set the field name to that of the energy field from which the temperature
|
// Set the field name to that of the energy field from which the temperature
|
||||||
@ -223,7 +231,14 @@ bool Foam::fv::jouleHeatingSource::read(const dictionary& dict)
|
|||||||
Info<< " Using vector electrical conductivity" << endl;
|
Info<< " Using vector electrical conductivity" << endl;
|
||||||
|
|
||||||
initialiseSigma(coeffs_, vectorSigmaVsTPtr_);
|
initialiseSigma(coeffs_, vectorSigmaVsTPtr_);
|
||||||
coordSysPtr_ = coordinateSystem::New(mesh_, coeffs_);
|
|
||||||
|
csysPtr_ =
|
||||||
|
coordinateSystem::New
|
||||||
|
(
|
||||||
|
mesh_,
|
||||||
|
coeffs_,
|
||||||
|
coordinateSystem::typeName_()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -91,15 +91,9 @@ Usage
|
|||||||
|
|
||||||
coordinateSystem
|
coordinateSystem
|
||||||
{
|
{
|
||||||
type cartesian;
|
origin (0 0 0);
|
||||||
origin (0 0 0);
|
e1 (1 0 0);
|
||||||
|
e3 (0 0 1);
|
||||||
coordinateRotation
|
|
||||||
{
|
|
||||||
type axesRotation;
|
|
||||||
e1 (1 0 0);
|
|
||||||
e3 (0 0 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optionally specify sigma as a function of temperature
|
// Optionally specify sigma as a function of temperature
|
||||||
@ -179,8 +173,8 @@ class jouleHeatingSource
|
|||||||
//- Electrical conductivity as a vector function of temperature
|
//- Electrical conductivity as a vector function of temperature
|
||||||
autoPtr<Function1<vector>> vectorSigmaVsTPtr_;
|
autoPtr<Function1<vector>> vectorSigmaVsTPtr_;
|
||||||
|
|
||||||
//- Co-ordinate system - used for vectorial electrical conductivity
|
//- Coordinate system - used for vectorial electrical conductivity
|
||||||
autoPtr<coordinateSystem> coordSysPtr_;
|
autoPtr<coordinateSystem> csysPtr_;
|
||||||
|
|
||||||
//- Current time index (used for updating)
|
//- Current time index (used for updating)
|
||||||
label curTimeIndex_;
|
label curTimeIndex_;
|
||||||
@ -194,9 +188,8 @@ class jouleHeatingSource
|
|||||||
//- No copy assignment
|
//- No copy assignment
|
||||||
void operator=(const jouleHeatingSource&) = delete;
|
void operator=(const jouleHeatingSource&) = delete;
|
||||||
|
|
||||||
//- Return the co-ordinate system for anisotropic electrical
|
//- The coordinate system for anisotropic electrical conductivity
|
||||||
// conductivity
|
const coordinateSystem& csys() const;
|
||||||
const coordinateSystem& coordSys() const;
|
|
||||||
|
|
||||||
//- Transform the anisotropic electrical conductivity into global system
|
//- Transform the anisotropic electrical conductivity into global system
|
||||||
tmp<volSymmTensorField> transformSigma
|
tmp<volSymmTensorField> transformSigma
|
||||||
|
|||||||
@ -91,7 +91,7 @@ void Foam::fv::rotorDiskSource::checkData()
|
|||||||
case ifSurfaceNormal:
|
case ifSurfaceNormal:
|
||||||
{
|
{
|
||||||
scalar UIn(coeffs_.get<scalar>("inletNormalVelocity"));
|
scalar UIn(coeffs_.get<scalar>("inletNormalVelocity"));
|
||||||
inletVelocity_ = -coordSys_.R().e3()*UIn;
|
inletVelocity_ = -coordSys_.e3()*UIn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ifLocal:
|
case ifLocal:
|
||||||
@ -333,17 +333,6 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
|||||||
|
|
||||||
coeffs_.readEntry("refDirection", refDir);
|
coeffs_.readEntry("refDirection", refDir);
|
||||||
|
|
||||||
cylindrical_.reset
|
|
||||||
(
|
|
||||||
new cylindrical
|
|
||||||
(
|
|
||||||
mesh_,
|
|
||||||
axis,
|
|
||||||
origin,
|
|
||||||
cells_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Set the face areas and apply correction to calculated axis
|
// Set the face areas and apply correction to calculated axis
|
||||||
// e.g. if cellZone is more than a single layer in thickness
|
// e.g. if cellZone is more than a single layer in thickness
|
||||||
setFaceArea(axis, true);
|
setFaceArea(axis, true);
|
||||||
@ -356,17 +345,6 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
|||||||
coeffs_.readEntry("axis", axis);
|
coeffs_.readEntry("axis", axis);
|
||||||
coeffs_.readEntry("refDirection", refDir);
|
coeffs_.readEntry("refDirection", refDir);
|
||||||
|
|
||||||
cylindrical_.reset
|
|
||||||
(
|
|
||||||
new cylindrical
|
|
||||||
(
|
|
||||||
mesh_,
|
|
||||||
axis,
|
|
||||||
origin,
|
|
||||||
cells_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
setFaceArea(axis, false);
|
setFaceArea(axis, false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -381,7 +359,7 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
coordSys_ = cylindricalCS("rotorCoordSys", origin, axis, refDir, false);
|
coordSys_ = coordSystem::cylindrical(origin, axis, refDir);
|
||||||
|
|
||||||
const scalar sumArea = gSum(area_);
|
const scalar sumArea = gSum(area_);
|
||||||
const scalar diameter = Foam::sqrt(4.0*sumArea/mathematical::pi);
|
const scalar diameter = Foam::sqrt(4.0*sumArea/mathematical::pi);
|
||||||
@ -389,24 +367,25 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
|||||||
<< " - disk diameter = " << diameter << nl
|
<< " - disk diameter = " << diameter << nl
|
||||||
<< " - disk area = " << sumArea << nl
|
<< " - disk area = " << sumArea << nl
|
||||||
<< " - origin = " << coordSys_.origin() << nl
|
<< " - origin = " << coordSys_.origin() << nl
|
||||||
<< " - r-axis = " << coordSys_.R().e1() << nl
|
<< " - r-axis = " << coordSys_.e1() << nl
|
||||||
<< " - psi-axis = " << coordSys_.R().e2() << nl
|
<< " - psi-axis = " << coordSys_.e2() << nl
|
||||||
<< " - z-axis = " << coordSys_.R().e3() << endl;
|
<< " - z-axis = " << coordSys_.e3() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fv::rotorDiskSource::constructGeometry()
|
void Foam::fv::rotorDiskSource::constructGeometry()
|
||||||
{
|
{
|
||||||
const vectorField& C = mesh_.C();
|
const pointUIndList cc(mesh_.C(), cells_);
|
||||||
|
|
||||||
|
// Optional: for later transform(), invTransform()
|
||||||
|
/// Rcyl_.reset(coordSys_.R(cc).ptr());
|
||||||
|
|
||||||
forAll(cells_, i)
|
forAll(cells_, i)
|
||||||
{
|
{
|
||||||
if (area_[i] > ROOTVSMALL)
|
if (area_[i] > ROOTVSMALL)
|
||||||
{
|
{
|
||||||
const label celli = cells_[i];
|
|
||||||
|
|
||||||
// Position in (planar) rotor coordinate system
|
// Position in (planar) rotor coordinate system
|
||||||
x_[i] = coordSys_.localPosition(C[celli]);
|
x_[i] = coordSys_.localPosition(cc[i]);
|
||||||
|
|
||||||
// Cache max radius
|
// Cache max radius
|
||||||
rMax_ = max(rMax_, x_[i].x());
|
rMax_ = max(rMax_, x_[i].x());
|
||||||
@ -422,8 +401,7 @@ void Foam::fv::rotorDiskSource::constructGeometry()
|
|||||||
// rotor cone system
|
// rotor cone system
|
||||||
scalar c = cos(beta);
|
scalar c = cos(beta);
|
||||||
scalar s = sin(beta);
|
scalar s = sin(beta);
|
||||||
R_[i] = tensor(c, 0, -s, 0, 1, 0, s, 0, c);
|
Rcone_[i] = tensor(c, 0, -s, 0, 1, 0, s, 0, c);
|
||||||
invR_[i] = R_[i].T();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -480,11 +458,9 @@ Foam::fv::rotorDiskSource::rotorDiskSource
|
|||||||
tipEffect_(1.0),
|
tipEffect_(1.0),
|
||||||
flap_(),
|
flap_(),
|
||||||
x_(cells_.size(), Zero),
|
x_(cells_.size(), Zero),
|
||||||
R_(cells_.size(), I),
|
Rcone_(cells_.size(), I),
|
||||||
invR_(cells_.size(), I),
|
area_(cells_.size(), Zero),
|
||||||
area_(cells_.size(), 0.0),
|
coordSys_(),
|
||||||
coordSys_(false),
|
|
||||||
cylindrical_(),
|
|
||||||
rMax_(0.0),
|
rMax_(0.0),
|
||||||
trim_(trimModel::New(*this, coeffs_)),
|
trim_(trimModel::New(*this, coeffs_)),
|
||||||
blade_(coeffs_.subDict("blade")),
|
blade_(coeffs_.subDict("blade")),
|
||||||
|
|||||||
@ -102,7 +102,6 @@ SourceFiles
|
|||||||
|
|
||||||
#include "cellSetOption.H"
|
#include "cellSetOption.H"
|
||||||
#include "cylindricalCS.H"
|
#include "cylindricalCS.H"
|
||||||
#include "cylindrical.H"
|
|
||||||
#include "Enum.H"
|
#include "Enum.H"
|
||||||
#include "bladeModel.H"
|
#include "bladeModel.H"
|
||||||
#include "profileModelList.H"
|
#include "profileModelList.H"
|
||||||
@ -184,23 +183,20 @@ protected:
|
|||||||
flapData flap_;
|
flapData flap_;
|
||||||
|
|
||||||
//- Cell centre positions in local rotor frame
|
//- Cell centre positions in local rotor frame
|
||||||
// (Cylindrical r, theta, z)
|
// (Cylindrical r-theta-z)
|
||||||
List<point> x_;
|
List<point> x_;
|
||||||
|
|
||||||
//- Rotation tensor for flap angle
|
//- Rotation tensor for flap angle
|
||||||
List<tensor> R_;
|
List<tensor> Rcone_;
|
||||||
|
|
||||||
//- Inverse rotation tensor for flap angle
|
|
||||||
List<tensor> invR_;
|
|
||||||
|
|
||||||
//- Area [m2]
|
//- Area [m2]
|
||||||
List<scalar> area_;
|
List<scalar> area_;
|
||||||
|
|
||||||
//- Rotor local cylindrical coordinate system (r, theta, z)
|
//- Rotor local cylindrical coordinate system (r-theta-z)
|
||||||
cylindricalCS coordSys_;
|
coordSystem::cylindrical coordSys_;
|
||||||
|
|
||||||
//- Rotor transformation coordinate system
|
//- Cached rotation tensors for cylindrical coordinates
|
||||||
autoPtr<cylindrical> cylindrical_;
|
autoPtr<tensorField> Rcyl_;
|
||||||
|
|
||||||
//- Maximum radius
|
//- Maximum radius
|
||||||
scalar rMax_;
|
scalar rMax_;
|
||||||
@ -276,11 +272,11 @@ public:
|
|||||||
inline scalar omega() const;
|
inline scalar omega() const;
|
||||||
|
|
||||||
//- Return the cell centre positions in local rotor frame
|
//- Return the cell centre positions in local rotor frame
|
||||||
// (Cylindrical r, theta, z)
|
// (Cylindrical r-theta-z)
|
||||||
inline const List<point>& x() const;
|
inline const List<point>& x() const;
|
||||||
|
|
||||||
//- Return the rotor coordinate system (r, theta, z)
|
//- Return the rotor coordinate system (r-theta-z)
|
||||||
inline const cylindricalCS& coordSys() const;
|
inline const coordSystem::cylindrical& coordSys() const;
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|||||||
@ -27,25 +27,26 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::scalar Foam::fv::rotorDiskSource::rhoRef() const
|
inline Foam::scalar Foam::fv::rotorDiskSource::rhoRef() const
|
||||||
{
|
{
|
||||||
return rhoRef_;
|
return rhoRef_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::fv::rotorDiskSource::omega() const
|
inline Foam::scalar Foam::fv::rotorDiskSource::omega() const
|
||||||
{
|
{
|
||||||
return omega_;
|
return omega_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::List<Foam::point>& Foam::fv::rotorDiskSource::x() const
|
inline const Foam::List<Foam::point>& Foam::fv::rotorDiskSource::x() const
|
||||||
{
|
{
|
||||||
return x_;
|
return x_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::cylindricalCS& Foam::fv::rotorDiskSource::coordSys() const
|
inline const Foam::coordSystem::cylindrical&
|
||||||
|
Foam::fv::rotorDiskSource::coordSys() const
|
||||||
{
|
{
|
||||||
return coordSys_;
|
return coordSys_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -50,6 +50,9 @@ void Foam::fv::rotorDiskSource::calculate
|
|||||||
scalar AOAmin = GREAT;
|
scalar AOAmin = GREAT;
|
||||||
scalar AOAmax = -GREAT;
|
scalar AOAmax = -GREAT;
|
||||||
|
|
||||||
|
// Cached position-dependent rotations available?
|
||||||
|
const bool hasCache = Rcyl_.valid();
|
||||||
|
|
||||||
forAll(cells_, i)
|
forAll(cells_, i)
|
||||||
{
|
{
|
||||||
if (area_[i] > ROOTVSMALL)
|
if (area_[i] > ROOTVSMALL)
|
||||||
@ -58,11 +61,18 @@ void Foam::fv::rotorDiskSource::calculate
|
|||||||
|
|
||||||
const scalar radius = x_[i].x();
|
const scalar radius = x_[i].x();
|
||||||
|
|
||||||
|
const tensor Rcyl =
|
||||||
|
(
|
||||||
|
hasCache
|
||||||
|
? (*Rcyl_)[i]
|
||||||
|
: coordSys_.R(mesh_.C()[celli])
|
||||||
|
);
|
||||||
|
|
||||||
// Transform velocity into local cylindrical reference frame
|
// Transform velocity into local cylindrical reference frame
|
||||||
vector Uc = cylindrical_->invTransform(U[celli], i);
|
vector Uc = invTransform(Rcyl, U[celli]);
|
||||||
|
|
||||||
// Transform velocity into local coning system
|
// Transform velocity into local coning system
|
||||||
Uc = R_[i] & Uc;
|
Uc = transform(Rcone_[i], Uc);
|
||||||
|
|
||||||
// Set radial component of velocity to zero
|
// Set radial component of velocity to zero
|
||||||
Uc.x() = 0.0;
|
Uc.x() = 0.0;
|
||||||
@ -129,10 +139,10 @@ void Foam::fv::rotorDiskSource::calculate
|
|||||||
liftEff += rhoRef_*localForce.z();
|
liftEff += rhoRef_*localForce.z();
|
||||||
|
|
||||||
// Transform force from local coning system into rotor cylindrical
|
// Transform force from local coning system into rotor cylindrical
|
||||||
localForce = invR_[i] & localForce;
|
localForce = invTransform(Rcone_[i], localForce);
|
||||||
|
|
||||||
// Transform force into global Cartesian co-ordinate system
|
// Transform force into global Cartesian coordinate system
|
||||||
force[celli] = cylindrical_->transform(localForce, i);
|
force[celli] = transform(Rcyl, localForce);
|
||||||
|
|
||||||
if (divideVolume)
|
if (divideVolume)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -57,9 +57,9 @@ Foam::vector Foam::targetCoeffTrim::calcCoeffs
|
|||||||
const List<point>& x = rotor_.x();
|
const List<point>& x = rotor_.x();
|
||||||
|
|
||||||
const vector& origin = rotor_.coordSys().origin();
|
const vector& origin = rotor_.coordSys().origin();
|
||||||
const vector& rollAxis = rotor_.coordSys().R().e1();
|
const vector& rollAxis = rotor_.coordSys().e1();
|
||||||
const vector& pitchAxis = rotor_.coordSys().R().e2();
|
const vector& pitchAxis = rotor_.coordSys().e2();
|
||||||
const vector& yawAxis = rotor_.coordSys().R().e3();
|
const vector& yawAxis = rotor_.coordSys().e3();
|
||||||
|
|
||||||
scalar coeff1 = alpha_*sqr(rotor_.omega())*mathematical::pi;
|
scalar coeff1 = alpha_*sqr(rotor_.omega())*mathematical::pi;
|
||||||
|
|
||||||
|
|||||||
@ -43,13 +43,9 @@ Description
|
|||||||
|
|
||||||
coordinateSystem
|
coordinateSystem
|
||||||
{
|
{
|
||||||
origin (0 0 0);
|
origin (0 0 0);
|
||||||
coordinateRotation
|
e1 (0.70710678 0.70710678 0);
|
||||||
{
|
e2 (0 0 1);
|
||||||
type axesRotation;
|
|
||||||
e1 (0.70710678 0.70710678 0);
|
|
||||||
e2 (0 0 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ Foam::injectedParticle::injectedParticle
|
|||||||
if (readFields)
|
if (readFields)
|
||||||
{
|
{
|
||||||
// After the base particle class has read the fields from file and
|
// After the base particle class has read the fields from file and
|
||||||
// constructed the necessary barycentric co-ordinates we can update the
|
// constructed the necessary barycentric coordinates we can update the
|
||||||
// particle position on this mesh
|
// particle position on this mesh
|
||||||
position_ = particle::position();
|
position_ = particle::position();
|
||||||
|
|
||||||
|
|||||||
@ -207,7 +207,7 @@ void Foam::ParticleCollector<CloudType>::initConcentricCircles()
|
|||||||
faces_.setSize(nFace);
|
faces_.setSize(nFace);
|
||||||
area_.setSize(nFace);
|
area_.setSize(nFace);
|
||||||
|
|
||||||
coordSys_ = cylindricalCS("coordSys", origin, normal_[0], refDir, false);
|
coordSys_ = coordSystem::cylindrical(origin, normal_[0], refDir);
|
||||||
|
|
||||||
List<label> ptIDs(identity(nPointPerRadius));
|
List<label> ptIDs(identity(nPointPerRadius));
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ void Foam::ParticleCollector<CloudType>::collectParcelConcentricCircles
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intersection point in cylindrical co-ordinate system
|
// Intersection point in cylindrical coordinate system
|
||||||
const point pCyl = coordSys_.localPosition(p1 + (d1/(d1 - d2))*(p2 - p1));
|
const point pCyl = coordSys_.localPosition(p1 + (d1/(d1 - d2))*(p2 - p1));
|
||||||
|
|
||||||
scalar r = pCyl[0];
|
scalar r = pCyl[0];
|
||||||
@ -539,7 +539,7 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
|
|||||||
faceTris_(),
|
faceTris_(),
|
||||||
nSector_(0),
|
nSector_(0),
|
||||||
radius_(),
|
radius_(),
|
||||||
coordSys_(false),
|
coordSys_(),
|
||||||
normal_(),
|
normal_(),
|
||||||
negateParcelsOppositeNormal_
|
negateParcelsOppositeNormal_
|
||||||
(
|
(
|
||||||
|
|||||||
@ -160,8 +160,8 @@ private:
|
|||||||
//- List of radii
|
//- List of radii
|
||||||
List<scalar> radius_;
|
List<scalar> radius_;
|
||||||
|
|
||||||
//- Cylindrical co-ordinate system
|
//- Cylindrical coordinate system
|
||||||
cylindricalCS coordSys_;
|
coordSystem::cylindrical coordSys_;
|
||||||
|
|
||||||
|
|
||||||
//- Face areas
|
//- Face areas
|
||||||
|
|||||||
@ -42,7 +42,7 @@ Description
|
|||||||
|
|
||||||
where:
|
where:
|
||||||
\plaintable
|
\plaintable
|
||||||
x, y, z | global cartesian co-ordinates [m]
|
x, y, z | global cartesian coordinates [m]
|
||||||
u, v, w | global cartesian velocity components [m/s]
|
u, v, w | global cartesian velocity components [m/s]
|
||||||
d | diameter [m]
|
d | diameter [m]
|
||||||
rho | density [kg/m3]
|
rho | density [kg/m3]
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Description
|
|||||||
);
|
);
|
||||||
|
|
||||||
where:
|
where:
|
||||||
x, y, z = global cartesian co-ordinates [m]
|
x, y, z = global cartesian coordinates [m]
|
||||||
u, v, w = global cartesian velocity components [m/s]
|
u, v, w = global cartesian velocity components [m/s]
|
||||||
d = diameter [m]
|
d = diameter [m]
|
||||||
rho = density [kg/m3]
|
rho = density [kg/m3]
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Description
|
|||||||
);
|
);
|
||||||
|
|
||||||
where:
|
where:
|
||||||
x, y, z = global cartesian co-ordinates [m]
|
x, y, z = global cartesian coordinates [m]
|
||||||
u, v, w = global cartesian velocity components [m/s]
|
u, v, w = global cartesian velocity components [m/s]
|
||||||
d = diameter [m]
|
d = diameter [m]
|
||||||
rho = density [kg/m3]
|
rho = density [kg/m3]
|
||||||
|
|||||||
@ -39,7 +39,7 @@ Description
|
|||||||
);
|
);
|
||||||
|
|
||||||
where:
|
where:
|
||||||
x, y, z = global cartesian co-ordinates [m]
|
x, y, z = global cartesian coordinates [m]
|
||||||
u, v, w = global cartesian velocity components [m/s]
|
u, v, w = global cartesian velocity components [m/s]
|
||||||
d = diameter [m]
|
d = diameter [m]
|
||||||
rho = density [kg/m3]
|
rho = density [kg/m3]
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "lumpedPointState.H"
|
#include "lumpedPointState.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "axesRotation.H"
|
#include "axesRotation.H"
|
||||||
|
#include "coordinateSystem.H"
|
||||||
#include "foamVtkOutput.H"
|
#include "foamVtkOutput.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -183,14 +183,17 @@ void Foam::lumpedPointState::writeVTP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Standard corners in local axis
|
// Standard corners in local axis
|
||||||
const axesRotation cornerTransform(axis);
|
|
||||||
|
|
||||||
FixedList<point, 4> corners;
|
FixedList<point, 4> corners;
|
||||||
forAll(standardCorners, corni)
|
|
||||||
{
|
|
||||||
corners[corni] = cornerTransform.transform(standardCorners[corni]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
{
|
||||||
|
coordinateRotations::axes orient(axis);
|
||||||
|
coordinateSystem cornerTransform(orient);
|
||||||
|
|
||||||
|
forAll(standardCorners, corni)
|
||||||
|
{
|
||||||
|
corners[corni] = cornerTransform.transform(standardCorners[corni]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Planes to visualize location/rotation
|
// Planes to visualize location/rotation
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace blockEdges
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::cylindricalCS Foam::blockEdges::arcEdge::calcAngle()
|
Foam::coordSystem::cylindrical Foam::blockEdges::arcEdge::calcAngle()
|
||||||
{
|
{
|
||||||
const vector a = p2_ - p1_;
|
const vector a = p2_ - p1_;
|
||||||
const vector b = p3_ - p1_;
|
const vector b = p3_ - p1_;
|
||||||
@ -98,8 +98,8 @@ Foam::cylindricalCS Foam::blockEdges::arcEdge::calcAngle()
|
|||||||
|
|
||||||
radius_ = mag(r3);
|
radius_ = mag(r3);
|
||||||
|
|
||||||
// The corresponding local cylindrical coordinate system (degrees)
|
// The corresponding local cylindrical coordinate system (radians)
|
||||||
return cylindricalCS("arcEdgeCS", centre, arcAxis, r1, true);
|
return coordSystem::cylindrical("arc", centre, arcAxis, r1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,13 +158,14 @@ Foam::point Foam::blockEdges::arcEdge::position(const scalar lambda) const
|
|||||||
return p3_;
|
return p3_;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cs_.globalPosition(vector(radius_, lambda*angle_, 0.0));
|
// The angle is degrees, the coordinate system in radians
|
||||||
|
return cs_.globalPosition(vector(radius_, degToRad(lambda*angle_), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::blockEdges::arcEdge::length() const
|
Foam::scalar Foam::blockEdges::arcEdge::length() const
|
||||||
{
|
{
|
||||||
return degToRad(angle_*radius_);
|
return degToRad(radius_*angle_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -64,15 +64,15 @@ class arcEdge
|
|||||||
//- The arc radius
|
//- The arc radius
|
||||||
scalar radius_;
|
scalar radius_;
|
||||||
|
|
||||||
//- The local cylindrical coordinate system (degrees)
|
//- The local cylindrical coordinate system
|
||||||
cylindricalCS cs_;
|
coordSystem::cylindrical cs_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Calculate the angle, radius and axis
|
//- Calculate the angle, radius and axis
|
||||||
// \return the coordinate system
|
// \return the cylindrical coordinate system
|
||||||
cylindricalCS calcAngle();
|
coordSystem::cylindrical calcAngle();
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
arcEdge(const arcEdge&) = delete;
|
arcEdge(const arcEdge&) = delete;
|
||||||
|
|||||||
@ -59,17 +59,20 @@ cellFeatures/cellFeatures.C
|
|||||||
csys = coordinate/systems
|
csys = coordinate/systems
|
||||||
$(csys)/coordinateSystem.C
|
$(csys)/coordinateSystem.C
|
||||||
$(csys)/coordinateSystemNew.C
|
$(csys)/coordinateSystemNew.C
|
||||||
|
$(csys)/coordinateSystemTransform.C
|
||||||
$(csys)/coordinateSystems.C
|
$(csys)/coordinateSystems.C
|
||||||
$(csys)/cylindricalCS.C
|
|
||||||
$(csys)/cartesianCS.C
|
$(csys)/cartesianCS.C
|
||||||
|
$(csys)/cylindricalCS.C
|
||||||
|
$(csys)/indirectCS.C
|
||||||
|
|
||||||
crot = coordinate/rotation
|
crot = coordinate/rotation
|
||||||
$(crot)/axesRotation.C
|
$(crot)/axesRotation.C
|
||||||
|
$(crot)/axisAngleRotation.C
|
||||||
$(crot)/coordinateRotation.C
|
$(crot)/coordinateRotation.C
|
||||||
$(crot)/coordinateRotationNew.C
|
$(crot)/cylindricalRotation.C
|
||||||
|
$(crot)/identityRotation.C
|
||||||
$(crot)/EulerCoordinateRotation.C
|
$(crot)/EulerCoordinateRotation.C
|
||||||
$(crot)/STARCDCoordinateRotation.C
|
$(crot)/STARCDCoordinateRotation.C
|
||||||
$(crot)/cylindrical.C
|
|
||||||
|
|
||||||
polyMeshZipUpCells/polyMeshZipUpCells.C
|
polyMeshZipUpCells/polyMeshZipUpCells.C
|
||||||
primitiveMeshGeometry/primitiveMeshGeometry.C
|
primitiveMeshGeometry/primitiveMeshGeometry.C
|
||||||
|
|||||||
@ -31,24 +31,34 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(EulerCoordinateRotation, 0);
|
namespace coordinateRotations
|
||||||
addToRunTimeSelectionTable
|
{
|
||||||
(
|
defineTypeName(euler);
|
||||||
coordinateRotation,
|
|
||||||
EulerCoordinateRotation,
|
// Standard short name
|
||||||
dictionary
|
addNamedToRunTimeSelectionTable
|
||||||
);
|
(
|
||||||
addToRunTimeSelectionTable
|
coordinateRotation,
|
||||||
(
|
euler,
|
||||||
coordinateRotation,
|
dictionary,
|
||||||
EulerCoordinateRotation,
|
euler
|
||||||
objectRegistry
|
);
|
||||||
);
|
|
||||||
|
// Longer name - Compat 1806
|
||||||
|
addNamedToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
coordinateRotation,
|
||||||
|
euler,
|
||||||
|
dictionary,
|
||||||
|
EulerRotation
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tensor Foam::EulerCoordinateRotation::rotation
|
Foam::tensor Foam::coordinateRotations::euler::rotation
|
||||||
(
|
(
|
||||||
const vector& angles,
|
const vector& angles,
|
||||||
bool degrees
|
bool degrees
|
||||||
@ -84,174 +94,96 @@ Foam::tensor Foam::EulerCoordinateRotation::rotation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * 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 nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::EulerCoordinateRotation::invTransform
|
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return 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 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 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation()
|
Foam::coordinateRotations::euler::euler()
|
||||||
:
|
:
|
||||||
R_(sphericalTensor::I),
|
coordinateRotation(),
|
||||||
Rtr_(sphericalTensor::I)
|
angles_(Zero),
|
||||||
|
degrees_(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
Foam::coordinateRotations::euler::euler(const euler& crot)
|
||||||
(
|
|
||||||
const EulerCoordinateRotation& r
|
|
||||||
)
|
|
||||||
:
|
:
|
||||||
R_(r.R_),
|
coordinateRotation(crot),
|
||||||
Rtr_(r.Rtr_)
|
angles_(crot.angles_),
|
||||||
|
degrees_(crot.degrees_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
Foam::coordinateRotations::euler::euler
|
||||||
(
|
(
|
||||||
const vector& phiThetaPsi,
|
const vector& phiThetaPsi,
|
||||||
const bool degrees
|
bool degrees
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
R_(rotation(phiThetaPsi, degrees)),
|
coordinateRotation(),
|
||||||
Rtr_(R_.T())
|
angles_(phiThetaPsi),
|
||||||
|
degrees_(degrees)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
Foam::coordinateRotations::euler::euler
|
||||||
(
|
(
|
||||||
const scalar phi,
|
scalar phi,
|
||||||
const scalar theta,
|
scalar theta,
|
||||||
const scalar psi,
|
scalar psi,
|
||||||
const bool degrees
|
bool degrees
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
R_(rotation(vector(phi, theta, psi), degrees)),
|
coordinateRotation(),
|
||||||
Rtr_(R_.T())
|
angles_(phi, theta, psi),
|
||||||
|
degrees_(degrees)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
Foam::coordinateRotations::euler::euler(const dictionary& dict)
|
||||||
|
:
|
||||||
|
coordinateRotation(),
|
||||||
|
angles_(dict.getCompat<vector>("angles", {{"rotation", 1806}})),
|
||||||
|
degrees_(dict.lookupOrDefault("degrees", true))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::euler::clear()
|
||||||
|
{
|
||||||
|
angles_ = Zero;
|
||||||
|
degrees_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tensor Foam::coordinateRotations::euler::R() const
|
||||||
|
{
|
||||||
|
return euler::rotation(angles_, degrees_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::euler::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << "euler-angles(" << (degrees_ ? "deg" : "rad") << "): " << angles_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::euler::writeEntry
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const word& keyword,
|
||||||
)
|
Ostream& os
|
||||||
:
|
) const
|
||||||
R_
|
{
|
||||||
(
|
os.beginBlock(keyword);
|
||||||
rotation
|
|
||||||
(
|
|
||||||
dict.get<vector>("rotation"),
|
|
||||||
dict.lookupOrDefault("degrees", true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
Rtr_(R_.T())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
os.writeEntry("type", type());
|
||||||
|
os.writeEntry("angles", angles_);
|
||||||
|
if (!degrees_)
|
||||||
|
{
|
||||||
|
os.writeEntry("degrees", "false");
|
||||||
|
}
|
||||||
|
|
||||||
Foam::EulerCoordinateRotation::EulerCoordinateRotation
|
os.endBlock();
|
||||||
(
|
}
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry&
|
|
||||||
)
|
|
||||||
:
|
|
||||||
EulerCoordinateRotation(dict)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::EulerCoordinateRotation
|
Foam::coordinateRotations::euler
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
|
A coordinateRotation defined in the z-x-z (intrinsic) Euler convention.
|
||||||
@ -34,24 +34,29 @@ Description
|
|||||||
For reference and illustration, see
|
For reference and illustration, see
|
||||||
https://en.wikipedia.org/wiki/Euler_angles
|
https://en.wikipedia.org/wiki/Euler_angles
|
||||||
|
|
||||||
The rotation angles are in degrees, unless otherwise explicitly specified:
|
|
||||||
|
|
||||||
\verbatim
|
\verbatim
|
||||||
coordinateRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type EulerRotation;
|
type euler;
|
||||||
degrees false;
|
angles (0 0 180);
|
||||||
rotation (0 0 3.141592654);
|
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
\heading Dictionary entries
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
type | Type name: euler (or EulerRotation) | yes |
|
||||||
|
angles | The z-x-z rotation angles | yes |
|
||||||
|
degrees | Angles are in degrees | no | true
|
||||||
|
\endtable
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
EulerCoordinateRotation.C
|
EulerCoordinateRotation.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef EulerCoordinateRotation_H
|
#ifndef coordinateRotations_euler_H
|
||||||
#define EulerCoordinateRotation_H
|
#define coordinateRotations_euler_H
|
||||||
|
|
||||||
#include "coordinateRotation.H"
|
#include "coordinateRotation.H"
|
||||||
|
|
||||||
@ -59,73 +64,62 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class EulerCoordinateRotation Declaration
|
Class coordinateRotations::euler Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class EulerCoordinateRotation
|
class euler
|
||||||
:
|
:
|
||||||
public coordinateRotation
|
public coordinateRotation
|
||||||
{
|
{
|
||||||
// Private Member Data
|
// Private Data
|
||||||
|
|
||||||
//- Local-to-global transformation tensor
|
//- The rotation angles
|
||||||
tensor R_;
|
vector angles_;
|
||||||
|
|
||||||
//- Global-to-Local transformation tensor
|
//- Angles measured in degrees
|
||||||
tensor Rtr_;
|
bool degrees_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("EulerRotation");
|
TypeNameNoDebug("euler");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null - an identity transform
|
||||||
EulerCoordinateRotation();
|
euler();
|
||||||
|
|
||||||
//- Construct as copy
|
//- Copy construct
|
||||||
EulerCoordinateRotation(const EulerCoordinateRotation& r);
|
euler(const euler& crot);
|
||||||
|
|
||||||
//- Construct from rotation vector
|
//- Construct from Euler rotation angles (z-x-z)
|
||||||
EulerCoordinateRotation
|
euler(const vector& phiThetaPsi, bool degrees);
|
||||||
(
|
|
||||||
const vector& phiThetaPsi,
|
|
||||||
const bool degrees
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from components of rotation vector
|
//- Construct from Euler rotation angles (z-x-z)
|
||||||
EulerCoordinateRotation
|
euler(scalar phi, scalar theta, scalar psi, bool degrees);
|
||||||
(
|
|
||||||
const scalar phi,
|
|
||||||
const scalar theta,
|
|
||||||
const scalar psi,
|
|
||||||
const bool degrees
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
explicit EulerCoordinateRotation(const dictionary& dict);
|
explicit euler(const dictionary& dict);
|
||||||
|
|
||||||
//- Construct from dictionary and a registry (typically a mesh)
|
|
||||||
EulerCoordinateRotation
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry& unused
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Return clone
|
//- Return clone
|
||||||
autoPtr<coordinateRotation> clone() const
|
autoPtr<coordinateRotation> clone() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
autoPtr<coordinateRotation>::NewFrom
|
autoPtr<coordinateRotation>::NewFrom
|
||||||
<EulerCoordinateRotation>(*this);
|
<coordinateRotations::euler>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~euler() = default;
|
||||||
|
|
||||||
|
|
||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
|
|
||||||
//- The rotation tensor calculated for the specified Euler angles
|
//- The rotation tensor calculated for the specified Euler angles
|
||||||
@ -135,91 +129,29 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Reset rotation to an identity rotation
|
//- Reset specification
|
||||||
virtual void clear()
|
virtual void clear();
|
||||||
{
|
|
||||||
R_ = sphericalTensor::I;
|
|
||||||
Rtr_ = sphericalTensor::I;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Update the rotation for a list of cells
|
//- The rotation tensor calculated for the specified Euler angles.
|
||||||
virtual void updateCells(const polyMesh&, const labelList&)
|
virtual tensor R() const;
|
||||||
{}
|
|
||||||
|
|
||||||
//- Return local-to-global transformation tensor
|
//- Write information
|
||||||
virtual const tensor& R() const
|
virtual void write(Ostream& os) const;
|
||||||
{
|
|
||||||
return R_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return global-to-local transformation tensor
|
//- Write dictionary entry
|
||||||
virtual const tensor& Rtr() const
|
virtual void writeEntry(const word& keyword, Ostream& os) const;
|
||||||
{
|
|
||||||
return Rtr_;
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Return local Cartesian x-axis in global coordinates
|
|
||||||
virtual const vector e1() const
|
|
||||||
{
|
|
||||||
return Rtr_.x();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian y-axis in global coordinates
|
|
||||||
virtual const vector e2() const
|
|
||||||
{
|
|
||||||
return Rtr_.y();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian z-axis in global coordinates
|
|
||||||
virtual const vector e3() const
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor
|
|
||||||
virtual vector transform(const vector& st) const;
|
|
||||||
|
|
||||||
//- Inverse transform vectorField using transformation tensor field
|
|
||||||
virtual tmp<vectorField> invTransform(const vectorField& st) const;
|
|
||||||
|
|
||||||
//- Inverse transform vector using transformation tensor
|
|
||||||
virtual vector invTransform(const vector& st) const;
|
|
||||||
|
|
||||||
//- Transform tensor field using transformation tensorField
|
|
||||||
virtual tmp<tensorField> transformTensor(const tensorField& st) const;
|
|
||||||
|
|
||||||
//- 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
|
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor and return
|
|
||||||
// symmetrical tensor
|
|
||||||
virtual symmTensor transformVector(const vector& st) const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace coordinateRotations
|
||||||
|
|
||||||
|
|
||||||
|
//- Compatibility typedef 1806
|
||||||
|
typedef coordinateRotations::euler EulerCoordinateRotation;
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -31,128 +31,37 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(STARCDCoordinateRotation, 0);
|
namespace coordinateRotations
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
coordinateRotation,
|
|
||||||
STARCDCoordinateRotation,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
coordinateRotation,
|
|
||||||
STARCDCoordinateRotation,
|
|
||||||
objectRegistry
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * 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 nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::STARCDCoordinateRotation::invTransform
|
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return 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 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 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]);
|
defineTypeName(starcd);
|
||||||
|
|
||||||
|
// Standard short name
|
||||||
|
addNamedToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
coordinateRotation,
|
||||||
|
starcd,
|
||||||
|
dictionary,
|
||||||
|
starcd
|
||||||
|
);
|
||||||
|
|
||||||
|
// Longer name - Compat 1806
|
||||||
|
addNamedToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
coordinateRotation,
|
||||||
|
starcd,
|
||||||
|
dictionary,
|
||||||
|
STARCDRotation
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return tfld;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::symmTensor Foam::STARCDCoordinateRotation::transformVector
|
|
||||||
(
|
|
||||||
const vector& st
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return transformPrincipal(R_, st);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tensor Foam::STARCDCoordinateRotation::rotation
|
Foam::tensor Foam::coordinateRotations::starcd::rotation
|
||||||
(
|
(
|
||||||
const vector& angles,
|
const vector& angles,
|
||||||
const bool degrees
|
bool degrees
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalar z = angles.component(vector::X); // 1. Rotate about Z
|
scalar z = angles.component(vector::X); // 1. Rotate about Z
|
||||||
@ -170,7 +79,6 @@ Foam::tensor Foam::STARCDCoordinateRotation::rotation
|
|||||||
const scalar cy = cos(y); const scalar sy = sin(y);
|
const scalar cy = cos(y); const scalar sy = sin(y);
|
||||||
const scalar cz = cos(z); const scalar sz = sin(z);
|
const scalar cz = cos(z); const scalar sz = sin(z);
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
tensor
|
tensor
|
||||||
(
|
(
|
||||||
@ -183,72 +91,94 @@ Foam::tensor Foam::STARCDCoordinateRotation::rotation
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation()
|
Foam::coordinateRotations::starcd::starcd()
|
||||||
:
|
:
|
||||||
R_(sphericalTensor::I),
|
coordinateRotation(),
|
||||||
Rtr_(sphericalTensor::I)
|
angles_(Zero),
|
||||||
|
degrees_(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
Foam::coordinateRotations::starcd::starcd(const starcd& crot)
|
||||||
(
|
|
||||||
const STARCDCoordinateRotation& r
|
|
||||||
)
|
|
||||||
:
|
:
|
||||||
R_(r.R_),
|
coordinateRotation(crot),
|
||||||
Rtr_(r.Rtr_)
|
angles_(crot.angles_),
|
||||||
|
degrees_(crot.degrees_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
Foam::coordinateRotations::starcd::starcd
|
||||||
(
|
(
|
||||||
const vector& rotZrotXrotY,
|
const vector& rotZrotXrotY,
|
||||||
const bool degrees
|
bool degrees
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
R_(rotation(rotZrotXrotY, degrees)),
|
coordinateRotation(),
|
||||||
Rtr_(R_.T())
|
angles_(rotZrotXrotY),
|
||||||
|
degrees_(degrees)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
Foam::coordinateRotations::starcd::starcd
|
||||||
(
|
(
|
||||||
const scalar rotZ,
|
scalar rotZ,
|
||||||
const scalar rotX,
|
scalar rotX,
|
||||||
const scalar rotY,
|
scalar rotY,
|
||||||
const bool degrees
|
bool degrees
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
R_(rotation(vector(rotZ, rotX, rotY), degrees)),
|
coordinateRotation(),
|
||||||
Rtr_(R_.T())
|
angles_(rotZ, rotX, rotY),
|
||||||
|
degrees_(degrees)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
Foam::coordinateRotations::starcd::starcd(const dictionary& dict)
|
||||||
|
:
|
||||||
|
coordinateRotation(),
|
||||||
|
angles_(dict.getCompat<vector>("angles", {{"rotation", 1806}})),
|
||||||
|
degrees_(dict.lookupOrDefault("degrees", true))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::starcd::clear()
|
||||||
|
{
|
||||||
|
angles_ = Zero;
|
||||||
|
degrees_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tensor Foam::coordinateRotations::starcd::R() const
|
||||||
|
{
|
||||||
|
return starcd::rotation(angles_, degrees_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::starcd::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << "starcd-angles(" << (degrees_ ? "deg" : "rad") << "): " << angles_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::starcd::writeEntry
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const word& keyword,
|
||||||
)
|
Ostream& os
|
||||||
:
|
) const
|
||||||
R_
|
{
|
||||||
(
|
os.beginBlock(keyword);
|
||||||
rotation
|
|
||||||
(
|
|
||||||
dict.get<vector>("rotation"),
|
|
||||||
dict.lookupOrDefault("degrees", true)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
Rtr_(R_.T())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
os.writeEntry("type", type());
|
||||||
|
os.writeEntry("angles", angles_);
|
||||||
|
if (!degrees_)
|
||||||
|
{
|
||||||
|
os.writeEntry("degrees", "false");
|
||||||
|
}
|
||||||
|
|
||||||
Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
|
os.endBlock();
|
||||||
(
|
}
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry&
|
|
||||||
)
|
|
||||||
:
|
|
||||||
STARCDCoordinateRotation(dict)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::STARCDCoordinateRotation
|
Foam::coordinateRotations::starcd
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A coordinateRotation defined by the STAR-CD convention.
|
A coordinateRotation defined by the STAR-CD convention.
|
||||||
@ -36,19 +36,26 @@ Description
|
|||||||
\verbatim
|
\verbatim
|
||||||
coordinateRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type STARCDRotation;
|
type starcd;
|
||||||
degrees false;
|
angles (0 0 180);
|
||||||
rotation (0 0 3.141592654);
|
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
\heading Dictionary entries
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
type | Type name: starcd (or STARCDRotation) | yes |
|
||||||
|
angles | The z-x-y rotation angles | yes |
|
||||||
|
degrees | Angles are in degrees | no | true
|
||||||
|
\endtable
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
STARCDCoordinateRotation.C
|
STARCDCoordinateRotation.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef STARCDCoordinateRotation_H
|
#ifndef coordinateRotations_starcd_H
|
||||||
#define STARCDCoordinateRotation_H
|
#define coordinateRotations_starcd_H
|
||||||
|
|
||||||
#include "coordinateRotation.H"
|
#include "coordinateRotation.H"
|
||||||
|
|
||||||
@ -56,74 +63,62 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class STARCDCoordinateRotation Declaration
|
Class coordinateRotations::starcd Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class STARCDCoordinateRotation
|
class starcd
|
||||||
:
|
:
|
||||||
public coordinateRotation
|
public coordinateRotation
|
||||||
{
|
{
|
||||||
// Private Member Data
|
// Private Data
|
||||||
|
|
||||||
//- Local-to-Global transformation tensor
|
//- The rotation angles
|
||||||
tensor R_;
|
vector angles_;
|
||||||
|
|
||||||
//- Global-to-Local transformation tensor
|
//- Angles measured in degrees
|
||||||
tensor Rtr_;
|
bool degrees_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("STARCDRotation");
|
TypeNameNoDebug("starcd");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null - an identity transform
|
||||||
STARCDCoordinateRotation();
|
starcd();
|
||||||
|
|
||||||
//- Construct as copy
|
//- Copy construct
|
||||||
STARCDCoordinateRotation(const STARCDCoordinateRotation& r);
|
starcd(const starcd& crot);
|
||||||
|
|
||||||
//- Construct from rotation vector
|
//- Construct from rotation vector
|
||||||
STARCDCoordinateRotation
|
starcd(const vector& rotZrotXrotY, bool degrees);
|
||||||
(
|
|
||||||
const vector& rotZrotXrotY,
|
|
||||||
const bool degrees
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from components of rotation vector
|
//- Construct from components of rotation vector
|
||||||
STARCDCoordinateRotation
|
starcd(scalar rotZ, scalar rotX, scalar rotY, bool degrees);
|
||||||
(
|
|
||||||
const scalar rotZ,
|
|
||||||
const scalar rotX,
|
|
||||||
const scalar rotY,
|
|
||||||
const bool degrees
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
explicit STARCDCoordinateRotation(const dictionary& dict);
|
explicit starcd(const dictionary& dict);
|
||||||
|
|
||||||
//- Construct from dictionary and a registry (typically a mesh)
|
|
||||||
STARCDCoordinateRotation
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry& unused
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Return clone
|
//- Return clone
|
||||||
autoPtr<coordinateRotation> clone() const
|
autoPtr<coordinateRotation> clone() const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
autoPtr<coordinateRotation>::NewFrom
|
autoPtr<coordinateRotation>::NewFrom
|
||||||
<STARCDCoordinateRotation>(*this);
|
<coordinateRotations::starcd>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~starcd() = default;
|
||||||
|
|
||||||
|
|
||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
|
|
||||||
//- The rotation tensor calculated for the specified STARCD angles
|
//- The rotation tensor calculated for the specified STARCD angles
|
||||||
@ -133,91 +128,29 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Reset rotation to an identity rotation
|
//- Reset specification
|
||||||
virtual void clear()
|
virtual void clear();
|
||||||
{
|
|
||||||
R_ = sphericalTensor::I;
|
|
||||||
Rtr_ = sphericalTensor::I;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Update the rotation for a list of cells
|
//- The rotation tensor calculated for the specified STARCD angles.
|
||||||
virtual void updateCells(const polyMesh&, const labelList&)
|
virtual tensor R() const;
|
||||||
{}
|
|
||||||
|
|
||||||
//- Return local-to-global transformation tensor
|
//- Write information
|
||||||
virtual const tensor& R() const
|
virtual void write(Ostream& os) const;
|
||||||
{
|
|
||||||
return R_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return global-to-local transformation tensor
|
//- Write dictionary entry
|
||||||
virtual const tensor& Rtr() const
|
virtual void writeEntry(const word& keyword, Ostream& os) const;
|
||||||
{
|
|
||||||
return Rtr_;
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Return local Cartesian x-axis in global coordinates
|
|
||||||
virtual const vector e1() const
|
|
||||||
{
|
|
||||||
return Rtr_.x();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian y-axis in global coordinates
|
|
||||||
virtual const vector e2() const
|
|
||||||
{
|
|
||||||
return Rtr_.y();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian z-axis in global coordinates
|
|
||||||
virtual const vector e3() const
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor
|
|
||||||
virtual vector transform(const vector& st) const;
|
|
||||||
|
|
||||||
//- Inverse transform vectorField using transformation tensor field
|
|
||||||
virtual tmp<vectorField> invTransform(const vectorField& st) const;
|
|
||||||
|
|
||||||
//- Inverse transform vector using transformation tensor
|
|
||||||
virtual vector invTransform(const vector& st) const;
|
|
||||||
|
|
||||||
//- Transform tensor field using transformation tensorField
|
|
||||||
virtual tmp<tensorField> transformTensor(const tensorField& st) const;
|
|
||||||
|
|
||||||
//- 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
|
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor and return
|
|
||||||
// symmetrical tensor
|
|
||||||
virtual symmTensor transformVector(const vector& st) const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace coordinateRotations
|
||||||
|
|
||||||
|
|
||||||
|
//- Compatibility typedef 1806
|
||||||
|
typedef coordinateRotations::starcd STARCDCoordinateRotation;
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -31,25 +31,34 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(axesRotation, 0);
|
namespace coordinateRotations
|
||||||
addToRunTimeSelectionTable
|
{
|
||||||
(
|
defineTypeName(axes);
|
||||||
coordinateRotation,
|
|
||||||
axesRotation,
|
// Standard short name
|
||||||
dictionary
|
addNamedToRunTimeSelectionTable
|
||||||
);
|
(
|
||||||
addToRunTimeSelectionTable
|
coordinateRotation,
|
||||||
(
|
axes,
|
||||||
coordinateRotation,
|
dictionary,
|
||||||
axesRotation,
|
axes
|
||||||
objectRegistry
|
);
|
||||||
);
|
|
||||||
|
// Longer name - Compat 1806
|
||||||
|
addNamedToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
coordinateRotation,
|
||||||
|
axes,
|
||||||
|
dictionary,
|
||||||
|
axesRotation
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tensor Foam::axesRotation::rotation
|
Foam::tensor Foam::coordinateRotations::axes::rotation
|
||||||
(
|
(
|
||||||
const vector& axis1,
|
const vector& axis1,
|
||||||
const vector& axis2,
|
const vector& axis2,
|
||||||
@ -143,221 +152,193 @@ Foam::tensor Foam::axesRotation::rotation
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::axesRotation::read(const dictionary& dict)
|
void Foam::coordinateRotations::axes::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
vector axis1, axis2;
|
|
||||||
axisOrder order = E3_E1;
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
dict.readIfPresent("e1", axis1)
|
dict.readIfPresent("e1", axis1_)
|
||||||
&& dict.readIfPresent("e2", axis2)
|
&& dict.readIfPresent("e2", axis2_)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
order = E1_E2;
|
order_ = E1_E2;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
dict.readIfPresent("e2", axis1)
|
dict.readIfPresent("e2", axis1_)
|
||||||
&& dict.readIfPresent("e3", axis2)
|
&& dict.readIfPresent("e3", axis2_)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
order = E2_E3;
|
order_ = E2_E3;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
dict.readIfPresent("e3", axis1)
|
dict.readIfPresent("e3", axis1_)
|
||||||
&& dict.readIfPresent("e1", axis2)
|
&& dict.readIfPresent("e1", axis2_)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
order = E3_E1;
|
order_ = E3_E1;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
dict.readIfPresent("axis", axis1)
|
dict.readIfPresent("axis", axis1_)
|
||||||
&& dict.readIfPresent("direction", axis2)
|
&& dict.readIfPresent("direction", axis2_)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
order = E3_E1_COMPAT;
|
order_ = E3_E1_COMPAT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalIOErrorInFunction(dict)
|
||||||
<< "No entries of the type (e1, e2) or (e2, e3) or (e3, e1) found"
|
<< "No entries of the type (e1, e2) or (e2, e3) or (e3, e1) found"
|
||||||
<< exit(FatalError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_ = rotation(axis1, axis2, order);
|
|
||||||
Rtr_ = R_.T();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::axesRotation::axesRotation()
|
Foam::coordinateRotations::axes::axes()
|
||||||
:
|
:
|
||||||
R_(sphericalTensor::I),
|
coordinateRotation(),
|
||||||
Rtr_(sphericalTensor::I)
|
axis1_(0,0,1), // e3 = global Z
|
||||||
|
axis2_(1,0,0), // e1 = global X
|
||||||
|
order_(E3_E1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::axesRotation::axesRotation(const axesRotation& r)
|
Foam::coordinateRotations::axes::axes(const axes& crot)
|
||||||
:
|
:
|
||||||
R_(r.R_),
|
coordinateRotation(crot),
|
||||||
Rtr_(r.Rtr_)
|
axis1_(crot.axis1_),
|
||||||
|
axis2_(crot.axis2_),
|
||||||
|
order_(crot.order_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::axesRotation::axesRotation(const tensor& R)
|
Foam::coordinateRotations::axes::axes(axes&& crot)
|
||||||
:
|
:
|
||||||
R_(R),
|
coordinateRotation(std::move(crot)),
|
||||||
Rtr_(R_.T())
|
axis1_(std::move(crot.axis1_)),
|
||||||
|
axis2_(std::move(crot.axis2_)),
|
||||||
|
order_(crot.order_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::axesRotation::axesRotation
|
Foam::coordinateRotations::axes::axes
|
||||||
(
|
(
|
||||||
const vector& axis,
|
const vector& axis1,
|
||||||
const vector& dir,
|
const vector& axis2,
|
||||||
const axisOrder& order
|
axisOrder order
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
R_(rotation(axis, dir, order)),
|
coordinateRotation(),
|
||||||
Rtr_(R_.T())
|
axis1_(axis1),
|
||||||
|
axis2_(axis2),
|
||||||
|
order_(order)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::axesRotation::axesRotation
|
Foam::coordinateRotations::axes::axes(const vector& axis)
|
||||||
(
|
|
||||||
const vector& axis
|
|
||||||
)
|
|
||||||
:
|
:
|
||||||
R_(rotation(axis, findOrthogonal(axis), E3_E1)),
|
coordinateRotations::axes(axis, Zero, E3_E1_COMPAT) // Guess second axis
|
||||||
Rtr_(R_.T())
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::axesRotation::axesRotation
|
Foam::coordinateRotations::axes::axes(const dictionary& dict)
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
:
|
||||||
R_(sphericalTensor::I),
|
coordinateRotations::axes()
|
||||||
Rtr_(sphericalTensor::I)
|
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::axesRotation::axesRotation
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry&
|
|
||||||
)
|
|
||||||
:
|
|
||||||
axesRotation(dict)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::tensorField& Foam::axesRotation::Tr() const
|
void Foam::coordinateRotations::axes::clear()
|
||||||
{
|
{
|
||||||
NotImplemented;
|
axis1_ = vector(0,0,1); // e3 = global Z
|
||||||
return NullObjectRef<tensorField>();
|
axis2_ = vector(1,0,0); // e1 = global X
|
||||||
|
order_ = E3_E1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::axesRotation::transform
|
Foam::tensor Foam::coordinateRotations::axes::R() const
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
return (R_ & st);
|
return axes::rotation(axis1_, axis2_, order_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::axesRotation::transform(const vector& st) const
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::axes::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
return (R_ & st);
|
switch (order_)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::axesRotation::invTransform
|
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return (Rtr_ & st);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::axesRotation::invTransform(const vector& st) const
|
|
||||||
{
|
|
||||||
return (Rtr_ & st);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::tensorField> Foam::axesRotation::transformTensor
|
|
||||||
(
|
|
||||||
const tensorField& st
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tensor Foam::axesRotation::transformTensor
|
|
||||||
(
|
|
||||||
const tensor& st
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return (R_ & st & Rtr_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::tensorField> Foam::axesRotation::transformTensor
|
|
||||||
(
|
|
||||||
const tensorField& st,
|
|
||||||
const labelList& cellMap
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::symmTensorField> Foam::axesRotation::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]);
|
case E1_E2:
|
||||||
|
os << "e1: " << axis1_ << " e2: " << axis2_;
|
||||||
|
break;
|
||||||
|
case E2_E3:
|
||||||
|
os << "e2: " << axis1_ << " e3: " << axis2_;
|
||||||
|
break;
|
||||||
|
case E3_E1:
|
||||||
|
os << "e1: " << axis2_ << " e3: " << axis1_;
|
||||||
|
break;
|
||||||
|
case E3_E1_COMPAT:
|
||||||
|
os << "axis: " << axis1_ << " direction: " << axis2_;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return tfld;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::symmTensor Foam::axesRotation::transformVector
|
void Foam::coordinateRotations::axes::writeEntry
|
||||||
(
|
(
|
||||||
const vector& st
|
const word& keyword,
|
||||||
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return transformPrincipal(R_, st);
|
// We permit direct embedding of the axes specification without
|
||||||
}
|
// requiring a sub-dictionary.
|
||||||
|
|
||||||
|
const bool subDict = !keyword.empty();
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
if (subDict)
|
||||||
|
{
|
||||||
|
os.beginBlock(keyword);
|
||||||
|
os.writeEntry("type", type());
|
||||||
|
}
|
||||||
|
|
||||||
void Foam::axesRotation::operator=(const dictionary& dict)
|
switch (order_)
|
||||||
{
|
{
|
||||||
read(dict);
|
case E1_E2:
|
||||||
|
{
|
||||||
|
os.writeEntry("e1", axis1_);
|
||||||
|
os.writeEntry("e2", axis2_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E2_E3:
|
||||||
|
{
|
||||||
|
os.writeEntry("e2", axis1_);
|
||||||
|
os.writeEntry("e3", axis2_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E3_E1:
|
||||||
|
{
|
||||||
|
os.writeEntry("e1", axis2_);
|
||||||
|
os.writeEntry("e3", axis1_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case E3_E1_COMPAT:
|
||||||
|
{
|
||||||
|
os.writeEntry("axis", axis1_);
|
||||||
|
os.writeEntry("direction", axis2_);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subDict)
|
||||||
|
{
|
||||||
|
os.endBlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -22,48 +22,59 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::axesRotation
|
Foam::coordinateRotations::axes
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A coordinate rotation specified using global axes
|
A coordinateRotation specified using global axes.
|
||||||
|
|
||||||
The rotation is defined by a combination of vectors (e1/e2), (e2/e3)
|
The rotation is defined by a combination of vectors (e1/e2), (e2/e3)
|
||||||
or (e3/e1). Any nonorthogonality will be absorbed into the second
|
or (e3/e1). Any nonorthogonality is absorbed into the second vector.
|
||||||
vector. In terms of cylindrical coordinates, the 'axis' would
|
|
||||||
correspond to the \a z-axis and the 'direction' to the \a r-axis.
|
|
||||||
|
|
||||||
\verbatim
|
\verbatim
|
||||||
axesRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type axesRotation;
|
type axes;
|
||||||
e1 (1 0 0);
|
e1 (1 0 0);
|
||||||
e2 (0 1 0);
|
e2 (0 1 0);
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
\heading Dictionary entries
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
type | type name: axes (previously axesRotation) | yes |
|
||||||
|
e1 | local x-axis | partly |
|
||||||
|
e2 | local y-axis | partly |
|
||||||
|
e3 | local z-axis | partly |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
It is also possible to specify in terms of \c axis and \c direction.
|
||||||
|
For cylindrical coordinates, the \c axis would correspond to the
|
||||||
|
\a z-axis and the \c direction to the \a r-axis.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
axesRotation.C
|
axesRotation.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef axesRotation_H
|
#ifndef coordinateRotations_axes_H
|
||||||
#define axesRotation_H
|
#define coordinateRotations_axes_H
|
||||||
|
|
||||||
#include "vector.H"
|
|
||||||
#include "coordinateRotation.H"
|
#include "coordinateRotation.H"
|
||||||
#include "dictionary.H"
|
|
||||||
#include "runTimeSelectionTables.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class axesRotation Declaration
|
Class coordinateRotations::axes Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class axesRotation
|
class axes
|
||||||
:
|
:
|
||||||
public coordinateRotation
|
public coordinateRotation
|
||||||
{
|
{
|
||||||
@ -76,19 +87,22 @@ public:
|
|||||||
E1_E2, //!< The axis1 (dominant) is local X, axis2 is local Y.
|
E1_E2, //!< The axis1 (dominant) is local X, axis2 is local Y.
|
||||||
E2_E3, //!< The axis1 (dominant) is local Y, axis2 is local Z.
|
E2_E3, //!< The axis1 (dominant) is local Y, axis2 is local Z.
|
||||||
E3_E1, //!< The axis1 (dominant) is local Z, axis2 is local X.
|
E3_E1, //!< The axis1 (dominant) is local Z, axis2 is local X.
|
||||||
E3_E1_COMPAT, //!< E3_E1 specified as axis/direction.
|
E3_E1_COMPAT //!< E3_E1 specified as axis/direction.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
// Private data
|
// Protected Data
|
||||||
|
|
||||||
//- Local-to-Global transformation tensor
|
//- The primary axis
|
||||||
tensor R_;
|
vector axis1_;
|
||||||
|
|
||||||
//- Global-to-Local transformation tensor
|
//- The secondary axis
|
||||||
tensor Rtr_;
|
vector axis2_;
|
||||||
|
|
||||||
|
//- The axis order
|
||||||
|
axisOrder order_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
@ -100,67 +114,52 @@ private:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("axesRotation");
|
TypeNameNoDebug("axes");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null - an identity transform
|
||||||
axesRotation();
|
axes();
|
||||||
|
|
||||||
//- Construct as copy
|
//- Copy construct
|
||||||
axesRotation(const axesRotation& r);
|
axes(const axes& crot);
|
||||||
|
|
||||||
//- Construct from local to global rotation matrix
|
//- Move construct
|
||||||
explicit axesRotation(const tensor& R);
|
axes(axes&& crot);
|
||||||
|
|
||||||
//- Construct from two axes (axis and direction)
|
//- Construct from two axes
|
||||||
axesRotation
|
axes(const vector& axis1, const vector& axis2, axisOrder order=E3_E1);
|
||||||
(
|
|
||||||
const vector& axis,
|
|
||||||
const vector& dir,
|
|
||||||
const axisOrder& order = E3_E1
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from a single axis using a best-guess for the second axis
|
//- Construct from a single axis (as e3) using a best-guess for the
|
||||||
// For the best-guess, the largest component value and sign of the
|
//- second axis.
|
||||||
// axis determines the direction orientation.
|
// The largest component and its sign are used when guessing
|
||||||
explicit axesRotation(const vector& axis);
|
// an appropriate orientation (direction).
|
||||||
|
explicit axes(const vector& axis);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
explicit axesRotation(const dictionary& dict);
|
explicit axes(const dictionary& dict);
|
||||||
|
|
||||||
//- Construct from dictionary and a registry (typically a mesh)
|
|
||||||
axesRotation
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry& unused
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Return clone
|
//- Return clone
|
||||||
autoPtr<coordinateRotation> clone() const
|
autoPtr<coordinateRotation> clone() const
|
||||||
{
|
{
|
||||||
return autoPtr<coordinateRotation>::NewFrom<axesRotation>(*this);
|
return
|
||||||
|
autoPtr<coordinateRotation>::NewFrom
|
||||||
|
<coordinateRotations::axes>(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~axesRotation() = default;
|
virtual ~axes() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
//- Reset rotation to an identity rotation
|
|
||||||
virtual void clear()
|
|
||||||
{
|
|
||||||
R_ = sphericalTensor::I;
|
|
||||||
Rtr_ = sphericalTensor::I;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Static Member Functions
|
// Static Member Functions
|
||||||
|
|
||||||
//- The rotation tensor calculated from two axes and their order.
|
//- The rotation tensor calculated from two axes and their order.
|
||||||
// The input axes will be normalised.
|
// The input axes will be normalised.
|
||||||
|
// If axis2 is zero, an axis orthogonal to axis1 will be guessed.
|
||||||
|
// The largest component and its sign are used when guessing
|
||||||
|
// an appropriate orientation (direction).
|
||||||
static tensor rotation
|
static tensor rotation
|
||||||
(
|
(
|
||||||
const vector& axis1,
|
const vector& axis1,
|
||||||
@ -169,90 +168,29 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Update the rotation for a list of cells
|
// Member Functions
|
||||||
virtual void updateCells(const polyMesh&, const labelList&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Return local-to-global transformation tensor
|
//- Reset specification
|
||||||
virtual const tensor& R() const
|
virtual void clear();
|
||||||
{
|
|
||||||
return R_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return global-to-local transformation tensor
|
//- The rotation tensor calculated from the specified axes and order
|
||||||
virtual const tensor& Rtr() const
|
virtual tensor R() const;
|
||||||
{
|
|
||||||
return Rtr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian x-axis in global coordinates
|
//- Write information
|
||||||
virtual const vector e1() const
|
virtual void write(Ostream& os) const;
|
||||||
{
|
|
||||||
return Rtr_.x();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian y-axis in global coordinates
|
|
||||||
virtual const vector e2() const
|
|
||||||
{
|
|
||||||
return Rtr_.y();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian z-axis in global coordinates
|
|
||||||
virtual const vector e3() const
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor
|
|
||||||
virtual vector transform(const vector& st) const;
|
|
||||||
|
|
||||||
//- Inverse transform vectorField using transformation tensor field
|
|
||||||
virtual tmp<vectorField> invTransform(const vectorField& st) const;
|
|
||||||
|
|
||||||
//- Inverse transform vector using transformation tensor
|
|
||||||
virtual vector invTransform(const vector& st) const;
|
|
||||||
|
|
||||||
//- Transform tensor field using transformation tensorField
|
|
||||||
virtual tmp<tensorField> transformTensor(const tensorField& st) const;
|
|
||||||
|
|
||||||
//- 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
|
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor and return
|
|
||||||
// symmetric tensor
|
|
||||||
virtual symmTensor transformVector(const vector& st) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
|
||||||
|
|
||||||
//- Assign from dictionary
|
|
||||||
void operator=(const dictionary& dict);
|
|
||||||
|
|
||||||
|
//- Write dictionary entry
|
||||||
|
virtual void writeEntry(const word& keyword, Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace coordinateRotations
|
||||||
|
|
||||||
|
// Compatibility typedef 1806
|
||||||
|
typedef coordinateRotations::axes axesRotation;
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
167
src/meshTools/coordinate/rotation/axisAngleRotation.C
Normal file
167
src/meshTools/coordinate/rotation/axisAngleRotation.C
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "axisAngleRotation.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "quaternion.H"
|
||||||
|
#include "unitConversion.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
defineTypeName(axisAngle);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
coordinateRotation,
|
||||||
|
axisAngle,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::axisAngle::checkSpec()
|
||||||
|
{
|
||||||
|
if (mag(angle_) < VSMALL || mag(axis_) < SMALL)
|
||||||
|
{
|
||||||
|
clear(); // identity rotation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::coordinateRotations::axisAngle::axisAngle()
|
||||||
|
:
|
||||||
|
coordinateRotation(),
|
||||||
|
axis_ (0,0,1), // e3 = global Z
|
||||||
|
angle_(Zero),
|
||||||
|
degrees_(true)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::axisAngle::axisAngle(const axisAngle& crot)
|
||||||
|
:
|
||||||
|
coordinateRotation(crot),
|
||||||
|
axis_(crot.axis_),
|
||||||
|
angle_(crot.angle_),
|
||||||
|
degrees_(crot.degrees_)
|
||||||
|
{
|
||||||
|
checkSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::axisAngle::axisAngle(axisAngle&& crot)
|
||||||
|
:
|
||||||
|
coordinateRotation(std::move(crot)),
|
||||||
|
axis_(std::move(crot.axis_)),
|
||||||
|
angle_(std::move(crot.angle_)),
|
||||||
|
degrees_(crot.degrees_)
|
||||||
|
{
|
||||||
|
checkSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::axisAngle::axisAngle
|
||||||
|
(
|
||||||
|
const vector& axis,
|
||||||
|
scalar angle,
|
||||||
|
bool degrees
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coordinateRotation(),
|
||||||
|
axis_(axis),
|
||||||
|
angle_(angle),
|
||||||
|
degrees_(degrees)
|
||||||
|
{
|
||||||
|
checkSpec();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::axisAngle::axisAngle(const dictionary& dict)
|
||||||
|
:
|
||||||
|
axisAngle
|
||||||
|
(
|
||||||
|
dict.get<vector>("axis"),
|
||||||
|
dict.get<scalar>("angle"),
|
||||||
|
dict.lookupOrDefault("degrees", true)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::axisAngle::clear()
|
||||||
|
{
|
||||||
|
axis_ = vector(0,0,1); // e3 = global Z
|
||||||
|
angle_ = Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tensor Foam::coordinateRotations::axisAngle::R() const
|
||||||
|
{
|
||||||
|
if (mag(angle_) < VSMALL || mag(axis_) < SMALL)
|
||||||
|
{
|
||||||
|
return sphericalTensor::I; // identity rotation
|
||||||
|
}
|
||||||
|
|
||||||
|
return quaternion(axis_, (degrees_ ? degToRad(angle_) : angle_)).R();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::axisAngle::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << "rotation axis: " << axis_
|
||||||
|
<< " angle(" << (degrees_ ? "deg" : "rad") << "): " << angle_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::axisAngle::writeEntry
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.beginBlock(keyword);
|
||||||
|
|
||||||
|
os.writeEntry("type", type());
|
||||||
|
os.writeEntry("axis", axis_);
|
||||||
|
os.writeEntry("angle", angle_);
|
||||||
|
if (!degrees_)
|
||||||
|
{
|
||||||
|
os.writeEntry("degrees", "false");
|
||||||
|
}
|
||||||
|
|
||||||
|
os.endBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
156
src/meshTools/coordinate/rotation/axisAngleRotation.H
Normal file
156
src/meshTools/coordinate/rotation/axisAngleRotation.H
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::coordinateRotations::axisAngle
|
||||||
|
|
||||||
|
Description
|
||||||
|
A coordinateRotation specified by a rotation axis and a rotation angle
|
||||||
|
about that axis.
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
coordinateRotation
|
||||||
|
{
|
||||||
|
type axisAngle;
|
||||||
|
axis (1 0 0);
|
||||||
|
angle 90;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
\heading Dictionary entries
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
type | Type name: axisAngle | yes |
|
||||||
|
axis | Axis of rotation (vector) | yes |
|
||||||
|
angle | Rotation angle | yes |
|
||||||
|
degrees | The angle is in degrees | no | true
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
Note
|
||||||
|
The rotation axis will be normalized internally.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
axisAngle.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef coordinateRotations_axisAngle_H
|
||||||
|
#define coordinateRotations_axisAngle_H
|
||||||
|
|
||||||
|
#include "coordinateRotation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class coordinateRotations::axisAngle Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class axisAngle
|
||||||
|
:
|
||||||
|
public coordinateRotation
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- The rotation axis
|
||||||
|
vector axis_;
|
||||||
|
|
||||||
|
//- The rotation angle
|
||||||
|
scalar angle_;
|
||||||
|
|
||||||
|
//- Angle measured in degrees
|
||||||
|
bool degrees_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Check specification for an identity rotation
|
||||||
|
void checkSpec();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeNameNoDebug("axisAngle");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
axisAngle();
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
axisAngle(const axisAngle& crot);
|
||||||
|
|
||||||
|
//- Move construct
|
||||||
|
axisAngle(axisAngle&& crot);
|
||||||
|
|
||||||
|
//- Construct from axis and angle
|
||||||
|
axisAngle(const vector& axis, scalar angle, bool degrees);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
explicit axisAngle(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Return clone
|
||||||
|
autoPtr<coordinateRotation> clone() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
autoPtr<coordinateRotation>::NewFrom
|
||||||
|
<coordinateRotations::axisAngle>(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~axisAngle() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Reset specification
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
|
//- Calculate and return the rotation tensor
|
||||||
|
//- calculated from axis and angle
|
||||||
|
virtual tensor R() const;
|
||||||
|
|
||||||
|
//- Write information
|
||||||
|
virtual void write(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write dictionary entry
|
||||||
|
virtual void writeEntry(const word& keyword, Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace coordinateRotations
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -31,9 +31,8 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(coordinateRotation, 0);
|
defineTypeName(coordinateRotation);
|
||||||
defineRunTimeSelectionTable(coordinateRotation, dictionary);
|
defineRunTimeSelectionTable(coordinateRotation, dictionary);
|
||||||
defineRunTimeSelectionTable(coordinateRotation, objectRegistry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,46 +63,28 @@ Foam::vector Foam::coordinateRotation::findOrthogonal(const vector& axis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::symmTensor Foam::coordinateRotation::transformPrincipal
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
|
||||||
(
|
(
|
||||||
const tensor& tt,
|
const dictionary& dict
|
||||||
const vector& v
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return symmTensor
|
const word modelType(dict.get<word>("type"));
|
||||||
(
|
|
||||||
tt.xx()*v.x()*tt.xx()
|
|
||||||
+ tt.xy()*v.y()*tt.xy()
|
|
||||||
+ tt.xz()*v.z()*tt.xz(),
|
|
||||||
|
|
||||||
tt.xx()*v.x()*tt.yx()
|
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||||
+ tt.xy()*v.y()*tt.yy()
|
|
||||||
+ tt.xz()*v.z()*tt.yz(),
|
|
||||||
|
|
||||||
tt.xx()*v.x()*tt.zx()
|
if (!cstrIter.found())
|
||||||
+ tt.xy()*v.y()*tt.zy()
|
{
|
||||||
+ tt.xz()*v.z()*tt.zz(),
|
FatalIOErrorInFunction(dict)
|
||||||
|
<< "Unknown coordinateRotation type "
|
||||||
|
<< modelType << nl << nl
|
||||||
|
<< "Valid types: "
|
||||||
|
<< flatOutput(dictionaryConstructorTablePtr_->sortedToc())
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
tt.yx()*v.x()*tt.yx()
|
return autoPtr<coordinateRotation>(cstrIter()(dict));
|
||||||
+ tt.yy()*v.y()*tt.yy()
|
|
||||||
+ tt.yz()*v.z()*tt.yz(),
|
|
||||||
|
|
||||||
tt.yx()*v.x()*tt.zx()
|
|
||||||
+ tt.yy()*v.y()*tt.zy()
|
|
||||||
+ tt.yz()*v.z()*tt.zz(),
|
|
||||||
|
|
||||||
tt.zx()*v.x()*tt.zx()
|
|
||||||
+ tt.zy()*v.y()*tt.zy()
|
|
||||||
+ tt.zz()*v.z()*tt.zz()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::coordinateRotation::write(Ostream& os) const
|
|
||||||
{
|
|
||||||
os.writeEntry("e1", e1());
|
|
||||||
os.writeEntry("e2", e2());
|
|
||||||
os.writeEntry("e3", e3());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,43 +21,47 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Namespace
|
||||||
|
Foam::coordinateRotations
|
||||||
|
|
||||||
|
Description
|
||||||
|
Namespace for coordinate system rotations.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::coordinateRotation
|
Foam::coordinateRotation
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Abstract base class for coordinate rotation
|
User specification of a coordinate rotation.
|
||||||
|
|
||||||
\verbatim
|
\verbatim
|
||||||
coordinateRotation
|
coordinateRotation
|
||||||
{
|
{
|
||||||
type axesRotation
|
type axes
|
||||||
e1 (1 0 0);
|
e1 (1 0 0);
|
||||||
e2 (0 1 0);
|
e2 (0 1 0);
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
Types of coordinateRotation:
|
Types of coordinateRotations:
|
||||||
-# axesRotation
|
-# \link coordinateRotations::identity none \endlink
|
||||||
-# STARCDRotation
|
-# \link coordinateRotations::axes axes \endlink
|
||||||
-# cylindrical
|
-# \link coordinateRotations::axisAngle axisAngle \endlink
|
||||||
-# EulerCoordinateRotation
|
-# \link coordinateRotations::cylindrical cylindrical \endlink
|
||||||
|
-# \link coordinateRotations::euler euler \endlink
|
||||||
|
-# \link coordinateRotations::starcd starcd \endlink
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
coordinateRotation.C
|
coordinateRotation.C
|
||||||
coordinateRotationNew.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef coordinateRotation_H
|
#ifndef coordinateRotation_H
|
||||||
#define coordinateRotation_H
|
#define coordinateRotation_H
|
||||||
|
|
||||||
#include "vector.H"
|
#include "vectorField.H"
|
||||||
#include "tensor.H"
|
|
||||||
#include "tensorField.H"
|
#include "tensorField.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
#include "objectRegistry.H"
|
|
||||||
#include "polyMesh.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -65,17 +69,14 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class coordinateRotation Declaration
|
Class coordinateRotation Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class coordinateRotation
|
class coordinateRotation
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected member functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Transform principal
|
|
||||||
static symmTensor transformPrincipal(const tensor&, const vector&);
|
|
||||||
|
|
||||||
//- Determine best-guess for an orthogonal axis
|
//- Determine best-guess for an orthogonal axis
|
||||||
static vector findOrthogonal(const vector& axis);
|
static vector findOrthogonal(const vector& axis);
|
||||||
@ -84,25 +85,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("coordinateRotation");
|
TypeNameNoDebug("coordinateRotation");
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table from dictionary
|
||||||
// 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
|
declareRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
autoPtr,
|
autoPtr,
|
||||||
@ -114,26 +99,19 @@ public:
|
|||||||
(dict)
|
(dict)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
// Uses all default constructors
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual autoPtr<coordinateRotation> clone() const = 0;
|
virtual autoPtr<coordinateRotation> clone() const = 0;
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Select constructed from dictionary and objectRegistry
|
|
||||||
static autoPtr<coordinateRotation> New
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry& obr
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Select constructed from dictionary
|
//- Select constructed from dictionary
|
||||||
static autoPtr<coordinateRotation> New
|
static autoPtr<coordinateRotation> New(const dictionary& dict);
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -142,84 +120,20 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Reset rotation to an identity rotation
|
//- Reset specification
|
||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
|
|
||||||
//- Update the rotation for a list of cells
|
//- Calculate and return the rotation tensor
|
||||||
virtual void updateCells
|
virtual tensor R() const = 0;
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const labelList& cells
|
|
||||||
) = 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;
|
|
||||||
|
|
||||||
//- Return local Cartesian y-axis
|
|
||||||
virtual const vector e2() const = 0;
|
|
||||||
|
|
||||||
//- 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
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Transform vectorField using transformation tensor field
|
|
||||||
virtual tmp<vectorField> transform(const vectorField& st) const = 0;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor
|
|
||||||
virtual vector transform(const vector& st) const = 0;
|
|
||||||
|
|
||||||
//- Inverse transform vectorField using transformation tensor field
|
|
||||||
virtual tmp<vectorField> invTransform(const vectorField& st) const = 0;
|
|
||||||
|
|
||||||
//- Inverse transform vector using transformation tensor
|
|
||||||
virtual vector invTransform(const vector& st) const = 0;
|
|
||||||
|
|
||||||
//- Transform tensor field using transformation tensorField
|
|
||||||
virtual tmp<tensorField> transformTensor
|
|
||||||
(
|
|
||||||
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;
|
|
||||||
|
|
||||||
//- Transform vectorField using transformation tensorField and return
|
|
||||||
// symmetrical tensorField
|
|
||||||
virtual tmp<symmTensorField> transformVector
|
|
||||||
(
|
|
||||||
const vectorField& st
|
|
||||||
) const = 0;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor and return
|
|
||||||
// symmetrical tensor
|
|
||||||
virtual symmTensor transformVector(const vector& st) const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
//- Write coordinateRotation as e1,e2,e3 vectors
|
//- Write information
|
||||||
virtual void write(Ostream& os) const;
|
virtual void write(Ostream& os) const = 0;
|
||||||
|
|
||||||
|
//- Write dictionary entry
|
||||||
|
virtual void writeEntry(const word& keyword, Ostream& os) const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,76 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "coordinateRotation.H"
|
|
||||||
#include "objectRegistry.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry& obr
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const word modelType(dict.get<word>("type"));
|
|
||||||
|
|
||||||
auto cstrIter = objectRegistryConstructorTablePtr_->cfind(modelType);
|
|
||||||
|
|
||||||
if (!cstrIter.found())
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction(dict)
|
|
||||||
<< "Unknown coordinateRotation type " << modelType << nl << nl
|
|
||||||
<< "Valid types: "
|
|
||||||
<< flatOutput(objectRegistryConstructorTablePtr_->sortedToc())
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return autoPtr<coordinateRotation>(cstrIter()(dict, obr));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
|
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const word modelType(dict.get<word>("type"));
|
|
||||||
|
|
||||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
|
||||||
|
|
||||||
if (!cstrIter.found())
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction(dict)
|
|
||||||
<< "Unknown coordinateRotation type " << modelType << nl << nl
|
|
||||||
<< "Valid types: "
|
|
||||||
<< flatOutput(dictionaryConstructorTablePtr_->sortedToc())
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return autoPtr<coordinateRotation>(cstrIter()(dict));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,360 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "cylindrical.H"
|
|
||||||
#include "axesRotation.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "tensorIOField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineTypeNameAndDebug(cylindrical, 0);
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
coordinateRotation,
|
|
||||||
cylindrical,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
coordinateRotation,
|
|
||||||
cylindrical,
|
|
||||||
objectRegistry
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::cylindrical::init
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const labelUList& cells
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const polyMesh& mesh = refCast<const polyMesh>(obr);
|
|
||||||
const vectorField& cc = mesh.cellCentres();
|
|
||||||
|
|
||||||
if (cells.size())
|
|
||||||
{
|
|
||||||
Rptr_.reset(new tensorField(cells.size()));
|
|
||||||
|
|
||||||
tensorField& R = Rptr_();
|
|
||||||
forAll(cells, i)
|
|
||||||
{
|
|
||||||
const label celli = cells[i];
|
|
||||||
vector dir = cc[celli] - origin_;
|
|
||||||
dir /= mag(dir) + VSMALL;
|
|
||||||
|
|
||||||
R[i] = axesRotation(e3_, dir).R();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Rptr_.reset(new tensorField(mesh.nCells()));
|
|
||||||
|
|
||||||
tensorField& R = Rptr_();
|
|
||||||
forAll(cc, celli)
|
|
||||||
{
|
|
||||||
vector dir = cc[celli] - origin_;
|
|
||||||
dir /= mag(dir) + VSMALL;
|
|
||||||
|
|
||||||
R[celli] = axesRotation(e3_, dir).R();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::cylindrical::cylindrical(const cylindrical& r)
|
|
||||||
:
|
|
||||||
Rptr_(r.Rptr_.clone()),
|
|
||||||
origin_(r.origin_),
|
|
||||||
e3_(r.e3_)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::cylindrical::cylindrical(const tensorField& R)
|
|
||||||
:
|
|
||||||
Rptr_(),
|
|
||||||
origin_(Zero),
|
|
||||||
e3_(Zero)
|
|
||||||
{
|
|
||||||
Rptr_() = R;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::cylindrical::cylindrical(const dictionary& dict)
|
|
||||||
:
|
|
||||||
Rptr_(),
|
|
||||||
origin_(Zero),
|
|
||||||
e3_(Zero)
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< " cylindrical can not be constructed from dictionary "
|
|
||||||
<< " use the constructor : "
|
|
||||||
"("
|
|
||||||
" const dictionary&, const objectRegistry&"
|
|
||||||
")"
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::cylindrical::cylindrical
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const objectRegistry& obr
|
|
||||||
)
|
|
||||||
:
|
|
||||||
Rptr_(),
|
|
||||||
origin_(Zero),
|
|
||||||
e3_(Zero)
|
|
||||||
{
|
|
||||||
// If origin is specified in the coordinateSystem
|
|
||||||
dict.parent().readIfPresent("origin", origin_);
|
|
||||||
|
|
||||||
// Rotation axis
|
|
||||||
dict.readEntry("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
|
|
||||||
)
|
|
||||||
:
|
|
||||||
Rptr_(),
|
|
||||||
origin_(origin),
|
|
||||||
e3_(axis)
|
|
||||||
{
|
|
||||||
init(obr, cells);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::cylindrical::clear()
|
|
||||||
{
|
|
||||||
Rptr_.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::cylindrical::updateCells
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const labelList& cells
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const vectorField& cc = mesh.cellCentres();
|
|
||||||
tensorField& R = Rptr_();
|
|
||||||
|
|
||||||
forAll(cells, i)
|
|
||||||
{
|
|
||||||
const label celli = cells[i];
|
|
||||||
vector dir = cc[celli] - origin_;
|
|
||||||
dir /= mag(dir) + VSMALL;
|
|
||||||
|
|
||||||
R[celli] = axesRotation(e3_, dir).R();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::cylindrical::transform
|
|
||||||
(
|
|
||||||
const vectorField& vf
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (Rptr_->size() != vf.size())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "vectorField st has different size to tensorField "
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Rptr_() & vf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::cylindrical::transform(const vector& v) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::cylindrical::transform
|
|
||||||
(
|
|
||||||
const vector& v,
|
|
||||||
const label cmptI
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return (Rptr_()[cmptI] & v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField> Foam::cylindrical::invTransform
|
|
||||||
(
|
|
||||||
const vectorField& vf
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return (Rptr_().T() & vf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::cylindrical::invTransform(const vector& v) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::vector Foam::cylindrical::invTransform
|
|
||||||
(
|
|
||||||
const vector& v,
|
|
||||||
const label cmptI
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return (Rptr_()[cmptI].T() & v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::tensorField> Foam::cylindrical::transformTensor
|
|
||||||
(
|
|
||||||
const tensorField& tf
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (Rptr_->size() != tf.size())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "tensorField st has different size to tensorField Tr"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
return (Rptr_() & tf & Rptr_().T());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tensor Foam::cylindrical::transformTensor
|
|
||||||
(
|
|
||||||
const tensor& t
|
|
||||||
) 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)
|
|
||||||
{
|
|
||||||
const label celli = cellMap[i];
|
|
||||||
t[i] = R[celli] & tf[i] & Rtr[celli];
|
|
||||||
}
|
|
||||||
|
|
||||||
return tt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::symmTensorField> Foam::cylindrical::transformVector
|
|
||||||
(
|
|
||||||
const vectorField& vf
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (Rptr_->size() != vf.size())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "tensorField vf has different size to tensorField Tr"
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp<symmTensorField> tfld(new symmTensorField(Rptr_->size()));
|
|
||||||
symmTensorField& fld = tfld.ref();
|
|
||||||
|
|
||||||
const tensorField& R = Rptr_();
|
|
||||||
forAll(fld, i)
|
|
||||||
{
|
|
||||||
fld[i] = transformPrincipal(R[i], vf[i]);
|
|
||||||
}
|
|
||||||
return tfld;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::symmTensor Foam::cylindrical::transformVector
|
|
||||||
(
|
|
||||||
const vector& v
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::cylindrical::write(Ostream& os) const
|
|
||||||
{
|
|
||||||
os.writeEntry("e3", e3());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,251 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::cylindrical
|
|
||||||
|
|
||||||
Description
|
|
||||||
A local coordinate rotation.
|
|
||||||
|
|
||||||
The cell based 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
|
|
||||||
(cylindrical coordinates). For example:
|
|
||||||
\verbatim
|
|
||||||
cylindrical
|
|
||||||
{
|
|
||||||
type localAxes;
|
|
||||||
e3 (0 0 1);
|
|
||||||
}
|
|
||||||
\endverbatim
|
|
||||||
|
|
||||||
-# The rotational tensor field is provided at construction.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
cylindrical.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef cylindrical_H
|
|
||||||
#define cylindrical_H
|
|
||||||
|
|
||||||
#include "point.H"
|
|
||||||
#include "vector.H"
|
|
||||||
#include "ListOps.H"
|
|
||||||
#include "coordinateRotation.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class cylindrical Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class cylindrical
|
|
||||||
:
|
|
||||||
public coordinateRotation
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- An autoPtr to the transformation tensor
|
|
||||||
autoPtr<tensorField> Rptr_;
|
|
||||||
|
|
||||||
//- Origin of the coordinate system
|
|
||||||
point origin_;
|
|
||||||
|
|
||||||
//- Rotation axis
|
|
||||||
vector e3_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private members
|
|
||||||
|
|
||||||
//- Init transformation tensor field
|
|
||||||
void init
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const labelUList& cells = Foam::emptyLabelList
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName("cylindrical");
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct as copy
|
|
||||||
cylindrical(const cylindrical& r);
|
|
||||||
|
|
||||||
//- Construct from tensor Field
|
|
||||||
explicit cylindrical(const tensorField& R);
|
|
||||||
|
|
||||||
//- Construct from dictionary - for API compatibility only
|
|
||||||
explicit cylindrical(const dictionary& dict);
|
|
||||||
|
|
||||||
//- Construct from dictionary and objectRegistry
|
|
||||||
cylindrical(const dictionary& dict, const objectRegistry& obr);
|
|
||||||
|
|
||||||
//- Construct from components for all cells
|
|
||||||
cylindrical
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const vector& axis,
|
|
||||||
const point& origin
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from components for list of cells
|
|
||||||
cylindrical
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const vector& axis,
|
|
||||||
const point& origin,
|
|
||||||
const List<label>& cells
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Return clone
|
|
||||||
autoPtr<coordinateRotation> clone() const
|
|
||||||
{
|
|
||||||
return autoPtr<coordinateRotation>::NewFrom<cylindrical>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~cylindrical() = default;
|
|
||||||
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
//- Return local-to-global transformation tensor
|
|
||||||
virtual const tensor& R() const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
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
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return vector::zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian y-axis in global coordinates
|
|
||||||
virtual const vector e2() const
|
|
||||||
{
|
|
||||||
NotImplemented;
|
|
||||||
return vector::zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return local Cartesian z-axis in global coordinates
|
|
||||||
virtual const vector e3() const
|
|
||||||
{
|
|
||||||
return e3_;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual const tensorField& Tr() const
|
|
||||||
{
|
|
||||||
return *Rptr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Transform vectorField using transformation tensor field
|
|
||||||
virtual tmp<vectorField> transform(const vectorField& tf) const;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor
|
|
||||||
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
|
|
||||||
virtual bool uniform() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Transform tensor field using transformation tensorField
|
|
||||||
virtual tmp<tensorField> transformTensor(const tensorField& tf) const;
|
|
||||||
|
|
||||||
//- 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
|
|
||||||
(
|
|
||||||
const vectorField& vf
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Transform vector using transformation tensor and return
|
|
||||||
// symmetrical tensor (R & st & R.T())
|
|
||||||
virtual symmTensor transformVector(const vector& v) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Write
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
virtual void write(Ostream&) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
101
src/meshTools/coordinate/rotation/cylindricalRotation.C
Normal file
101
src/meshTools/coordinate/rotation/cylindricalRotation.C
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "cylindricalRotation.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
defineTypeName(cylindrical);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
coordinateRotation,
|
||||||
|
cylindrical,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tensor Foam::coordinateRotations::cylindrical::rotation
|
||||||
|
(
|
||||||
|
const vector& axis
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Guess second axis
|
||||||
|
return axes::rotation(axis, Zero, E3_E1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::coordinateRotations::cylindrical::cylindrical(const cylindrical& crot)
|
||||||
|
:
|
||||||
|
coordinateRotations::axes(crot)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::cylindrical::cylindrical(const vector& axis)
|
||||||
|
:
|
||||||
|
coordinateRotations::axes(axis) // Guess second axis
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::cylindrical::cylindrical(const dictionary& dict)
|
||||||
|
:
|
||||||
|
cylindrical(dict.getCompat<vector>("axis", {{"e3", -1806}}))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::cylindrical::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << type() << " axis: " << axis1_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::cylindrical::writeEntry
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.beginBlock(keyword);
|
||||||
|
|
||||||
|
os.writeEntry("type", type());
|
||||||
|
os.writeEntry("axis", axis1_);
|
||||||
|
|
||||||
|
os.endBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
122
src/meshTools/coordinate/rotation/cylindricalRotation.H
Normal file
122
src/meshTools/coordinate/rotation/cylindricalRotation.H
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::coordinateRotations::cylindrical
|
||||||
|
|
||||||
|
Description
|
||||||
|
A special purpose coordinateRotation that is generally for use in
|
||||||
|
combination with a cylindricalCS when only the orientation of the
|
||||||
|
local Z-axis is relevant.
|
||||||
|
|
||||||
|
\heading Dictionary entries
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default
|
||||||
|
type | Type name: cylindrical | yes |
|
||||||
|
axis | The z-axis | yes |
|
||||||
|
e3 | Alias for 'axis' | no |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cylindricalRotation.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef coordinateRotations_cylindrical_H
|
||||||
|
#define coordinateRotations_cylindrical_H
|
||||||
|
|
||||||
|
#include "axesRotation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class coordinateRotations::cylindrical Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cylindrical
|
||||||
|
:
|
||||||
|
public coordinateRotations::axes
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeNameNoDebug("cylindrical");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
cylindrical(const cylindrical& crot);
|
||||||
|
|
||||||
|
//- Construct from single axis (as e3) using best-guess for the
|
||||||
|
//- second axis.
|
||||||
|
explicit cylindrical(const vector& axis);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
explicit cylindrical(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Return clone
|
||||||
|
autoPtr<coordinateRotation> clone() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
autoPtr<coordinateRotation>::NewFrom
|
||||||
|
<coordinateRotations::cylindrical>(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cylindrical() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Static Member Functions
|
||||||
|
|
||||||
|
//- The rotation tensor calculated from axes and order.
|
||||||
|
// The input axes will be normalised.
|
||||||
|
static tensor rotation(const vector& axis);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Write information
|
||||||
|
virtual void write(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write dictionary entry
|
||||||
|
virtual void writeEntry(const word& keyword, Ostream& os) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace coordinateRotations
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
99
src/meshTools/coordinate/rotation/identityRotation.C
Normal file
99
src/meshTools/coordinate/rotation/identityRotation.C
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "identityRotation.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace coordinateRotations
|
||||||
|
{
|
||||||
|
defineTypeName(identity);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
coordinateRotation,
|
||||||
|
identity,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::coordinateRotations::identity::identity()
|
||||||
|
:
|
||||||
|
coordinateRotation()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::identity::identity(const identity&)
|
||||||
|
:
|
||||||
|
identity()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coordinateRotations::identity::identity(const dictionary&)
|
||||||
|
:
|
||||||
|
identity()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::identity::clear()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tensor Foam::coordinateRotations::identity::R() const
|
||||||
|
{
|
||||||
|
return sphericalTensor::I;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::identity::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os << "identity rotation";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coordinateRotations::identity::writeEntry
|
||||||
|
(
|
||||||
|
const word& keyword,
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.beginBlock(keyword);
|
||||||
|
|
||||||
|
os.writeEntry("type", type());
|
||||||
|
|
||||||
|
os.endBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user