initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / preProcessing / engineSwirl / createFields.H
blob596273a9bdc520c357e1d0dd2822a428ea0c88c6
1 Info<< "Reading combustion properties\n" << endl;
3 IOdictionary engineGeometry
5     IOobject
6     (
7         "engineGeometry",
8         runTime.constant(),
9         mesh,
10         IOobject::MUST_READ,
11         IOobject::NO_WRITE
12     )
15 vector swirlAxis
17     engineGeometry.lookup("swirlAxis")
20 vector swirlCenter
22     engineGeometry.lookup("swirlCenter")
25 dimensionedScalar swirlRPMRatio
27     engineGeometry.lookup("swirlRPMRatio")
30 dimensionedScalar swirlProfile
32     engineGeometry.lookup("swirlProfile")
35 dimensionedScalar bore
37     engineGeometry.lookup("bore")
40 dimensionedScalar rpm
42     engineGeometry.lookup("rpm")
46 Info<< "Reading field U\n" << endl;
47 volVectorField U
49     IOobject
50     (
51         "U",
52         runTime.timeName(),
53         mesh,
54         IOobject::MUST_READ,
55         IOobject::AUTO_WRITE
56     ),
57     mesh
60 vector zT = swirlAxis;
61 vector yT = vector(0, zT.z(), -zT.y());
62 vector xT = vector(zT.y()*zT.y() + zT.z()*zT.z(), -zT.x()*zT.y(), -zT.x()*zT.z());
64 // if swirl is around (1, 0, 0) we have to find another transformation
65 if (mag(yT) < SMALL)
67     yT = vector(zT.y(), -zT.x(), 0);
68     xT = vector(-zT.x()*zT.z(), -zT.y()*zT.z(), zT.x()*zT.x() + zT.y()*zT.y());
71 //swirlAxis doesn't have to be of unit length.
72 xT /= mag(xT);
73 yT /= mag(yT);
74 zT /= mag(zT);