FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

createFields.H

Go to the documentation of this file.
00001 Info<< "Reading combustion properties\n" << endl;
00002 
00003 IOdictionary engineGeometry
00004 (
00005     IOobject
00006     (
00007         "engineGeometry",
00008         runTime.constant(),
00009         mesh,
00010         IOobject::MUST_READ,
00011         IOobject::NO_WRITE
00012     )
00013 );
00014 
00015 vector swirlAxis
00016 (
00017     engineGeometry.lookup("swirlAxis")
00018 );
00019 
00020 vector swirlCenter
00021 (
00022     engineGeometry.lookup("swirlCenter")
00023 );
00024 
00025 dimensionedScalar swirlRPMRatio
00026 (
00027     engineGeometry.lookup("swirlRPMRatio")
00028 );
00029 
00030 dimensionedScalar swirlProfile
00031 (
00032     engineGeometry.lookup("swirlProfile")
00033 );
00034 
00035 dimensionedScalar bore
00036 (
00037     engineGeometry.lookup("bore")
00038 );
00039 
00040 dimensionedScalar rpm
00041 (
00042     engineGeometry.lookup("rpm")
00043 );
00044 
00045 
00046 Info<< "Reading field U\n" << endl;
00047 volVectorField U
00048 (
00049     IOobject
00050     (
00051         "U",
00052         runTime.timeName(),
00053         mesh,
00054         IOobject::MUST_READ,
00055         IOobject::AUTO_WRITE
00056     ),
00057     mesh
00058 );
00059 
00060 vector zT = swirlAxis;
00061 vector yT = vector(0, zT.z(), -zT.y());
00062 vector xT = vector(zT.y()*zT.y() + zT.z()*zT.z(), -zT.x()*zT.y(), -zT.x()*zT.z());
00063 
00064 // if swirl is around (1, 0, 0) we have to find another transformation
00065 if (mag(yT) < SMALL)
00066 {
00067     yT = vector(zT.y(), -zT.x(), 0);
00068     xT = vector(-zT.x()*zT.z(), -zT.y()*zT.z(), zT.x()*zT.x() + zT.y()*zT.y());
00069 }
00070 
00071 //swirlAxis doesn't have to be of unit length.
00072 xT /= mag(xT);
00073 yT /= mag(yT);
00074 zT /= mag(zT);
00075 
00076 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines