engineMesh.C
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
00027 #include "engineMesh.H"
00028 #include "dimensionedScalar.H"
00029
00030
00031
00032 defineTypeNameAndDebug(Foam::engineMesh, 0);
00033
00034 defineRunTimeSelectionTable(Foam::engineMesh, IOobject);
00035
00036
00037
00038 Foam::engineMesh::engineMesh(const IOobject& io)
00039 :
00040 fvMesh(io),
00041 engineDB_(refCast<const engineTime>(time())),
00042 pistonIndex_(-1),
00043 linerIndex_(-1),
00044 cylinderHeadIndex_(-1),
00045 deckHeight_("deckHeight", dimLength, GREAT),
00046 pistonPosition_("pistonPosition", dimLength, -GREAT)
00047 {
00048 bool foundPiston = false;
00049 bool foundLiner = false;
00050 bool foundCylinderHead = false;
00051
00052 forAll(boundary(), i)
00053 {
00054 if (boundary()[i].name() == "piston")
00055 {
00056 pistonIndex_ = i;
00057 foundPiston = true;
00058 }
00059 else if (boundary()[i].name() == "liner")
00060 {
00061 linerIndex_ = i;
00062 foundLiner = true;
00063 }
00064 else if (boundary()[i].name() == "cylinderHead")
00065 {
00066 cylinderHeadIndex_ = i;
00067 foundCylinderHead = true;
00068 }
00069 }
00070
00071 reduce(foundPiston, orOp<bool>());
00072 reduce(foundLiner, orOp<bool>());
00073 reduce(foundCylinderHead, orOp<bool>());
00074
00075 if (!foundPiston)
00076 {
00077 FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
00078 << "cannot find piston patch"
00079 << exit(FatalError);
00080 }
00081
00082 if (!foundLiner)
00083 {
00084 FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
00085 << "cannot find liner patch"
00086 << exit(FatalError);
00087 }
00088
00089 if (!foundCylinderHead)
00090 {
00091 FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
00092 << "cannot find cylinderHead patch"
00093 << exit(FatalError);
00094 }
00095
00096 {
00097 if (pistonIndex_ != -1)
00098 {
00099 pistonPosition_.value() = -GREAT;
00100 if (boundary()[pistonIndex_].patch().localPoints().size())
00101 {
00102 pistonPosition_.value() =
00103 max(boundary()[pistonIndex_].patch().localPoints()).z();
00104 }
00105 }
00106 reduce(pistonPosition_.value(), maxOp<scalar>());
00107
00108 if (cylinderHeadIndex_ != -1)
00109 {
00110 deckHeight_.value() = GREAT;
00111 if (boundary()[cylinderHeadIndex_].patch().localPoints().size())
00112 {
00113 deckHeight_.value() = min
00114 (
00115 boundary()[cylinderHeadIndex_].patch().localPoints()
00116 ).z();
00117 }
00118 }
00119 reduce(deckHeight_.value(), minOp<scalar>());
00120
00121 Info<< "deckHeight: " << deckHeight_.value() << nl
00122 << "piston position: " << pistonPosition_.value() << endl;
00123 }
00124 }
00125
00126
00127
00128
00129 Foam::engineMesh::~engineMesh()
00130 {}
00131
00132
Copyright © 2000-2009 OpenCFD Ltd