Engines updates: Tommaso Lucchini
This commit is contained in:
parent
25c5d9847a
commit
a942e4c0b3
17 changed files with 2092 additions and 0 deletions
|
@ -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
|
||||
|
|
265
src/engine/accordionValve/accordionValve.C
Normal file
265
src/engine/accordionValve/accordionValve.C
Normal file
|
@ -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<coordinateSystem>& 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<const engineTime>(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<const engineTime>(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;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
284
src/engine/accordionValve/accordionValve.H
Normal file
284
src/engine/accordionValve/accordionValve.H
Normal file
|
@ -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<coordinateSystem> 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<coordinateSystem>& 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
|
||||
|
||||
// ************************************************************************* //
|
108
src/engine/accordionValve/accordionValveBank.H
Normal file
108
src/engine/accordionValve/accordionValveBank.H
Normal file
|
@ -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<accordionValve>
|
||||
{
|
||||
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<entry> 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
|
||||
|
||||
// ************************************************************************* //
|
|
@ -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<pointZone*> pz;
|
||||
|
||||
DynamicList<faceZone*> fz;
|
||||
|
||||
DynamicList<cellZone*> 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
|
@ -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++;
|
||||
}
|
||||
}
|
|
@ -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++;
|
||||
}
|
||||
|
||||
}
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
|
@ -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<motionSolver> 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
|
||||
|
||||
// ************************************************************************* //
|
|
@ -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
|
||||
|
||||
// ************************************************************************* //
|
|
@ -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<bool>());
|
||||
reduce(foundLiner, orOp<bool>());
|
||||
reduce(foundCylinderHead, orOp<bool>());
|
||||
|
||||
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<scalar>());
|
||||
|
||||
if (cylinderHeadIndex != -1)
|
||||
{
|
||||
deckHeight() = min
|
||||
(
|
||||
boundary()[cylinderHeadIndex].patch().localPoints()
|
||||
).z();
|
||||
|
||||
}
|
||||
reduce(deckHeight(), minOp<scalar>());
|
||||
|
||||
Info<< "deckHeight: " << deckHeight() << nl
|
||||
<< "piston position: " << pistonPosition() << endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Foam::deformingEngineMesh::setVirtualPositions()
|
||||
{
|
||||
}
|
|
@ -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<tetDecompositionMotionSolver>(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<label> constrainedPoints(mSolver.curPoints()().size()/100);
|
||||
DynamicList<vector> constrainedVelocity
|
||||
(
|
||||
mSolver.curPoints()().size()/100
|
||||
);
|
||||
|
||||
# include "setDeformingEngineMeshConstraints.H"
|
||||
|
||||
|
||||
labelList constrainedPointsList(constrainedPoints.shrink());
|
||||
vectorField constrainedVelocityField(constrainedVelocity.shrink());
|
||||
|
||||
forAll (constrainedPointsList, i)
|
||||
{
|
||||
mSolver.setConstraint
|
||||
(
|
||||
constrainedPointsList[i],
|
||||
constrainedVelocityField[i]
|
||||
);
|
||||
}
|
||||
|
||||
mSolver.solve();
|
||||
|
||||
newPoints = mSolver.curPoints();
|
||||
movePoints(newPoints);
|
||||
setVirtualPositions();
|
||||
mSolver.clearConstraints();
|
||||
|
||||
}
|
||||
|
||||
pointField oldPointsNew = oldAllPoints();
|
||||
newPoints = points();
|
||||
movePoints(newPoints);
|
||||
Info << "max mesh phi before = " << max((phi())) << endl;
|
||||
Info << "min mesh phi before = " << min((phi())) << endl;
|
||||
|
||||
|
||||
Info << "max mesh phi after = " << max((phi())) << endl;
|
||||
Info << "min mesh phi after = " << min((phi())) << endl;
|
||||
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
Info << "virtualPistonPosition = " << virtualPistonPosition()
|
||||
<< ", deckHeight = " << deckHeight() << endl;
|
||||
|
||||
// Mesh in three parts:
|
||||
// - pistonPoints - move with deltaZ
|
||||
// - headPoints - do not move
|
||||
|
||||
const pointZoneMesh& pZones = pointZones();
|
||||
label headPtsIndex = pZones.findZoneID("headPoints");
|
||||
label pistonPtsIndex = pZones.findZoneID("pistonPoints");
|
||||
const labelList& pistonPoints = pZones[pistonPtsIndex];
|
||||
const labelList& headPoints = pZones[headPtsIndex];
|
||||
|
||||
// Whether point displacement is by scaling
|
||||
boolList scaleDisp(nPoints(), true);
|
||||
label nScaled = nPoints();
|
||||
List<bool> pistonPoint(newPoints.size(), false);
|
||||
List<bool> headPoint(newPoints.size(), false);
|
||||
|
||||
forAll(pistonPoints, i)
|
||||
{
|
||||
label pointI = pistonPoints[i];
|
||||
pistonPoint[pointI] = true;
|
||||
point& p = newPoints[pointI];
|
||||
|
||||
if (p.z() < pistonPosition() - 1.0e-6)
|
||||
{
|
||||
scaleDisp[pointI] = false;
|
||||
nScaled--;
|
||||
}
|
||||
}
|
||||
|
||||
forAll(headPoints, i)
|
||||
{
|
||||
headPoint[headPoints[i]] = true;
|
||||
scaleDisp[headPoints[i]] = false;
|
||||
nScaled--;
|
||||
}
|
||||
|
||||
if (realDeformation)
|
||||
{
|
||||
|
||||
forAll(scaleDisp, pointI)
|
||||
{
|
||||
point& p = newPoints[pointI];
|
||||
|
||||
if (scaleDisp[pointI])
|
||||
{
|
||||
p.z() +=
|
||||
deltaZ
|
||||
* (deckHeight() - p.z())/(deckHeight() - pistonPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!headPoint[pointI])
|
||||
{
|
||||
p.z() += deltaZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Always move piston
|
||||
scalar pistonTopZ = -GREAT;
|
||||
forAll(pistonPoints, i)
|
||||
{
|
||||
point& p = newPoints[pistonPoints[i]];
|
||||
p.z() += deltaZ;
|
||||
pistonTopZ = max(pistonTopZ, p.z());
|
||||
}
|
||||
|
||||
if (deltaZ > 0.0)
|
||||
{
|
||||
// check if piston-points have moved beyond the layer above
|
||||
forAll(newPoints, i)
|
||||
{
|
||||
if (!pistonPoint[i])
|
||||
{
|
||||
if (virtualPistonPosition() > newPoints[i].z())
|
||||
{
|
||||
newPoints[i].z() = pistonTopZ + 0.9*minLayerThickness;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
movePoints(newPoints);
|
||||
|
||||
pistonPosition() += deltaZ;
|
||||
scalar pistonSpeed = deltaZ/engTime().deltaT().value();
|
||||
|
||||
Info<< "clearance: " << deckHeight() - pistonPosition() << nl
|
||||
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
boolList isConstrained(points().size(), false);
|
||||
|
||||
const pointZoneMesh& pZones = pointZones();
|
||||
|
||||
label constraintSize = 0;
|
||||
|
||||
forAll(valves_, valveI)
|
||||
{
|
||||
vector valveVel =
|
||||
valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
|
||||
|
||||
{
|
||||
label movingPtsIndex =
|
||||
pZones.findZoneID("movingPointsV"+Foam::name(valveI + 1));
|
||||
const labelList& movingPointsV = pZones[movingPtsIndex];
|
||||
|
||||
forAll(movingPointsV, mpI)
|
||||
{
|
||||
if(!isConstrained[movingPointsV[mpI]])
|
||||
{
|
||||
constrainedPoints.append(movingPointsV[mpI]);
|
||||
constrainedVelocity.append(valveVel);
|
||||
|
||||
constraintSize++;
|
||||
isConstrained[movingPointsV[mpI]] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
label staticPtsIndex =
|
||||
pZones.findZoneID("staticPointsV" + Foam::name(valveI + 1));
|
||||
const labelList& staticPointsV = pZones[staticPtsIndex];
|
||||
|
||||
forAll(staticPointsV, spI)
|
||||
{
|
||||
if(!isConstrained[staticPointsV[spI]])
|
||||
{
|
||||
constrainedPoints.append(staticPointsV[spI]);
|
||||
constrainedVelocity.append(vector::zero);
|
||||
constraintSize++;
|
||||
isConstrained[staticPointsV[spI]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (piston().patchID().active())
|
||||
{
|
||||
vector pistonVel =
|
||||
piston().cs().axis()*engineTime_.pistonSpeed().value();
|
||||
|
||||
label pistonPtsIndex = pZones.findZoneID("movingPistonPoints");
|
||||
const labelList& movingPointsP = pZones[pistonPtsIndex];
|
||||
|
||||
forAll(movingPointsP, mpI)
|
||||
{
|
||||
if(!isConstrained[movingPointsP[mpI]])
|
||||
{
|
||||
constrainedPoints.append(movingPointsP[mpI]);
|
||||
constrainedVelocity.append(pistonVel);
|
||||
constraintSize++;
|
||||
isConstrained[movingPointsP[mpI]] = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
label headPtsIndex = pZones.findZoneID("headPoints");
|
||||
const labelList& fixedPointsH = pZones[headPtsIndex];
|
||||
|
||||
forAll(fixedPointsH, fpI)
|
||||
{
|
||||
if(!isConstrained[fixedPointsH[fpI]])
|
||||
{
|
||||
constrainedPoints.append(fixedPointsH[fpI]);
|
||||
constrainedVelocity.append(vector::zero);
|
||||
constraintSize++;
|
||||
isConstrained[fixedPointsH[fpI]] = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
vector pistonVel =
|
||||
piston().cs().axis()*engineTime_.pistonSpeed().value();
|
||||
|
||||
{
|
||||
tetPointVectorField& motionU = mSolver.motionU();
|
||||
|
||||
Info << "setting the piston velocity" << endl;
|
||||
|
||||
if (piston().patchID().active())
|
||||
{
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info << "Piston velocity: " << pistonVel;
|
||||
}
|
||||
|
||||
motionU.boundaryField()[piston().patchID().index()] == pistonVel;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
// use tetrahedral decomposition of the engine mesh
|
||||
|
||||
{
|
||||
|
||||
Info << "setting valve motion b.c." << endl;
|
||||
|
||||
tetPointVectorField& motionU = mSolver.motionU();
|
||||
|
||||
// Set valve velocity
|
||||
forAll (valves_, valveI)
|
||||
{
|
||||
|
||||
Info << "Valve n. " << valveI + 1 << " velocity = " << valves_[valveI].curVelocity() << endl;
|
||||
|
||||
vector valveVel =
|
||||
valves_[valveI].curVelocity()*valves_[valveI].cs().axis();
|
||||
|
||||
// If valve is present in geometry, set the motion
|
||||
if (valves_[valveI].bottomPatchID().active())
|
||||
{
|
||||
// Bottom of the valve moves with given velocity
|
||||
motionU.boundaryField()[valves_[valveI].bottomPatchID().index()] ==
|
||||
valveVel;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Valve " << valveI << " lift: "
|
||||
<< valves_[valveI].curLift()
|
||||
<< " velocity: " << valves_[valveI].curVelocity()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (valves_[valveI].poppetPatchID().active())
|
||||
{
|
||||
|
||||
// Top of the valve does not move
|
||||
motionU.boundaryField()[valves_[valveI].poppetPatchID().index()] ==
|
||||
valveVel;
|
||||
}
|
||||
|
||||
if (valves_[valveI].sidePatchID().active())
|
||||
{
|
||||
// Top of the valve does not move
|
||||
motionU.boundaryField()[valves_[valveI].sidePatchID().index()] ==
|
||||
valveVel;
|
||||
}
|
||||
|
||||
}
|
||||
// Setting the boundary position
|
||||
|
||||
{
|
||||
label cylinderHeadIndex = boundaryMesh().findPatchID(cylinderHeadName_);
|
||||
|
||||
// Top of the valve does not move
|
||||
motionU.boundaryField()[cylinderHeadIndex] ==
|
||||
vector::zero;
|
||||
}
|
||||
|
||||
Info << "valve motion boundary conditions set" << endl;
|
||||
|
||||
}
|
Reference in a new issue