From a942e4c0b3b781c488a1ef7c67e23eaabd36fe87 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 8 Jul 2011 12:04:21 +0100 Subject: [PATCH] Engines updates: Tommaso Lucchini --- src/engine/Make/files | 6 + src/engine/accordionValve/accordionValve.C | 265 ++++++++++++++++ src/engine/accordionValve/accordionValve.H | 284 ++++++++++++++++++ .../accordionValve/accordionValveBank.H | 108 +++++++ .../addDeformingEngineMeshZones.C | 125 ++++++++ .../addOutputCellsDeformingEngineMesh.H | 55 ++++ ...PistonFacesPointZonesDeformingEngineMesh.H | 186 ++++++++++++ .../addValveFaceZonesDeformingEngineMesh.H | 190 ++++++++++++ .../deformingEngineMesh/deformingEngineMesh.C | 115 +++++++ .../deformingEngineMesh/deformingEngineMesh.H | 175 +++++++++++ .../deformingEngineMeshI.H | 81 +++++ .../deformingEngineMeshInitialize.C | 117 ++++++++ .../deformingEngineMeshMove.C | 115 +++++++ .../movePistonPointsDeformingEngineMesh.H | 96 ++++++ .../setDeformingEngineMeshConstraints.H | 90 ++++++ ...tionBoundaryConditionDeformingEngineMesh.H | 22 ++ ...tionBoundaryConditionDeformingEngineMesh.H | 62 ++++ 17 files changed, 2092 insertions(+) create mode 100644 src/engine/accordionValve/accordionValve.C create mode 100644 src/engine/accordionValve/accordionValve.H create mode 100644 src/engine/accordionValve/accordionValveBank.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/addDeformingEngineMeshZones.C create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/addOutputCellsDeformingEngineMesh.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/addPistonFacesPointZonesDeformingEngineMesh.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/addValveFaceZonesDeformingEngineMesh.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.C create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshI.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshInitialize.C create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshMove.C create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/movePistonPointsDeformingEngineMesh.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/setDeformingEngineMeshConstraints.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/setPistonMotionBoundaryConditionDeformingEngineMesh.H create mode 100644 src/engine/engineTopoChangerMesh/deformingEngineMesh/setValveMotionBoundaryConditionDeformingEngineMesh.H diff --git a/src/engine/Make/files b/src/engine/Make/files index 31b40e0e6..53ce49441 100644 --- a/src/engine/Make/files +++ b/src/engine/Make/files @@ -9,6 +9,7 @@ engineVerticalValve/engineVerticalValve.C thoboisSlidingValve/thoboisSlidingValve.C dieselEngineValve/dieselEngineValve.C thoboisValve/thoboisValve.C +accordionValve/accordionValve.C simpleEnginePiston/simpleEnginePiston.C enginePiston/enginePiston.C @@ -33,6 +34,11 @@ engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshInitialize.C engineTopoChangerMesh/accordionEngineMesh/accordionEngineMeshMove.C engineTopoChangerMesh/accordionEngineMesh/addAccordionEngineMeshModifiers.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 engineTopoChangerMesh/engineValveSliding/engineValveSlidingInitialize.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/deformingEngineMesh/addDeformingEngineMeshZones.C b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addDeformingEngineMeshZones.C new file mode 100644 index 000000000..3b1d94b48 --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addDeformingEngineMeshZones.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "deformingEngineMesh.H" +#include "surfaceFields.H" +#include "regionSplit.H" +#include "directTopoChange.H" +#include "zeroGradientTetPolyPatchFields.H" +#include "tetDecompositionMotionSolver.H" + +#include "fixedValueTetPolyPatchFields.H" +#include "mixedTetPolyPatchFields.H" +#include "slipTetPolyPatchFields.H" +#include "zeroGradientTetPolyPatchFields.H" +#include "meshTools.H" +#include "syncTools.H" +#include "HashSet.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::deformingEngineMesh::addMeshZones() +{ + // Add the zones and mesh modifiers to operate piston motion + Switch addBoundary(true); + + if + ( + pointZones().size() > 0 + ) + { + Info<< "Time = " << engTime().theta() << endl; + Info<< "void Foam::deformingEngineMesh::addZonesAndModifiers() : " + << "Zones and modifiers already present. Skipping." + << endl; + + checkAndCalculate(); + + Info << "Point zones found = " << pointZones().size() << endl; + Info << "Face zones found = " << faceZones().size() << endl; + Info << "Cell zones found = " << cellZones().size() << endl; + + } + 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; + + DynamicList pz; + + DynamicList fz; + + DynamicList cz; + + label nPointZones = 0; + label nFaceZones = 0; + label nCellZones = 0; + + +# include "addPistonFacesPointZonesDeformingEngineMesh.H" + +# include "addValveFaceZonesDeformingEngineMesh.H" + +# include "addOutputCellsDeformingEngineMesh.H" + + + Info<< "Adding " << nPointZones << " point, " + << nFaceZones << " face zones and " + << nCellZones << " cell zones" << endl; + + Info << boundary().size() << endl; + + 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); + } + + + // Calculating the virtual positions of piston and valves + + // setVirtualPositions(); + + // Write mesh and modifiers + write(); + Info << "virtualPistonPosition = " << virtualPistonPosition() << endl; + Info << "piston position = " << pistonPosition() << endl; +} + + +// ************************************************************************* // diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/addOutputCellsDeformingEngineMesh.H b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addOutputCellsDeformingEngineMesh.H new file mode 100644 index 000000000..28c914d0f --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addOutputCellsDeformingEngineMesh.H @@ -0,0 +1,55 @@ + { + word cylinderOutputName(engTime().engineDict().lookup("cylinderSetName")); + + IOobject outputHeader + ( + cylinderOutputName, + time().constant()+"/polyMesh/sets/", + *this, + IOobject::MUST_READ + ); + + if(!outputHeader.headerOk()) + { + WarningIn + ( + "deformingEngineMesh::addZonesAndModifiers()" + ) << "faceSet called " << cylinderOutputName + << " does not exist. Continuing mesh motion without cylinder output cells" << endl; + + cz.append + ( + new cellZone + ( + "cylinderOutputCells", + labelList(0), + nCellZones, + cellZones() + ) + ); + + nCellZones++; + + + } + else + { + + cellSet outputCellSet(*this, cylinderOutputName); + + labelList outputCellSetList = outputCellSet.toc(); + + cz.append + ( + new cellZone + ( + "cylinderOutputCells", + outputCellSetList, + nCellZones, + cellZones() + ) + ); + + nCellZones++; + } +} diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/addPistonFacesPointZonesDeformingEngineMesh.H b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addPistonFacesPointZonesDeformingEngineMesh.H new file mode 100644 index 000000000..7279902ea --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addPistonFacesPointZonesDeformingEngineMesh.H @@ -0,0 +1,186 @@ + + // Add the piston points zone + if (piston().patchID().active()) + { + IOobject pistonCellsHeader + ( + piston().pistonCellSetName(), + time().constant()+"/polyMesh/sets/", + *this, + IOobject::MUST_READ + ); + + if(!pistonCellsHeader.headerOk()) + { + WarningIn + ( + "deformingEngineMesh::addZonesAndModifiers()" + ) << "cellSet called " << piston().pistonCellSetName() + << " does not exist. Continuing mesh motion without piston points" << endl; + + pz.append + ( + new pointZone + ( + "movingPistonPoints", + labelList(0), + nPointZones, + pointZones() + ) + ); + + nPointZones++; + + } + else + { + cellSet movingPistonCells(*this, piston().pistonCellSetName()); + + labelList pistonCells = movingPistonCells.toc(); + + labelList movingPistonPoints; + + const labelListList& cp = cellPoints(); + + boolList count(allPoints().size(), false); + + forAll (pistonCells, cellI) + { + const labelList& curCellPoints = cp[pistonCells[cellI]]; + + forAll (curCellPoints, i) + { + count[curCellPoints[i]] = true; + } + } + + // Count the points + label nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + nCounted++; + } + } + + movingPistonPoints.setSize(nCounted); + + // Collect the points + nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + movingPistonPoints[nCounted] = pointI; + nCounted++; + } + } + + pz.append + ( + new pointZone + ( + "movingPistonPoints", + movingPistonPoints, + nPointZones, + pointZones() + ) + ); + + nPointZones++; + + } + + } + + { + + IOobject headCellsHeader + ( + headCellSetName_, + time().constant()+"/polyMesh/sets/", + *this, + IOobject::MUST_READ + ); + + if(!headCellsHeader.headerOk()) + { + WarningIn + ( + "deformingEngineMesh::addZonesAndModifiers()" + ) << "cellSet called " << headCellSetName_ + << " does not exist. Continuing mesh motion without head points" << endl; + pz.append + ( + new pointZone + ( + "headPoints", + labelList(0), + nPointZones, + pointZones() + ) + ); + + nPointZones++; + } + else + { + cellSet fixedHeadCells(*this, headCellSetName_); + + labelList headCells = fixedHeadCells.toc(); + + labelList fixedHeadPoints; + + const labelListList& cp = cellPoints(); + + boolList count(allPoints().size(), false); + + forAll (fixedHeadCells, cellI) + { + const labelList& curCellPoints = cp[headCells[cellI]]; + + forAll (curCellPoints, i) + { + count[curCellPoints[i]] = true; + } + } + + // Count the points + label nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + nCounted++; + } + } + + fixedHeadPoints.setSize(nCounted); + + // Collect the points + nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + fixedHeadPoints[nCounted] = pointI; + nCounted++; + } + } + + pz.append + ( + new pointZone + ( + "headPoints", + fixedHeadPoints, + nPointZones, + pointZones() + ) + ); + + nPointZones++; + } + + } diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/addValveFaceZonesDeformingEngineMesh.H b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addValveFaceZonesDeformingEngineMesh.H new file mode 100644 index 000000000..7e857c613 --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/addValveFaceZonesDeformingEngineMesh.H @@ -0,0 +1,190 @@ +{ + for (label valveI = 0; valveI < nValves(); valveI++) + { + + // for each valve the following zones have to be created: + // + // - movingFaceZone + // - movingPointZone + // - staticFaceZone + // - staticPointZone + + IOobject movingCellsHeader + ( + valves_[valveI].movingCellsName(), + time().constant()+"/polyMesh/sets/", + *this, + IOobject::MUST_READ + ); + + if(!movingCellsHeader.headerOk()) + { + WarningIn + ( + "deformingEngineMesh::addZonesAndModifiers()" + ) << "cellSet called " << valves_[valveI].movingCellsName() + << " does not exist. Continuing mesh motion without rigid motion points for valve " << valves_[valveI].name() << endl; + + pz.append + ( + new pointZone + ( + "movingPointsV" + Foam::name(valveI + 1), + labelList(0), + nPointZones, + pointZones() + ) + ); + + nPointZones++; + + } + else + { + cellSet movingCellsSet(*this, valves_[valveI].movingCellsName()); + + labelList movingCells = movingCellsSet.toc(); + + labelList movingPoints; + + const labelListList& cp = cellPoints(); + + boolList count(allPoints().size(), false); + + forAll (movingCells, cellI) + { + const labelList& curCellPoints = cp[movingCells[cellI]]; + + forAll (curCellPoints, i) + { + count[curCellPoints[i]] = true; + } + } + + // Count the points + label nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + nCounted++; + } + } + + movingPoints.setSize(nCounted); + + // Collect the points + nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + movingPoints[nCounted] = pointI; + nCounted++; + } + } + + pz.append + ( + new pointZone + ( + "movingPointsV" + Foam::name(valveI + 1), + movingPoints, + nPointZones, + pointZones() + ) + ); + + nPointZones++; + } + + IOobject staticCellsHeader + ( + valves_[valveI].staticCellsName(), + time().constant()+"/polyMesh/sets/", + *this, + IOobject::MUST_READ + ); + + if(!staticCellsHeader.headerOk()) + { + WarningIn + ( + "deformingEngineMesh::addZonesAndModifiers()" + ) << "cellSet called " << valves_[valveI].staticCellsName() + << " does not exist. Continuing mesh motion without static points for valve " << valves_[valveI].name() << endl; + + pz.append + ( + new pointZone + ( + "staticPointsV" + Foam::name(valveI + 1), + labelList(0), + nPointZones, + pointZones() + ) + ); + + nPointZones++; + + } + else + { + cellSet staticCellSet(*this, valves_[valveI].staticCellsName()); + + labelList staticCells = staticCellSet.toc(); + + labelList staticPoints; + + const labelListList& cp = cellPoints(); + + boolList count(allPoints().size(), false); + + forAll (staticCells, cellI) + { + const labelList& curCellPoints = cp[staticCells[cellI]]; + + forAll (curCellPoints, i) + { + count[curCellPoints[i]] = true; + } + } + + // Count the points + label nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + nCounted++; + } + } + + staticPoints.setSize(nCounted); + + // Collect the points + nCounted = 0; + forAll (count, pointI) + { + if (count[pointI] == true) + { + staticPoints[nCounted] = pointI; + nCounted++; + } + } + + pz.append + ( + new pointZone + ( + "staticPointsV" + Foam::name(valveI + 1), + staticPoints, + nPointZones, + pointZones() + ) + ); + + nPointZones++; + } + } +} diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.C b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.C new file mode 100644 index 000000000..4cbb70adc --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.C @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "deformingEngineMesh.H" +#include "componentMixedTetPolyPatchVectorField.H" +#include "mapPolyMesh.H" +#include "polyTopoChange.H" +#include "addToRunTimeSelectionTable.H" +#include "GeometricField.H" +#include "volMesh.H" +#include "engineTime.H" +#include "pointField.H" +#include "fvPatchField.H" +#include "Switch.H" +#include "symmetryFvPatch.H" +#include "tetDecompositionMotionSolver.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(deformingEngineMesh, 0); + addToRunTimeSelectionTable(engineTopoChangerMesh, deformingEngineMesh, IOobject); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +bool Foam::deformingEngineMesh::realDeformation() const +{ + + if (virtualPistonPosition() + engTime().pistonDisplacement().value() > deckHeight_ - SMALL) + { + return true; + } + else + { + return deformation(); + } +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::deformingEngineMesh::deformingEngineMesh +( + const IOobject& io +) +: + engineTopoChangerMesh(io), + piston_(*this, engTime().engineDict().subDict("piston")), + valves_(*this, engTime().engineDict().lookup("deformingEngineMesh")), + pistonPosition_(-GREAT), + virtualPistonPosition_(-GREAT), + deckHeight_(GREAT), + cylinderHeadName_(engTime().engineDict().lookup("cylinderHeadName")), + linerName_(engTime().engineDict().lookup("linerName")), + headCellSetName_(engTime().engineDict().lookup("headCellSetName")) + +{ + // Add zones and modifiers if not already there. + addMeshZones(); + msPtr_ = motionSolver::New(*this); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::deformingEngineMesh::setBoundaryVelocity(volVectorField& U) +{ + // Set valve velociaty + forAll (valves(), valveI) + { + vector valveVel = + valves()[valveI].curVelocity()*valves()[valveI].cs().axis(); + + + // If valve is present in geometry, set the motion + if (valves()[valveI].stemPatchID().active()) + { + // Bottom of the valve moves with given velocity + U.boundaryField()[valves()[valveI].stemPatchID().index()] == + valveVel; + } + + } + +} + +// ************************************************************************* // diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.H b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.H new file mode 100644 index 000000000..5b2df092d --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMesh.H @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + deformingEngineMesh + +DESCRIPTION + +*/ +// ------------------------------------------------------------------------- // + +#ifndef deformingEngineMesh_H +#define deformingEngineMesh_H + +#include "engineTopoChangerMesh.H" +#include "enginePiston.H" +#include "motionSolver.H" +#include "polyPatchID.H" +#include "accordionValveBank.H" +#include "twoDPointCorrector.H" + +#include "faceSet.H" +#include "pointSet.H" +#include "cellSet.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Class forward declarations + +/*---------------------------------------------------------------------------*\ + Class lateralValves Declaration +\*---------------------------------------------------------------------------*/ +class twoDPointCorrector; + +class deformingEngineMesh +: + public engineTopoChangerMesh +{ + // Private data + + //- Piston patch + enginePiston piston_; + + //- Lateral valves + accordionValveBank valves_; + + + //- Piston Position + scalar pistonPosition_; + + //- Virtual piston position (pistonPosition + offSet) + scalar virtualPistonPosition_; + + //- deckHeight + scalar deckHeight_; + + //- Motion solver + autoPtr msPtr_; + + //- Cylinder head name + word cylinderHeadName_; + + //- Cylinder head name + word linerName_; + + //- PistonFaceSet +// word pistonAuxPoints_; + + //- PistonFaceSet + word headCellSetName_; + + // Private Member Functions + + //- Disallow default bitwise copy construct + deformingEngineMesh(const deformingEngineMesh&); + + //- Disallow default bitwise assignment + void operator=(const deformingEngineMesh&); + + //- Check if all patches exist, then calculate virtualPistonPosition, + //- pistonPosition and deckHeight for the first time + void checkAndCalculate(); + + //- Calculate the virtualPistonPosition, + void setVirtualPositions(); + + bool realDeformation() const; + +public: + + //- Runtime type information + TypeName("deformingEngineMesh"); + + + // Constructors + + //- Construct from database + explicit deformingEngineMesh(const IOobject& io); + + + // Destructor - default + + + // Member Functions + + inline const enginePiston& piston() const; + inline const accordionValveBank& valves() const; + inline const scalar& pistonPosition() const; + inline scalar& pistonPosition(); + inline const scalar& virtualPistonPosition() const; + inline scalar& virtualPistonPosition(); + inline const scalar& deckHeight() const; + inline scalar& deckHeight(); + + + //- Return true for mesh deformation mode + bool deformation() const + { + return true; + } + + //- Return number of valves + label nValves() const + { + return valves_.size(); + } + + //- Add valve and piston zones and modifiers + void addMeshZones(); + + //- Move and morph + virtual bool update(); + + //- Set boundary velocities + void setBoundaryVelocity(volVectorField& U); + + //- Generate the mesh from a series of square blocks + void generateMesh(){}; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "deformingEngineMeshI.H" + +#endif + +// ************************************************************************* // diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshI.H b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshI.H new file mode 100644 index 000000000..c71960892 --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshI.H @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Description + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +inline const enginePiston& deformingEngineMesh::piston() const +{ + return piston_; +} + + +inline const accordionValveBank& deformingEngineMesh::valves() const +{ + return valves_; +} + + +inline const scalar& deformingEngineMesh::pistonPosition() const +{ + return pistonPosition_; +} + +inline scalar& deformingEngineMesh::pistonPosition() +{ + return pistonPosition_; +} + +inline const scalar& deformingEngineMesh::virtualPistonPosition() const +{ + return virtualPistonPosition_; +} + +inline scalar& deformingEngineMesh::virtualPistonPosition() +{ + return virtualPistonPosition_; +} + + +inline const scalar& deformingEngineMesh::deckHeight() const +{ + return deckHeight_; +} + +inline scalar& deformingEngineMesh::deckHeight() +{ + return deckHeight_; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshInitialize.C b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshInitialize.C new file mode 100644 index 000000000..67b63c9f9 --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshInitialize.C @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "deformingEngineMesh.H" +#include "surfaceFields.H" +#include "regionSplit.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::deformingEngineMesh::checkAndCalculate() +{ + + label pistonIndex = -1; + bool foundPiston = false; + + label linerIndex = -1; + bool foundLiner = false; + + label cylinderHeadIndex = -1; + bool foundCylinderHead = false; + + + forAll(boundary(), i) + { + if (boundary()[i].name() == piston().patchID().name()) + { + pistonIndex = i; + foundPiston = true; + } + else if (boundary()[i].name() == linerName_) + { + linerIndex = i; + foundLiner = true; + } + else if (boundary()[i].name() == cylinderHeadName_) + { + cylinderHeadIndex = i; + foundCylinderHead = true; + } + } + + reduce(foundPiston, orOp()); + reduce(foundLiner, orOp()); + reduce(foundCylinderHead, orOp()); + + if (!foundPiston) + { + FatalErrorIn("Foam::deformingEngineMesh::checkAndCalculate()") + << " : cannot find piston patch" + << abort(FatalError); + } + + if (!foundLiner) + { + FatalErrorIn("Foam::deformingEngineMesh::checkAndCalculate()") + << " : cannot find liner patch" + << abort(FatalError); + } + + if (!foundCylinderHead) + { + FatalErrorIn("Foam::deformingEngineMesh::checkAndCalculate()") + << " : cannot find cylinderHead patch" + << exit(FatalError); + } + + { + if (linerIndex != -1) + { + pistonPosition() = + max(boundary()[pistonIndex].patch().localPoints()).z(); + } + reduce(pistonPosition(), minOp()); + + if (cylinderHeadIndex != -1) + { + deckHeight() = min + ( + boundary()[cylinderHeadIndex].patch().localPoints() + ).z(); + + } + reduce(deckHeight(), minOp()); + + Info<< "deckHeight: " << deckHeight() << nl + << "piston position: " << pistonPosition() << endl; + } + + +} + +void Foam::deformingEngineMesh::setVirtualPositions() +{ +} diff --git a/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshMove.C b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshMove.C new file mode 100644 index 000000000..18f40af77 --- /dev/null +++ b/src/engine/engineTopoChangerMesh/deformingEngineMesh/deformingEngineMeshMove.C @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "deformingEngineMesh.H" +#include "surfaceFields.H" +#include "regionSplit.H" +#include "componentMixedTetPolyPatchVectorField.H" +#include "mapPolyMesh.H" + +#include "tetPolyMesh.H" +#include "tetPointFields.H" +#include "elementFields.H" +#include "fixedValueTetPolyPatchFields.H" +#include "slipTetPolyPatchFields.H" +#include "symmetryTetPolyPatch.H" + +#include "tetFem.H" + +#include "symmetryFvPatch.H" +#include "wedgeFvPatch.H" +#include "emptyFvPatch.H" +#include "zeroGradientTetPolyPatchFields.H" +#include "tetDecompositionMotionSolver.H" + +#include "fixedValueTetPolyPatchFields.H" +#include "mixedTetPolyPatchFields.H" +#include "slipTetPolyPatchFields.H" +#include "zeroGradientTetPolyPatchFields.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::deformingEngineMesh::update() +{ + tetDecompositionMotionSolver& mSolver = + refCast(msPtr_()); + + scalar deltaZ = engTime().pistonDisplacement().value(); + + // deltaZ set to zero, FIXED PISTON POSITION + deltaZ = 0.0; + + virtualPistonPosition() += deltaZ; + + pointField newPoints = points(); + + { +# include "setValveMotionBoundaryConditionDeformingEngineMesh.H" +# include "setPistonMotionBoundaryConditionDeformingEngineMesh.H" + Info << "piston motion" << endl; + + DynamicList