Files
OpenFOAM-12/applications/utilities/preProcessing/engineSwirl/createFields.H
Henry Weller fc2b2d0c05 OpenFOAM: Rationalized the naming of scalar limits
In early versions of OpenFOAM the scalar limits were simple macro replacements and the
names were capitalized to indicate this.  The scalar limits are now static
constants which is a huge improvement on the use of macros and for consistency
the names have been changed to camel-case to indicate this and improve
readability of the code:

    GREAT -> great
    ROOTGREAT -> rootGreat
    VGREAT -> vGreat
    ROOTVGREAT -> rootVGreat
    SMALL -> small
    ROOTSMALL -> rootSmall
    VSMALL -> vSmall
    ROOTVSMALL -> rootVSmall

The original capitalized are still currently supported but their use is
deprecated.
2018-01-25 09:46:37 +00:00

80 lines
1.3 KiB
C

Info<< "Reading combustion properties\n" << endl;
IOdictionary engineGeometry
(
IOobject
(
"engineGeometry",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
vector swirlAxis
(
engineGeometry.lookup("swirlAxis")
);
vector swirlCenter
(
engineGeometry.lookup("swirlCenter")
);
dimensionedScalar swirlRPMRatio
(
engineGeometry.lookup("swirlRPMRatio")
);
dimensionedScalar swirlProfile
(
engineGeometry.lookup("swirlProfile")
);
dimensionedScalar bore
(
engineGeometry.lookup("bore")
);
dimensionedScalar rpm
(
engineGeometry.lookup("rpm")
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
vector zT = swirlAxis;
vector yT = vector(0, zT.z(), -zT.y());
vector xT = vector
(
zT.y()*zT.y() + zT.z()*zT.z(),
-zT.x()*zT.y(),
-zT.x()*zT.z()
);
// if swirl is around (1, 0, 0) we have to find another transformation
if (mag(yT) < small)
{
yT = vector(zT.y(), -zT.x(), 0);
xT = vector(-zT.x()*zT.z(), -zT.y()*zT.z(), zT.x()*zT.x() + zT.y()*zT.y());
}
//swirlAxis doesn't have to be of unit length.
xT /= mag(xT);
yT /= mag(yT);
zT /= mag(zT);