Add the OpenFOAM source tree
This commit is contained in:
134
src/engine/engineMesh/engineMesh/engineMesh.C
Normal file
134
src/engine/engineMesh/engineMesh/engineMesh.C
Normal file
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "engineMesh.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(engineMesh, 0);
|
||||
defineRunTimeSelectionTable(engineMesh, IOobject);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::engineMesh::engineMesh(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
engineDB_(refCast<const engineTime>(time())),
|
||||
pistonIndex_(-1),
|
||||
linerIndex_(-1),
|
||||
cylinderHeadIndex_(-1),
|
||||
deckHeight_("deckHeight", dimLength, GREAT),
|
||||
pistonPosition_("pistonPosition", dimLength, -GREAT)
|
||||
{
|
||||
bool foundPiston = false;
|
||||
bool foundLiner = false;
|
||||
bool foundCylinderHead = false;
|
||||
|
||||
forAll(boundary(), i)
|
||||
{
|
||||
if (boundary()[i].name() == "piston")
|
||||
{
|
||||
pistonIndex_ = i;
|
||||
foundPiston = true;
|
||||
}
|
||||
else if (boundary()[i].name() == "liner")
|
||||
{
|
||||
linerIndex_ = i;
|
||||
foundLiner = true;
|
||||
}
|
||||
else if (boundary()[i].name() == "cylinderHead")
|
||||
{
|
||||
cylinderHeadIndex_ = i;
|
||||
foundCylinderHead = true;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(foundPiston, orOp<bool>());
|
||||
reduce(foundLiner, orOp<bool>());
|
||||
reduce(foundCylinderHead, orOp<bool>());
|
||||
|
||||
if (!foundPiston)
|
||||
{
|
||||
FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
|
||||
<< "cannot find piston patch"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (!foundLiner)
|
||||
{
|
||||
FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
|
||||
<< "cannot find liner patch"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (!foundCylinderHead)
|
||||
{
|
||||
FatalErrorIn("engineMesh::engineMesh(const IOobject& io)")
|
||||
<< "cannot find cylinderHead patch"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
{
|
||||
if (pistonIndex_ != -1)
|
||||
{
|
||||
pistonPosition_.value() = -GREAT;
|
||||
if (boundary()[pistonIndex_].patch().localPoints().size())
|
||||
{
|
||||
pistonPosition_.value() =
|
||||
max(boundary()[pistonIndex_].patch().localPoints()).z();
|
||||
}
|
||||
}
|
||||
reduce(pistonPosition_.value(), maxOp<scalar>());
|
||||
|
||||
if (cylinderHeadIndex_ != -1)
|
||||
{
|
||||
deckHeight_.value() = GREAT;
|
||||
if (boundary()[cylinderHeadIndex_].patch().localPoints().size())
|
||||
{
|
||||
deckHeight_.value() = min
|
||||
(
|
||||
boundary()[cylinderHeadIndex_].patch().localPoints()
|
||||
).z();
|
||||
}
|
||||
}
|
||||
reduce(deckHeight_.value(), minOp<scalar>());
|
||||
|
||||
Info<< "deckHeight: " << deckHeight_.value() << nl
|
||||
<< "piston position: " << pistonPosition_.value() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::engineMesh::~engineMesh()
|
||||
{}
|
||||
|
||||
// ************************************************************************* //
|
||||
129
src/engine/engineMesh/engineMesh/engineMesh.H
Normal file
129
src/engine/engineMesh/engineMesh/engineMesh.H
Normal file
@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::engineMesh
|
||||
|
||||
Description
|
||||
Foam::engineMesh
|
||||
|
||||
SourceFiles
|
||||
engineMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef engineMesh_H
|
||||
#define engineMesh_H
|
||||
|
||||
#include "engineTime.H"
|
||||
#include "fvMesh.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class engineMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class engineMesh
|
||||
:
|
||||
public fvMesh
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
engineMesh(const engineMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const engineMesh&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const engineTime& engineDB_;
|
||||
|
||||
label pistonIndex_;
|
||||
label linerIndex_;
|
||||
label cylinderHeadIndex_;
|
||||
|
||||
dimensionedScalar deckHeight_;
|
||||
dimensionedScalar pistonPosition_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("engineMesh");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
engineMesh,
|
||||
IOobject,
|
||||
(const IOobject& io),
|
||||
(io)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry, and read/write options
|
||||
explicit engineMesh(const IOobject& io);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<engineMesh> New(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~engineMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Edit
|
||||
|
||||
virtual void move() = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
75
src/engine/engineMesh/engineMesh/engineMeshNew.C
Normal file
75
src/engine/engineMesh/engineMesh/engineMeshNew.C
Normal file
@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "engineMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::engineMesh> Foam::engineMesh::New
|
||||
(
|
||||
const Foam::IOobject& io
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word modelType
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"engineGeometry",
|
||||
io.time().constant(),
|
||||
io.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("engineMesh")
|
||||
);
|
||||
|
||||
Info<< "Selecting engineMesh " << modelType << endl;
|
||||
|
||||
IOobjectConstructorTable::iterator cstrIter =
|
||||
IOobjectConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == IOobjectConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"engineMesh::New(const IOobject&)"
|
||||
) << "Unknown engineMesh type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid engineMesh types are :" << endl
|
||||
<< IOobjectConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<engineMesh>(cstrIter()(io));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvMotionSolverEngineMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvcMeshPhi.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fvMotionSolverEngineMesh, 0);
|
||||
addToRunTimeSelectionTable(engineMesh, fvMotionSolverEngineMesh, IOobject);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io)
|
||||
:
|
||||
engineMesh(io),
|
||||
pistonLayers_("pistonLayers", dimLength, 0.0),
|
||||
motionSolver_
|
||||
(
|
||||
*this,
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dynamicMeshDict",
|
||||
time().constant(),
|
||||
*this,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
engineDB_.engineDict()
|
||||
)
|
||||
)
|
||||
{
|
||||
engineDB_.engineDict().readIfPresent("pistonLayers", pistonLayers_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvMotionSolverEngineMesh::~fvMotionSolverEngineMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fvMotionSolverEngineMesh::move()
|
||||
{
|
||||
scalar deltaZ = engineDB_.pistonDisplacement().value();
|
||||
Info<< "deltaZ = " << deltaZ << endl;
|
||||
|
||||
// Position of the top of the static mesh layers above the piston
|
||||
scalar pistonPlusLayers = pistonPosition_.value() + pistonLayers_.value();
|
||||
|
||||
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
|
||||
|
||||
motionSolver_.pointMotionU().boundaryField()[pistonIndex_] == pistonSpeed;
|
||||
|
||||
{
|
||||
scalarField linerPoints
|
||||
(
|
||||
boundary()[linerIndex_].patch().localPoints().component(vector::Z)
|
||||
);
|
||||
|
||||
motionSolver_.pointMotionU().boundaryField()[linerIndex_] ==
|
||||
pistonSpeed*pos(deckHeight_.value() - linerPoints)
|
||||
*(deckHeight_.value() - linerPoints)
|
||||
/(deckHeight_.value() - pistonPlusLayers);
|
||||
}
|
||||
|
||||
motionSolver_.solve();
|
||||
|
||||
if (engineDB_.foundObject<surfaceScalarField>("phi"))
|
||||
{
|
||||
surfaceScalarField& phi =
|
||||
const_cast<surfaceScalarField&>
|
||||
(engineDB_.lookupObject<surfaceScalarField>("phi"));
|
||||
|
||||
const volScalarField& rho =
|
||||
engineDB_.lookupObject<volScalarField>("rho");
|
||||
|
||||
const volVectorField& U =
|
||||
engineDB_.lookupObject<volVectorField>("U");
|
||||
|
||||
bool absolutePhi = false;
|
||||
if (moving())
|
||||
{
|
||||
phi += fvc::interpolate(rho)*fvc::meshPhi(rho, U);
|
||||
absolutePhi = true;
|
||||
}
|
||||
|
||||
movePoints(motionSolver_.curPoints());
|
||||
|
||||
if (absolutePhi)
|
||||
{
|
||||
phi -= fvc::interpolate(rho)*fvc::meshPhi(rho, U);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
movePoints(motionSolver_.curPoints());
|
||||
}
|
||||
|
||||
|
||||
pistonPosition_.value() += deltaZ;
|
||||
|
||||
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
||||
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,105 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::fvMotionSolverEngineMesh
|
||||
|
||||
Description
|
||||
Foam::fvMotionSolverEngineMesh
|
||||
|
||||
SourceFiles
|
||||
fvMotionSolverEngineMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvMotionSolverEngineMesh_H
|
||||
#define fvMotionSolverEngineMesh_H
|
||||
|
||||
#include "engineMesh.H"
|
||||
#include "velocityComponentLaplacianFvMotionSolver.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fvMotionSolverEngineMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fvMotionSolverEngineMesh
|
||||
:
|
||||
public engineMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar pistonLayers_;
|
||||
|
||||
//- Mesh-motion solver to solve for the "z" component of the cell-centre
|
||||
// displacements
|
||||
velocityComponentLaplacianFvMotionSolver motionSolver_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fvMotionSolverEngineMesh(const fvMotionSolverEngineMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fvMotionSolverEngineMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fvMotionSolver");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
fvMotionSolverEngineMesh(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~fvMotionSolverEngineMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Edit
|
||||
|
||||
void move();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
125
src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.C
Normal file
125
src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.C
Normal file
@ -0,0 +1,125 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "layeredEngineMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvcMeshPhi.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(layeredEngineMesh, 0);
|
||||
addToRunTimeSelectionTable(engineMesh, layeredEngineMesh, IOobject);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::layeredEngineMesh::layeredEngineMesh(const IOobject& io)
|
||||
:
|
||||
engineMesh(io),
|
||||
pistonLayers_("pistonLayers", dimLength, 0.0)
|
||||
{
|
||||
engineDB_.engineDict().readIfPresent("pistonLayers", pistonLayers_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::layeredEngineMesh::~layeredEngineMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::layeredEngineMesh::move()
|
||||
{
|
||||
scalar deltaZ = engineDB_.pistonDisplacement().value();
|
||||
Info<< "deltaZ = " << deltaZ << endl;
|
||||
|
||||
// Position of the top of the static mesh layers above the piston
|
||||
scalar pistonPlusLayers = pistonPosition_.value() + pistonLayers_.value();
|
||||
|
||||
pointField newPoints(points());
|
||||
|
||||
forAll(newPoints, pointi)
|
||||
{
|
||||
point& p = newPoints[pointi];
|
||||
|
||||
if (p.z() < pistonPlusLayers) // In piston bowl
|
||||
{
|
||||
p.z() += deltaZ;
|
||||
}
|
||||
else if (p.z() < deckHeight_.value()) // In liner region
|
||||
{
|
||||
p.z() +=
|
||||
deltaZ
|
||||
*(deckHeight_.value() - p.z())
|
||||
/(deckHeight_.value() - pistonPlusLayers);
|
||||
}
|
||||
}
|
||||
|
||||
if (engineDB_.foundObject<surfaceScalarField>("phi"))
|
||||
{
|
||||
surfaceScalarField& phi =
|
||||
const_cast<surfaceScalarField&>
|
||||
(engineDB_.lookupObject<surfaceScalarField>("phi"));
|
||||
|
||||
const volScalarField& rho =
|
||||
engineDB_.lookupObject<volScalarField>("rho");
|
||||
|
||||
const volVectorField& U =
|
||||
engineDB_.lookupObject<volVectorField>("U");
|
||||
|
||||
bool absolutePhi = false;
|
||||
if (moving())
|
||||
{
|
||||
phi += fvc::interpolate(rho)*fvc::meshPhi(rho, U);
|
||||
absolutePhi = true;
|
||||
}
|
||||
|
||||
movePoints(newPoints);
|
||||
|
||||
if (absolutePhi)
|
||||
{
|
||||
phi -= fvc::interpolate(rho)*fvc::meshPhi(rho, U);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
movePoints(newPoints);
|
||||
}
|
||||
|
||||
pistonPosition_.value() += deltaZ;
|
||||
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
|
||||
|
||||
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
||||
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
100
src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.H
Normal file
100
src/engine/engineMesh/layeredEngineMesh/layeredEngineMesh.H
Normal file
@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::layeredEngineMesh
|
||||
|
||||
Description
|
||||
Foam::layeredEngineMesh
|
||||
|
||||
SourceFiles
|
||||
layeredEngineMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef layeredEngineMesh_H
|
||||
#define layeredEngineMesh_H
|
||||
|
||||
#include "engineMesh.H"
|
||||
#include "dimensionedScalar.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class layeredEngineMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class layeredEngineMesh
|
||||
:
|
||||
public engineMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
dimensionedScalar pistonLayers_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
layeredEngineMesh(const layeredEngineMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const layeredEngineMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("layered");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
layeredEngineMesh(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~layeredEngineMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Edit
|
||||
|
||||
void move();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
57
src/engine/engineMesh/staticEngineMesh/staticEngineMesh.C
Normal file
57
src/engine/engineMesh/staticEngineMesh/staticEngineMesh.C
Normal file
@ -0,0 +1,57 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "staticEngineMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(staticEngineMesh, 0);
|
||||
addToRunTimeSelectionTable(engineMesh, staticEngineMesh, IOobject);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::staticEngineMesh::staticEngineMesh(const IOobject& io)
|
||||
:
|
||||
engineMesh(io)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::staticEngineMesh::~staticEngineMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::staticEngineMesh::move()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
94
src/engine/engineMesh/staticEngineMesh/staticEngineMesh.H
Normal file
94
src/engine/engineMesh/staticEngineMesh/staticEngineMesh.H
Normal file
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::staticEngineMesh
|
||||
|
||||
Description
|
||||
Foam::staticEngineMesh
|
||||
|
||||
SourceFiles
|
||||
staticEngineMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef staticEngineMesh_H
|
||||
#define staticEngineMesh_H
|
||||
|
||||
#include "engineMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class staticEngineMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class staticEngineMesh
|
||||
:
|
||||
public engineMesh
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
staticEngineMesh(const staticEngineMesh&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const staticEngineMesh&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("static");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
staticEngineMesh(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~staticEngineMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Edit
|
||||
|
||||
void move();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user