void Foam::thoboisMesh::addZonesAndModifiers() { // Add the zones and mesh modifiers to operate piston motion if ( pointZones().size() > 0 && faceZones().size() > 0 && topoChanger_.size() > 0 ) { Info<< "Time = " << engTime().theta() << endl; Info<< "void Foam::thoboisMesh::addZonesAndModifiers() : " << "Zones and modifiers already present. Skipping." << endl; setVirtualPositions(); checkAndCalculate(); Info << "Point zones found = " << pointZones().size() << endl; Info << "Face zones found = " << faceZones().size() << endl; Info << "Cell zones found = " << cellZones().size() << endl; return; } else { pointZones().setSize(0); faceZones().setSize(0); cellZones().setSize(0); topoChanger_.setSize(0); } Info << "checkAndCalculate()" << endl; checkAndCalculate(); Info<< "Time = " << engTime().theta() << endl << "Adding zones to the engine mesh" << endl; /* Point zones 1) Piston points */ DynamicList<pointZone*> pz; /* Face zones 1) Piston layer faces */ DynamicList<faceZone*> fz; /* */ DynamicList<cellZone*> cz; label nPointZones = 0; label nFaceZones = 0; label nCellZones = 0; /* Adding the following faces zones: 1: pistonLayerFaces nv: movingFaces nv: staticFaces nv: detachFaces Adding the following point zones: 1: pistonPoints nv: movingValvePoints nv: staticValvePoints */ # include "addPistonFacesPointZonesThoboisMesh.H" //# include "addAttachDetachFacesThoboisMesh.H" Info<< "Adding " << nPointZones << " point, " << nFaceZones << " face zones and " << nCellZones << " cell zones" << endl; # include "addValveFaceZonesThoboisMesh.H" pz.setSize(nPointZones); Info << "setSize pz" << endl; fz.setSize(nFaceZones); Info << "setSize fz" << endl; cz.setSize(nCellZones); Info << "setSize cz" << endl; addZones(pz, fz, cz); # include "addMeshModifiersThoboisMesh.H" // Calculating the virtual positions of piston and valves setVirtualPositions(); // Write mesh and modifiers topoChanger_.writeOpt() = IOobject::AUTO_WRITE; write(); Info << "virtualPistonPosition = " << virtualPistonPosition() << endl; Info << "piston position = " << pistonPosition() << endl; }
void Foam::simpleTwoStroke::addZonesAndModifiers() { // Add the zones and mesh modifiers to operate piston motion if ( pointZones().size() > 0 || faceZones().size() > 0 || cellZones().size() > 0 ) { Info<< "Time = " << engTime().theta() << endl; Info<< "void simpleTwoStroke::addZonesAndModifiers() : " << "Zones and modifiers already present. Skipping." << endl; if (topoChanger_.size() == 0) { FatalErrorIn ( "void simpleTwoStroke::addZonesAndModifiers()" ) << "Mesh modifiers not read properly" << abort(FatalError); } setVirtualPistonPosition(); checkAndCalculate(); return; } Info << "checkAndCalculate()" << endl; checkAndCalculate(); Info<< "Time = " << engTime().theta() << endl << "Adding zones to the engine mesh" << endl; //fz = 4: virtual piston, outSidePort, insidePort, cutFaceZone //pz = 2: piston points, cutPointZone //cz = 1: moving mask List<pointZone*> pz(3); List<faceZone*> fz(4); List<cellZone*> cz(1); label nPointZones = 0; label nFaceZones = 0; label nCellZones = 0; // Add the piston zone if (piston().patchID().active()) { // Piston position Info << "Adding face zone for piston layer addition/removal" << endl; label pistonPatchID = piston().patchID().index(); scalar zPist = max(boundary()[pistonPatchID].patch().localPoints()).z(); scalar zPistV = zPist + offSet(); labelList zone1(faceCentres().size()); boolList flipZone1(faceCentres().size(), false); label nZoneFaces1 = 0; bool foundAtLeastOne = false; scalar zHigher = GREAT; scalar dh = GREAT; scalar dl = GREAT; forAll (faceCentres(), faceI) { // The points have to be in the cylinder and not in the ports.... scalar zc = faceCentres()[faceI].z(); scalar xc = faceCentres()[faceI].x(); scalar yc = faceCentres()[faceI].y(); vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]); scalar dd = n & vector(0,0,1); if(sqrt(sqr(xc)+sqr(yc)) < 0.5 * engTime().bore().value()) { if (dd > 0.1) { if (zPistV - zc > 0 && zPistV - zc < dl) { dl = zPistV - zc; } if (zc - zPistV > 0 && zc - zPistV < dh) { zHigher = zc; dh = zc - zHigher; } if ( zc > zPistV - delta() && zc < zPistV + delta() ) { foundAtLeastOne = true; if ((faceAreas()[faceI] & vector(0,0,1)) < 0) { flipZone1[nZoneFaces1] = true; } zone1[nZoneFaces1] = faceI; nZoneFaces1++; } } } }
void Foam::layerAR::addZonesAndModifiers() { // Add the zones and mesh modifiers to operate piston motion if ( pointZones().size() > 0 || faceZones().size() > 0 || cellZones().size() > 0 ) { Info<< "void layerAR::addZonesAndModifiers() : " << "Zones and modifiers already present. Skipping." << endl; if (topoChanger_.size() == 0) { FatalErrorIn ( "void layerAR::addZonesAndModifiers()" ) << "Mesh modifiers not read properly" << abort(FatalError); } setVirtualPistonPosition(); checkAndCalculate(); return; } checkAndCalculate(); Info<< "Time = " << engTime().theta() << endl << "Adding zones to the engine mesh" << endl; //fz = 1: faces where layer are added/removed //pz = 2: points below the virtual piston faces and head points List<pointZone*> pz(2); List<faceZone*> fz(1); List<cellZone*> cz(0); label nPointZones = 0; label nFaceZones = 0; // Add the piston zone if (piston().patchID().active() && offSet() > SMALL) { // Piston position label pistonPatchID = piston().patchID().index(); scalar zPist = max(boundary()[pistonPatchID].patch().localPoints()).z(); scalar zPistV = zPist + offSet(); labelList zone1(faceCentres().size()); boolList flipZone1(faceCentres().size(), false); label nZoneFaces1 = 0; bool foundAtLeastOne = false; scalar zHigher = GREAT; scalar dh = GREAT; scalar dl = GREAT; forAll (faceCentres(), faceI) { scalar zc = faceCentres()[faceI].z(); vector n = faceAreas()[faceI]/mag(faceAreas()[faceI]); scalar dd = n & vector(0,0,1); if (dd > 0.1) { if (zPistV - zc > 0 && zPistV - zc < dl) { dl = zPistV - zc; } if (zc - zPistV > 0 && zc - zPistV < dh) { zHigher = zc; dh = zc - zHigher; } if ( zc > zPistV - delta() && zc < zPistV + delta() ) { foundAtLeastOne = true; if ((faceAreas()[faceI] & vector(0,0,1)) < 0) { flipZone1[nZoneFaces1] = true; } zone1[nZoneFaces1] = faceI; nZoneFaces1++; } } }
void Foam::layerSmooth::addZonesAndModifiers() { // Add the zones and mesh modifiers to operate piston motion if ( /* pointZones().size() > 0 || faceZones().size() > 0 || cellZones().size() > 0 || topoChanger_.size() > 0 */ pointZones().size() > 0 && faceZones().size() > 0 && topoChanger_.size() > 0 ) { Info<< "Time = " << engTime().theta() << endl; Info<< "void Foam::layerSmooth::addZonesAndModifiers() : " << "Zones and modifiers already present. Skipping." << endl; setVirtualPositions(); checkAndCalculate(); Info << "Point zones found = " << pointZones().size() << endl; Info << "Face zones found = " << faceZones().size() << endl; Info << "Cell zones found = " << cellZones().size() << endl; return; } else { pointZones().setSize(0); faceZones().setSize(0); cellZones().setSize(0); topoChanger_.setSize(0); } if ( engTime().engineDict().found("zOffsetGambit") && engTime().engineDict().found("zDisplGambit") ) { Info << "Assembling the cylinder mesh" << endl; scalar zOffset ( readScalar(engTime().engineDict().lookup("zOffsetGambit")) ); scalar zDispl ( readScalar(engTime().engineDict().lookup("zDisplGambit")) ); const pointField& ap = allPoints(); pointField pDispl = allPoints(); forAll(ap, pointI) { const point p = ap[pointI]; if (p.z() >= zOffset) { pDispl[pointI].z() -= zDispl; } } movePoints(pDispl); write(); resetMotion(); Info << "Cylinder mesh assembled" << endl; }