diff --git a/applications/utilities/mesh/manipulation/moveDyMEngineMesh/Make/options b/applications/utilities/mesh/manipulation/moveDyMEngineMesh/Make/options index 41cbec66d..d42ea07cc 100644 --- a/applications/utilities/mesh/manipulation/moveDyMEngineMesh/Make/options +++ b/applications/utilities/mesh/manipulation/moveDyMEngineMesh/Make/options @@ -11,4 +11,5 @@ EXE_LIBS = \ -lmeshTools \ -ldynamicMesh \ -lengine \ - -lmeshTools + -lmeshTools \ + -llduSolvers diff --git a/applications/utilities/mesh/manipulation/moveDyMEngineMesh/moveDyMEngineMesh.C b/applications/utilities/mesh/manipulation/moveDyMEngineMesh/moveDyMEngineMesh.C index 5a11cd84c..f64fb9631 100644 --- a/applications/utilities/mesh/manipulation/moveDyMEngineMesh/moveDyMEngineMesh.C +++ b/applications/utilities/mesh/manipulation/moveDyMEngineMesh/moveDyMEngineMesh.C @@ -56,10 +56,11 @@ int main(int argc, char *argv[]) "U", runTime.timeName(), mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::NO_READ, + IOobject::NO_WRITE ), - mesh + mesh, + dimensionedVector("zero", dimVelocity, vector::zero) ); volScalarField motionContErr diff --git a/src/engine/Make/files b/src/engine/Make/files index 31b40e0e6..5c97e2acb 100644 --- a/src/engine/Make/files +++ b/src/engine/Make/files @@ -9,10 +9,14 @@ engineVerticalValve/engineVerticalValve.C thoboisSlidingValve/thoboisSlidingValve.C dieselEngineValve/dieselEngineValve.C thoboisValve/thoboisValve.C +accordionValve/accordionValve.C simpleEnginePiston/simpleEnginePiston.C enginePiston/enginePiston.C +engineTopoChangerMesh/regionSide/regionSide.C +engineTopoChangerMesh/attachDetachFunctions/attachDetachFunctions.C + engineMesh/engineMesh/engineMesh.C engineMesh/engineMesh/newEngineMesh.C engineMesh/staticEngineMesh/staticEngineMesh.C @@ -28,10 +32,14 @@ engineTopoChangerMesh/engineTopoChangerMesh/engineTopoChangerMesh.C engineTopoChangerMesh/engineTopoChangerMesh/newEngineTopoChangerMesh.C engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.C -engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshCalculate.C engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshInitialize.C engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshMove.C -engineTopoChangerMesh/accordionEngineMesh/addAccordionEngineMeshModifiers.C +engineTopoChangerMesh/accordionEngineMesh/addAccordionEngineMeshZones.C + +engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.C +engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshInitialize.C +engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshMove.C +engineTopoChangerMesh/deformingEngineMesh/addDeformingEngineMeshZones.C engineTopoChangerMesh/engineValveSliding/addEngineValveSlidingMeshModifiers.C engineTopoChangerMesh/engineValveSliding/engineValveSliding.C diff --git a/src/engine/accordionValve/accordionValve.C b/src/engine/accordionValve/accordionValve.C new file mode 100644 index 000000000..ffdc0b940 --- /dev/null +++ b/src/engine/accordionValve/accordionValve.C @@ -0,0 +1,265 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "accordionValve.H" +#include "engineTime.H" +#include "polyMesh.H" +#include "interpolateXY.H" +#include "IFstream.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::scalar Foam::accordionValve::adjustCrankAngle(const scalar theta) const +{ + if (theta < liftProfileStart_) + { + scalar adjustedTheta = theta; + + while (adjustedTheta < liftProfileStart_) + { + adjustedTheta += liftProfileEnd_ - liftProfileStart_; + } + + return adjustedTheta; + } + else if (theta > liftProfileEnd_) + { + scalar adjustedTheta = theta; + + while (adjustedTheta > liftProfileEnd_) + { + adjustedTheta -= liftProfileEnd_ - liftProfileStart_; + } + + return adjustedTheta; + } + else + { + return theta; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::accordionValve::accordionValve +( + const word& name, + const polyMesh& mesh, + const autoPtr& valveCS, + const word& bottomPatchName, + const word& poppetPatchName, + const word& sidePatchName, + const word& stemPatchName, + const word& detachInCylinderPatchName, + const word& detachInPortPatchName, + const word& detachFacesName, + const graph& liftProfile, + const scalar minLift, + const scalar diameter, + const word& staticCellsName, + const word& movingCellsName +) +: + name_(name), + mesh_(mesh), + engineDB_(refCast(mesh.time())), + csPtr_(valveCS), + bottomPatch_(bottomPatchName, mesh.boundaryMesh()), + poppetPatch_(poppetPatchName, mesh.boundaryMesh()), + sidePatch_(sidePatchName, mesh.boundaryMesh()), + stemPatch_(stemPatchName, mesh.boundaryMesh()), + detachInCylinderPatch_(detachInCylinderPatchName, mesh.boundaryMesh()), + detachInPortPatch_(detachInPortPatchName, mesh.boundaryMesh()), + detachFacesName_(detachFacesName), + liftProfile_(liftProfile), + liftProfileStart_(min(liftProfile_.x())), + liftProfileEnd_(max(liftProfile_.x())), + minLift_(minLift), + diameter_(diameter), + staticCellsName_(staticCellsName), + movingCellsName_(movingCellsName) +{} + + +// Construct from dictionary +Foam::accordionValve::accordionValve +( + const word& name, + const polyMesh& mesh, + const dictionary& dict +) +: + name_(name), + mesh_(mesh), + engineDB_(refCast(mesh_.time())), + csPtr_ + ( + coordinateSystem::New + ( + "coordinateSystem", + dict.subDict("coordinateSystem") + ) + ), + bottomPatch_(dict.lookup("bottomPatch"), mesh.boundaryMesh()), + poppetPatch_(dict.lookup("poppetPatch"), mesh.boundaryMesh()), + sidePatch_(dict.lookup("sidePatch"), mesh.boundaryMesh()), + stemPatch_(dict.lookup("stemPatch"), mesh.boundaryMesh()), + detachInCylinderPatch_ + ( + dict.lookup("detachInCylinderPatch"), + mesh.boundaryMesh() + ), + detachInPortPatch_ + ( + dict.lookup("detachInPortPatch"), + mesh.boundaryMesh() + ), + detachFacesName_(dict.lookup("detachFaces")), + liftProfile_ + ( + "theta", + "lift", + name_, + IFstream + ( + mesh.time().path()/mesh.time().caseConstant()/ + word(dict.lookup("liftProfileFile")) + )() + ), + liftProfileStart_(min(liftProfile_.x())), + liftProfileEnd_(max(liftProfile_.x())), + minLift_(readScalar(dict.lookup("minLift"))), + diameter_(readScalar(dict.lookup("diameter"))), + staticCellsName_(dict.lookup("staticCells")), + movingCellsName_(dict.lookup("movingCells")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::scalar Foam::accordionValve::lift(const scalar theta) const +{ + + label curCycle = theta/720.0; + scalar curTheta = theta - curCycle * 720.0; + + return interpolateXY + ( + curTheta, + liftProfile_.x(), + liftProfile_.y() + ); +} + + +bool Foam::accordionValve::isOpen() const +{ + return lift(engineDB_.theta()) >= minLift_; +} + + +Foam::scalar Foam::accordionValve::curLift() const +{ + return max + ( + lift(engineDB_.theta()), + minLift_ + ); +} + + +Foam::scalar Foam::accordionValve::curVelocity() const +{ + return + -( + curLift() + - max + ( + lift(engineDB_.theta() - engineDB_.deltaTheta()), + minLift_ + ) + )/(engineDB_.deltaT().value() + VSMALL); +} + +Foam::labelList Foam::accordionValve::movingPatchIDs() const +{ + labelList mpIDs(3); + label nMpIDs = 0; + + if (bottomPatch_.active()) + { + mpIDs[nMpIDs] = bottomPatch_.index(); + nMpIDs++; + } + + if (poppetPatch_.active()) + { + mpIDs[nMpIDs] = poppetPatch_.index(); + nMpIDs++; + } + + if (sidePatch_.active()) + { + mpIDs[nMpIDs] = sidePatch_.index(); + nMpIDs++; + } + + mpIDs.setSize(nMpIDs); + + return mpIDs; +} + + +void Foam::accordionValve::writeDict(Ostream& os) const +{ + os << nl << name() << nl << token::BEGIN_BLOCK; + + cs().writeDict(os); + + os << "bottomPatch " << bottomPatch_.name() << token::END_STATEMENT << nl + << "poppetPatch " << poppetPatch_.name() << token::END_STATEMENT << nl + << "sidePatch " << sidePatch_.name() << token::END_STATEMENT << nl + << "stemPatch " << stemPatch_.name() << token::END_STATEMENT << nl + << "detachInCylinderPatch " << detachInCylinderPatch_.name() + << token::END_STATEMENT << nl + << "detachInPortPatch " << detachInPortPatch_.name() + << token::END_STATEMENT << nl + << "detachFaces " << detachFacesName_ << token::END_STATEMENT << nl + << "liftProfile " << nl << token::BEGIN_BLOCK + << liftProfile_ << token::END_BLOCK << token::END_STATEMENT << nl + << "minLift " << minLift_ << token::END_STATEMENT << nl + << "diameter " << diameter_ << token::END_STATEMENT << nl + << "staticCells " << staticCellsName_ << token::END_STATEMENT << nl + << "movingCells " << movingCellsName_ << token::END_STATEMENT << nl + << token::END_BLOCK << endl; +} + +// ************************************************************************* // diff --git a/src/engine/accordionValve/accordionValve.H b/src/engine/accordionValve/accordionValve.H new file mode 100644 index 000000000..7cc088f7b --- /dev/null +++ b/src/engine/accordionValve/accordionValve.H @@ -0,0 +1,284 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + accordionValve + +Description + +SourceFiles + accordionValve.C + +\*---------------------------------------------------------------------------*/ + +#ifndef accordionValve_H +#define accordionValve_H + +#include "word.H" +#include "coordinateSystem.H" +#include "polyPatchID.H" +#include "graph.H" + +#include "faceSet.H" +#include "pointSet.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Class forward declarations +class polyMesh; +class engineTime; + +/*---------------------------------------------------------------------------*\ + Class accordionValve Declaration +\*---------------------------------------------------------------------------*/ + +class accordionValve +{ + // Private data + + //- Name of valve + word name_; + + //- Reference to engine mesh + const polyMesh& mesh_; + + //- Reference to engine database + const engineTime& engineDB_; + + //- Coordinate system + autoPtr csPtr_; + + + // Patch and zone names + + //- Valve bottom patch + polyPatchID bottomPatch_; + + //- Valve poppet patch + polyPatchID poppetPatch_; + + //- Valve poppet patch + polyPatchID sidePatch_; + + //- Valve stem patch + polyPatchID stemPatch_; + + //- Valve detach in cylinder patch + polyPatchID detachInCylinderPatch_; + + //- Valve detach in port patch + polyPatchID detachInPortPatch_; + + //- Faces to detach + //labelList detachFaces_; + word detachFacesName_; + + // Valve lift data + + //- Valve lift profile + graph liftProfile_; + + //- Lift curve start angle + scalar liftProfileStart_; + + //- Lift curve end angle + scalar liftProfileEnd_; + + //- Minimum valve lift. On this lift the valve is considered closed + const scalar minLift_; + + //- Valve diameter + const scalar diameter_; + + // Mesh motion data + + //- Name of the cellSet for the static cells + word staticCellsName_; + + //- Name of the cellSet for the moving cells + word movingCellsName_; + + // Private Member Functions + + //- Disallow default bitwise copy construct + accordionValve(const accordionValve&); + + //- Disallow default bitwise assignment + void operator=(const accordionValve&); + + + //- Adjust crank angle to drop within the limits of the lift profile + scalar adjustCrankAngle(const scalar theta) const; + +public: + + // Static data members + + // Constructors + + //- Construct from components + accordionValve + ( + const word& name, + const polyMesh& mesh, + const autoPtr& valveCS, + const word& bottomPatchName, + const word& poppetPatchName, + const word& sidePatchName, + const word& stemPatchName, + const word& detachInCylinderPatchName, + const word& detachInPortPatchName, + const word& detachFacesName, + const graph& liftProfile, + const scalar minLift, + const scalar diameter, + const word& staticCellsName, + const word& movingCellsName + ); + + //- Construct from dictionary + accordionValve + ( + const word& name, + const polyMesh& mesh, + const dictionary& dict + ); + + // Destructor - default + + + // Member Functions + + //- Return name + const word& name() const + { + return name_; + } + + //- Return coordinate system + const coordinateSystem& cs() const + { + return csPtr_(); + } + + //- Return lift profile + const graph& liftProfile() const + { + return liftProfile_; + } + + //- Return valve diameter + scalar diameter() const + { + return diameter_; + } + + // Valve patches + + //- Return ID of bottom patch + const polyPatchID& bottomPatchID() const + { + return bottomPatch_; + } + + //- Return ID of poppet patch + const polyPatchID& poppetPatchID() const + { + return poppetPatch_; + } + + //- Return ID of side patch + const polyPatchID& sidePatchID() const + { + return sidePatch_; + } + + //- Return ID of stem patch + const polyPatchID& stemPatchID() const + { + return stemPatch_; + } + + //- Return ID of detach in cylinder patch + const polyPatchID& detachInCylinderPatchID() const + { + return detachInCylinderPatch_; + } + + //- Return ID of detach in port patch + const polyPatchID& detachInPortPatchID() const + { + return detachInPortPatch_; + } + + //- Return face labels of detach curtain + const word& detachFacesName() const + { + return detachFacesName_; + } + + const word& staticCellsName() const + { + return staticCellsName_; + } + + const word& movingCellsName() const + { + return movingCellsName_; + } + + // Valve position and velocity + + //- Return valve lift given crank angle in degrees + scalar lift(const scalar theta) const; + + //- Is the valve open? + bool isOpen() const; + + //- Return current lift + scalar curLift() const; + + //- Return valve velocity for current time-step + scalar curVelocity() const; + + //- Return list of active patch labels for the valve head + // (stem is excluded) + labelList movingPatchIDs() const; + + //- Write dictionary + void writeDict(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/engine/accordionValve/accordionValveBank.H b/src/engine/accordionValve/accordionValveBank.H new file mode 100644 index 000000000..f817e314c --- /dev/null +++ b/src/engine/accordionValve/accordionValveBank.H @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + accordionValveBank + +Description + A list of valves. + + +\*---------------------------------------------------------------------------*/ + +#ifndef accordionValveBank_H +#define accordionValveBank_H + +#include "PtrList.H" +#include "accordionValve.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class accordionValveBank Declaration +\*---------------------------------------------------------------------------*/ + +class accordionValveBank +: + public PtrList +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + accordionValveBank(const accordionValveBank&); + + //- Disallow default bitwise assignment + void operator=(const accordionValveBank&); + + +public: + + // Constructors + + //- Construct from Istream + accordionValveBank + ( + const polyMesh& mesh, + Istream& is + ) + { + PtrList valveEntries(is); + + setSize(valveEntries.size()); + + forAll (valveEntries, valveI) + { + set + ( + valveI, + new accordionValve + ( + valveEntries[valveI].keyword(), + mesh, + valveEntries[valveI].dict() + ) + ); + } + } + + // Destructor - default + + // Member Functions +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.C b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.C index 0dff51b7f..6ab39bd14 100644 --- a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.C +++ b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.C @@ -24,9 +24,8 @@ License \*---------------------------------------------------------------------------*/ + #include "accordionEngineMesh.H" -#include "layerAdditionRemoval.H" -#include "attachDetach.H" #include "componentMixedTetPolyPatchVectorField.H" #include "mapPolyMesh.H" #include "polyTopoChange.H" @@ -45,7 +44,12 @@ License namespace Foam { defineTypeNameAndDebug(accordionEngineMesh, 0); - addToRunTimeSelectionTable(engineTopoChangerMesh, accordionEngineMesh, IOobject); + addToRunTimeSelectionTable + ( + engineTopoChangerMesh, + accordionEngineMesh, + IOobject + ); } @@ -53,11 +57,15 @@ namespace Foam - + bool Foam::accordionEngineMesh::realDeformation() const { - if (virtualPistonPosition() + engTime().pistonDisplacement().value() > deckHeight_ - SMALL) + if + ( + virtualPistonPosition() + engTime().pistonDisplacement().value() + > deckHeight_ - SMALL + ) { return true; } @@ -73,32 +81,26 @@ bool Foam::accordionEngineMesh::realDeformation() const Foam::accordionEngineMesh::accordionEngineMesh ( const IOobject& io +// bool addZonesAndMods ) : engineTopoChangerMesh(io), piston_(*this, engTime().engineDict().subDict("piston")), valves_(*this, engTime().engineDict().lookup("accordionEngineMesh")), - deformSwitch_(readScalar(engTime().engineDict().lookup("deformAngle"))), - delta_(readScalar(engTime().engineDict().lookup("delta"))), - offSet_(readScalar(engTime().engineDict().lookup("offSet"))), pistonPosition_(-GREAT), virtualPistonPosition_(-GREAT), deckHeight_(GREAT), - msPtr_(motionSolver::New(*this)), cylinderHeadName_(engTime().engineDict().lookup("cylinderHeadName")), linerName_(engTime().engineDict().lookup("linerName")), - pistonAuxPoints_(engTime().engineDict().lookup("pistonAuxPoints")), - moveDetach_(engTime().engineDict().lookup("moveDetach")) + headCellSetName_(engTime().engineDict().lookup("headCellSetName")) { // Add zones and modifiers if not already there. - addZonesAndModifiers(); + addMeshZones(); + msPtr_ = motionSolver::New(*this); } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -118,32 +120,8 @@ void Foam::accordionEngineMesh::setBoundaryVelocity(volVectorField& U) U.boundaryField()[valves()[valveI].stemPatchID().index()] == valveVel; } - - // If valve is present in geometry, set the motion - if (valves()[valveI].detachInPortPatchID().active()) - { - // Bottom of the valve moves with given velocity - U.boundaryField()[valves()[valveI].detachInPortPatchID().index()] == - vector::zero; - U.oldTime().boundaryField()[valves()[valveI].detachInPortPatchID().index()] == - vector::zero; - } - - // If valve is present in geometry, set the motion - if (valves()[valveI].detachInCylinderPatchID().active()) - { - // Bottom of the valve moves with given velocity - U.boundaryField()[valves()[valveI].detachInCylinderPatchID().index()] == - vector::zero; - U.oldTime().boundaryField()[valves()[valveI].detachInCylinderPatchID().index()] == - vector::zero; - } - } - } - - // ************************************************************************* // diff --git a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.H b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.H index f98c91092..960bd864f 100644 --- a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.H +++ b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMesh.H @@ -26,13 +26,11 @@ CLASS accordionEngineMesh DESCRIPTION - Engine mesh class for canted valves engine. Layers are added/removed on the - piston, while mesh is deformed close to the valves. Attach/detach boundary - is used. There are no sliding interfaces. */ // ------------------------------------------------------------------------- // + #ifndef accordionEngineMesh_H #define accordionEngineMesh_H @@ -40,7 +38,7 @@ DESCRIPTION #include "enginePiston.H" #include "motionSolver.H" #include "polyPatchID.H" -#include "thoboisValveBank.H" +#include "accordionValveBank.H" #include "twoDPointCorrector.H" #include "faceSet.H" @@ -67,19 +65,10 @@ class accordionEngineMesh //- Piston patch enginePiston piston_; - - //- Lateral valves - thoboisValveBank valves_; - - //- Layering-to-deformation switch in crank-angle degrees - scalar deformSwitch_; - - //- Tolerance used when the piston faceZone is created - scalar delta_; - //- Distance from the piston patch - scalar offSet_; - + //- Lateral valves + accordionValveBank valves_; + //- Piston Position scalar pistonPosition_; @@ -88,21 +77,23 @@ class accordionEngineMesh //- deckHeight scalar deckHeight_; - + //- Motion solver autoPtr msPtr_; //- Cylinder head name - word cylinderHeadName_; - + word cylinderHeadName_; + //- Cylinder head name - word linerName_; - + word linerName_; + //- PistonFaceSet - word pistonAuxPoints_; - - Switch moveDetach_; - +// word pistonAuxPoints_; + + //- PistonFaceSet + word headCellSetName_; + + // Private Member Functions //- Disallow default bitwise copy construct @@ -111,30 +102,16 @@ class accordionEngineMesh //- Disallow default bitwise assignment void operator=(const accordionEngineMesh&); - //- Make layering modifiers live - void makeLayersLive(); - - //- Make attach-detach live - void makeDetachLive(); - - //- Prepare valve attach/detach - void valveDetach(); - - //- Prepare valve attach/detach - void valveAttach(); - - //- Prepare valve attach/detach - void prepareValveDetach(); - - //- Check if all patches exist, then calculate virtualPistonPosition, + //- Check if all patches exist, then calculate virtualPistonPosition, //- pistonPosition and deckHeight for the first time void checkAndCalculate(); - - //- Calculate the virtualPistonPosition, + + //- Calculate the virtualPistonPosition void setVirtualPositions(); - + bool realDeformation() const; - + + public: //- Runtime type information @@ -147,16 +124,16 @@ public: explicit accordionEngineMesh(const IOobject& io); - // Destructor - default + // Destructor + + virtual ~accordionEngineMesh() + {} // Member Functions inline const enginePiston& piston() const; - inline const thoboisValveBank& valves() const; - inline const scalar& deformSwitch() const; - inline const scalar& delta() const; - inline const scalar& offSet() const; + inline const accordionValveBank& valves() const; inline const scalar& pistonPosition() const; inline scalar& pistonPosition(); inline const scalar& virtualPistonPosition() const; @@ -168,9 +145,7 @@ public: //- Return true for mesh deformation mode bool deformation() const { - return - engTime().thetaRevolution() > -deformSwitch_ - && engTime().thetaRevolution() < deformSwitch_; + return true; } //- Return number of valves @@ -180,7 +155,7 @@ public: } //- Add valve and piston zones and modifiers - void addZonesAndModifiers(); + void addMeshZones(); //- Move and morph virtual bool update(); diff --git a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshI.H b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshI.H index 02bada464..1c51ef3c4 100644 --- a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshI.H +++ b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshI.H @@ -37,26 +37,11 @@ inline const enginePiston& accordionEngineMesh::piston() const } -inline const thoboisValveBank& accordionEngineMesh::valves() const +inline const accordionValveBank& accordionEngineMesh::valves() const { return valves_; } -inline const scalar& accordionEngineMesh::deformSwitch() const -{ - return deformSwitch_; -} - -inline const scalar& accordionEngineMesh::delta() const -{ - return delta_; -} - -inline const scalar& accordionEngineMesh::offSet() const -{ - return offSet_; -} - inline const scalar& accordionEngineMesh::pistonPosition() const { diff --git a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshInitialize.C b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshInitialize.C index cf396c071..562c53b22 100644 --- a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshInitialize.C +++ b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshInitialize.C @@ -25,8 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "accordionEngineMesh.H" -#include "slidingInterface.H" -#include "layerAdditionRemoval.H" #include "surfaceFields.H" #include "regionSplit.H" diff --git a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshMove.C b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshMove.C index fefdc6265..2847481eb 100644 --- a/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshMove.C +++ b/src/engine/engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshMove.C @@ -25,9 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "accordionEngineMesh.H" -#include "slidingInterface.H" -#include "layerAdditionRemoval.H" -#include "attachDetach.H" #include "surfaceFields.H" #include "regionSplit.H" #include "componentMixedTetPolyPatchVectorField.H" @@ -56,210 +53,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::accordionEngineMesh::makeLayersLive() -{ - // Enable layering - forAll (topoChanger_, modI) - { - if (isA(topoChanger_[modI])) - { - topoChanger_[modI].enable(); - } - else if (isA(topoChanger_[modI])) - { - topoChanger_[modI].disable(); - } - else if (isA(topoChanger_[modI])) - { - topoChanger_[modI].enable(); - } - else - { - FatalErrorIn("void Foam::engineTopoFvMesh::makeLayersLive()") - << "Don't know what to do with mesh modifier " - << modI << " of type " << topoChanger_[modI].type() - << abort(FatalError); - } - } -} - -void Foam::accordionEngineMesh::makeDetachLive() -{ - // Enable sliding interface - forAll (topoChanger_, modI) - { - if (isA(topoChanger_[modI])) - { - topoChanger_[modI].enable(); - } - else - { - FatalErrorIn("void Foam::accordionEngineMesh::makeDetachLive()") - << "Don't know what to do with mesh modifier " - << modI << " of type " << topoChanger_[modI].type() - << abort(FatalError); - } - } -} - - -void Foam::accordionEngineMesh::valveDetach() -{ - // Enable sliding interface - forAll (topoChanger_, modI) - { - if (isA(topoChanger_[modI])) - { - const attachDetach& ad = - refCast(topoChanger_[modI]); - - const word masterName = ad.masterPatchID().name(); - - // Find the valve with that name - label valveIndex = -1; - - forAll (valves_, valveI) - { - if - ( - valves_[valveI].detachInCylinderPatchID().name() - == masterName - ) - { - valveIndex = valveI; - break; - } - } - - if (valveIndex < 0) - { - FatalErrorIn - ( - "void Foam::engineTopoFvMesh::prepareValveDetach()" - ) << "Cannot match patch for attach/detach " << modI - << abort(FatalError); - } - - if (debug) - { - Info<< " valveI: " << valveIndex << " attached: " - << ad.attached() - << " valve open: " << valves_[valveIndex].isOpen() - << endl; - } - - ad.setDetach(); - } - } -} - -void Foam::accordionEngineMesh::valveAttach() -{ - // Enable sliding interface - forAll (topoChanger_, modI) - { - if (isA(topoChanger_[modI])) - { - const attachDetach& ad = - refCast(topoChanger_[modI]); - - const word masterName = ad.masterPatchID().name(); - - // Find the valve with that name - label valveIndex = -1; - - forAll (valves_, valveI) - { - if - ( - valves_[valveI].detachInCylinderPatchID().name() - == masterName - ) - { - valveIndex = valveI; - break; - } - } - - if (valveIndex < 0) - { - FatalErrorIn - ( - "void Foam::engineTopoFvMesh::prepareValveDetach()" - ) << "Cannot match patch for attach/detach " << modI - << abort(FatalError); - } - - if (debug) - { - Info<< " valveI: " << valveIndex << " attached: " - << ad.attached() - << " valve open: " << valves_[valveIndex].isOpen() - << endl; - } - - ad.setAttach(); - } - } -} - - -void Foam::accordionEngineMesh::prepareValveDetach() -{ - // Enable sliding interface - forAll (topoChanger_, modI) - { - if (isA(topoChanger_[modI])) - { - const attachDetach& ad = - refCast(topoChanger_[modI]); - - const word masterName = ad.masterPatchID().name(); - - // Find the valve with that name - label valveIndex = -1; - - forAll (valves_, valveI) - { - if - ( - valves_[valveI].detachInCylinderPatchID().name() - == masterName - ) - { - valveIndex = valveI; - break; - } - } - - if (valveIndex < 0) - { - FatalErrorIn - ( - "void Foam::engineTopoFvMesh::prepareValveDetach()" - ) << "Cannot match patch for attach/detach " << modI - << abort(FatalError); - } - - if (debug) - { - Info<< " valveI: " << valveIndex << " attached: " - << ad.attached() - << " valve open: " << valves_[valveIndex].isOpen() - << endl; - } - - if (valves_[valveIndex].isOpen()) - { - ad.setAttach(); - } - else - { - ad.setDetach(); - } - } - } -} bool Foam::accordionEngineMesh::update() @@ -267,10 +60,6 @@ bool Foam::accordionEngineMesh::update() tetDecompositionMotionSolver& mSolver = refCast(msPtr_()); - tetPointVectorField& motionU = mSolver.motionU(); - - Info << "motioU.size() = " << motionU.internalField().size() << endl; - scalar deltaZ = engTime().pistonDisplacement().value(); // deltaZ set to zero, FIXED PISTON POSITION @@ -278,31 +67,12 @@ bool Foam::accordionEngineMesh::update() virtualPistonPosition() += deltaZ; - makeDetachLive(); - -// valveDetach(); - - autoPtr topoChangeMap = topoChanger_.changeMesh(); - - if (topoChangeMap->morphing()) - { - mSolver.updateMesh(topoChangeMap()); - Info << "mSolver.updateMesh(topoChangeMap())" << endl; - - if (topoChangeMap->hasMotionPoints()) - { - movePoints(topoChangeMap->preMotionPoints()); - resetMotion(); - setV0(); - } - } - pointField newPoints = points(); { # include "setValveMotionBoundaryConditionAccordionEngineMesh.H" # include "setPistonMotionBoundaryConditionAccordionEngineMesh.H" - + Info << "piston motion" << endl; DynamicList