Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "engineMesh.H"
00027 #include <OpenFOAM/dimensionedScalar.H>
00028
00029
00030
00031 defineTypeNameAndDebug(Foam::engineMesh, 0);
00032
00033 defineRunTimeSelectionTable(Foam::engineMesh, IOobject);
00034
00035
00036
00037 Foam::engineMesh::engineMesh(const IOobject& io)
00038 :
00039 fvMesh(io),
00040 engineDB_(refCast<const engineTime>(time())),
00041 pistonIndex_(-1),
00042 linerIndex_(-1),
00043 cylinderHeadIndex_(-1),
00044 deckHeight_("deckHeight", dimLength, GREAT),
00045 pistonPosition_("pistonPosition", dimLength, -GREAT)
00046 {
00047 bool foundPiston = false;
00048 bool foundLiner = false;
00049 bool foundCylinderHead = false;
00050
00051 forAll(boundary(), i)
00052 {
00053 if (boundary()[i].name() == "piston")
00054 {
00055 pistonIndex_ = i;
00056 foundPiston = true;
00057 }
00058 else if (boundary()[i].name() == "liner")
00059 {
00060 linerIndex_ = i;
00061 foundLiner = true;
00062 }
00063 else if (boundary()[i].name() == "cylinderHead")
00064 {
00065 cylinderHeadIndex_ = i;
00066 foundCylinderHead = true;
00067 }
00068 }
00069
00070 reduce(foundPiston, orOp<bool>());
00071 reduce(foundLiner, orOp<bool>());
00072 reduce(foundCylinderHead, orOp<bool>());
00073
00074 if (!foundPiston)
00075 {
00076 FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
00077 << "cannot find piston patch"
00078 << exit(FatalError);
00079 }
00080
00081 if (!foundLiner)
00082 {
00083 FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
00084 << "cannot find liner patch"
00085 << exit(FatalError);
00086 }
00087
00088 if (!foundCylinderHead)
00089 {
00090 FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
00091 << "cannot find cylinderHead patch"
00092 << exit(FatalError);
00093 }
00094
00095 {
00096 if (pistonIndex_ != -1)
00097 {
00098 pistonPosition_.value() = -GREAT;
00099 if (boundary()[pistonIndex_].patch().localPoints().size())
00100 {
00101 pistonPosition_.value() =
00102 max(boundary()[pistonIndex_].patch().localPoints()).z();
00103 }
00104 }
00105 reduce(pistonPosition_.value(), maxOp<scalar>());
00106
00107 if (cylinderHeadIndex_ != -1)
00108 {
00109 deckHeight_.value() = GREAT;
00110 if (boundary()[cylinderHeadIndex_].patch().localPoints().size())
00111 {
00112 deckHeight_.value() = min
00113 (
00114 boundary()[cylinderHeadIndex_].patch().localPoints()
00115 ).z();
00116 }
00117 }
00118 reduce(deckHeight_.value(), minOp<scalar>());
00119
00120 Info<< "deckHeight: " << deckHeight_.value() << nl
00121 << "piston position: " << pistonPosition_.value() << endl;
00122 }
00123 }
00124
00125
00126
00127
00128 Foam::engineMesh::~engineMesh()
00129 {}
00130
00131