engineFoam: superseded by reactingFoam with fvMeshMover::engine
With the general run-time selectable fvMeshMovers engine compression simulations can be performed with reactingFoam so there is no longer any need for engine specific solvers or engineMesh. An engineFoam script is provided to redirect users to reactingFoam with instructions.
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
engineFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/engineFoam
|
||||
@ -1,38 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I.. \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
|
||||
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \
|
||||
-I$(LIB_SRC)/ThermophysicalTransportModels/fluidReactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/combustionModels/lnInclude \
|
||||
-I$(LIB_SRC)/engine/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvModels \
|
||||
-lfvConstraints \
|
||||
-lsampling \
|
||||
-lmeshTools \
|
||||
-lmomentumTransportModels \
|
||||
-lcompressibleMomentumTransportModels \
|
||||
-lthermophysicalTransportModels \
|
||||
-lfluidReactionThermophysicalTransportModels \
|
||||
-lspecie \
|
||||
-lfluidThermophysicalModels \
|
||||
-lreactionThermophysicalModels \
|
||||
-lchemistryModel \
|
||||
-lODE \
|
||||
-lcombustionModels \
|
||||
-lengine
|
||||
@ -1,177 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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/>.
|
||||
|
||||
Application
|
||||
engineFoam
|
||||
|
||||
Description
|
||||
Transient solver for compressible, turbulent engine flow with a spray
|
||||
particle cloud.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "engineMesh.H"
|
||||
#include "compressibleMomentumTransportModels.H"
|
||||
#include "fluidReactionThermophysicalTransportModel.H"
|
||||
#include "combustionModel.H"
|
||||
#include "fvModels.H"
|
||||
#include "fvConstraints.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "pressureReference.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#define CREATE_MESH createEngineMesh.H
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createEngineMesh.H"
|
||||
#include "createEngineControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "createFieldRefs.H"
|
||||
#include "createRhoUfIfPresent.H"
|
||||
#include "startSummary.H"
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
if (!LTS)
|
||||
{
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (pimple.run(runTime))
|
||||
{
|
||||
#include "readEngineControls.H"
|
||||
|
||||
// Store divrhoU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
autoPtr<volScalarField> divrhoU;
|
||||
if (correctPhi)
|
||||
{
|
||||
divrhoU = new volScalarField
|
||||
(
|
||||
"divrhoU",
|
||||
fvc::div(fvc::absolute(phi, rho, U))
|
||||
);
|
||||
}
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
#include "setRDeltaT.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
}
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Engine time = " << runTime.userTimeName() << endl;
|
||||
|
||||
// Store momentum to set rhoUf for introduced faces.
|
||||
autoPtr<volVectorField> rhoU;
|
||||
if (rhoUf.valid())
|
||||
{
|
||||
rhoU = new volVectorField("rhoU", rho*U);
|
||||
}
|
||||
|
||||
fvModels.preUpdateMesh();
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.move();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
#include "../../../compressible/rhoPimpleFoam/correctPhi.H"
|
||||
}
|
||||
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
if (!pimple.simpleRho())
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
}
|
||||
|
||||
// --- PIMPLE loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
fvModels.correct();
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "YEqn.H"
|
||||
#include "EEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "../../../compressible/rhoPimpleFoam/pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
thermophysicalTransport->correct();
|
||||
}
|
||||
}
|
||||
|
||||
#include "logSummary.H"
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,12 +0,0 @@
|
||||
Info<< "Mean pressure:" << p.weightedAverage(mesh.V()).value() << endl;
|
||||
Info<< "Mean temperature:" << T.weightedAverage(mesh.V()).value() << endl;
|
||||
Info<< "Mean u':"
|
||||
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
|
||||
<< endl;
|
||||
|
||||
logSummaryFile
|
||||
<< runTime.userTimeValue() << tab
|
||||
<< p.weightedAverage(mesh.V()).value() << tab
|
||||
<< T.weightedAverage(mesh.V()).value() << tab
|
||||
<< (sqrt((2.0/3.0)*turbulence->k()))().weightedAverage(mesh.V()).value()
|
||||
<< endl;
|
||||
@ -1,11 +0,0 @@
|
||||
Info<< "Total cylinder mass: " << fvc::domainIntegrate(rho).value() << endl;
|
||||
//Info<< "Total fuel mass: "
|
||||
// << fvc::domainIntegrate(rho*composition.ft()).value() << endl;
|
||||
|
||||
OFstream logSummaryFile
|
||||
(
|
||||
runTime.path()/("logSummary." + runTime.timeName() + ".dat")
|
||||
);
|
||||
|
||||
logSummaryFile
|
||||
<< "# CA" << " p" << " T" << " u'" << endl;
|
||||
59
bin/engineFoam
Executable file
59
bin/engineFoam
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration | Website: https://openfoam.org
|
||||
# \\ / A nd | Copyright (C) 2021 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/>.
|
||||
#
|
||||
# Script
|
||||
# engineFoam
|
||||
#
|
||||
# Description
|
||||
# Script to inform the user that engineFoam has been replaced by the more
|
||||
# general reactingFoam solver.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cat << EOF
|
||||
|
||||
The engineFoam solver has solver has been replaced by the more general reactingFoam
|
||||
solver, which supports engine mesh motion using an appropriate
|
||||
fvMeshMover. e.g. layeredEngine
|
||||
|
||||
To run a engineFoam case in reactingFoam add a mover entry in
|
||||
constant/dynamicMeshDict
|
||||
e.g. from the tutorials/combustion/reactingFoam/RAS/kivaTest case:
|
||||
|
||||
mover
|
||||
{
|
||||
type layeredEngine;
|
||||
|
||||
libs ("libfvMeshMovers.so");
|
||||
|
||||
conRodLength 0.147;
|
||||
bore 0.092;
|
||||
stroke 0.08423;
|
||||
clearance 0.00115;
|
||||
pistonLayers 0;
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -539,31 +539,6 @@ _chtMultiRegionFoam_ ()
|
||||
}
|
||||
complete -o filenames -o nospace -F _chtMultiRegionFoam_ chtMultiRegionFoam
|
||||
|
||||
_coldEngineFoam_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="-case -doc -fileHandler -help -hostRoots -libs -listFunctionObjects -listFvConstraints -listFvModels -listMomentumTransportModels -listScalarBCs -listSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -roots -srcDoc"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra=""
|
||||
|
||||
[ "$COMP_CWORD" = 1 ] || \
|
||||
case "$prev" in
|
||||
-case)
|
||||
opts="" ; extra="-d" ;;
|
||||
-fileHandler)
|
||||
opts="uncollated collated masterUncollated" ; extra="" ;;
|
||||
-hostRoots|-libs|-roots)
|
||||
opts="" ; extra="" ;;
|
||||
*) ;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
|
||||
}
|
||||
complete -o filenames -o nospace -F _coldEngineFoam_ coldEngineFoam
|
||||
|
||||
_collapseEdges_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@ -2297,31 +2272,6 @@ _moveDynamicMesh_ ()
|
||||
}
|
||||
complete -o filenames -o nospace -F _moveDynamicMesh_ moveDynamicMesh
|
||||
|
||||
_moveEngineMesh_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="-case -doc -fileHandler -help -hostRoots -libs -noFunctionObjects -parallel -roots -srcDoc"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra=""
|
||||
|
||||
[ "$COMP_CWORD" = 1 ] || \
|
||||
case "$prev" in
|
||||
-case)
|
||||
opts="" ; extra="-d" ;;
|
||||
-fileHandler)
|
||||
opts="uncollated collated masterUncollated" ; extra="" ;;
|
||||
-hostRoots|-libs|-roots)
|
||||
opts="" ; extra="" ;;
|
||||
*) ;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
|
||||
}
|
||||
complete -o filenames -o nospace -F _moveEngineMesh_ moveEngineMesh
|
||||
|
||||
_moveMesh_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@ -2486,31 +2436,6 @@ _noise_ ()
|
||||
}
|
||||
complete -o filenames -o nospace -F _noise_ noise
|
||||
|
||||
_nonNewtonianIcoFoam_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="-case -doc -fileHandler -help -hostRoots -libs -listFunctionObjects -listScalarBCs -listSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -roots -srcDoc"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra=""
|
||||
|
||||
[ "$COMP_CWORD" = 1 ] || \
|
||||
case "$prev" in
|
||||
-case)
|
||||
opts="" ; extra="-d" ;;
|
||||
-fileHandler)
|
||||
opts="uncollated collated masterUncollated" ; extra="" ;;
|
||||
-hostRoots|-libs|-roots)
|
||||
opts="" ; extra="" ;;
|
||||
*) ;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
|
||||
}
|
||||
complete -o filenames -o nospace -F _nonNewtonianIcoFoam_ nonNewtonianIcoFoam
|
||||
|
||||
_objToVTK_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@ -4961,31 +4886,6 @@ _writeMeshObj_ ()
|
||||
}
|
||||
complete -o filenames -o nospace -F _writeMeshObj_ writeMeshObj
|
||||
|
||||
_XiEngineFoam_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
local line=${COMP_LINE}
|
||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
||||
|
||||
opts="-case -doc -fileHandler -help -hostRoots -libs -listFunctionObjects -listFvConstraints -listFvModels -listMomentumTransportModels -listScalarBCs -listSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -roots -srcDoc"
|
||||
for o in $used ; do opts="${opts/$o/}" ; done
|
||||
extra=""
|
||||
|
||||
[ "$COMP_CWORD" = 1 ] || \
|
||||
case "$prev" in
|
||||
-case)
|
||||
opts="" ; extra="-d" ;;
|
||||
-fileHandler)
|
||||
opts="uncollated collated masterUncollated" ; extra="" ;;
|
||||
-hostRoots|-libs|-roots)
|
||||
opts="" ; extra="" ;;
|
||||
*) ;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
|
||||
}
|
||||
complete -o filenames -o nospace -F _XiEngineFoam_ XiEngineFoam
|
||||
|
||||
_XiFoam_ ()
|
||||
{
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
|
||||
@ -69,7 +69,6 @@ renumber/Allwmake $targetType $*
|
||||
fvAgglomerationMethods/Allwmake $targetType $*
|
||||
|
||||
wmake $targetType fvMotionSolver
|
||||
wmake $targetType engine
|
||||
wmake $targetType fvModels
|
||||
wmake $targetType fvConstraints
|
||||
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
engineMesh/engineMesh/engineMesh.C
|
||||
engineMesh/engineMesh/engineMeshNew.C
|
||||
engineMesh/layeredEngineMesh/layeredEngineMesh.C
|
||||
engineMesh/fvMotionSolverEngineMesh/fvMotionSolverEngineMesh.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libengine
|
||||
@ -1,11 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/fvMotionSolver/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-lfvMotionSolvers
|
||||
@ -1,221 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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 "../OpenFOAM/lnInclude/engineTime.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(engineMesh, 0);
|
||||
defineRunTimeSelectionTable(engineMesh, IOobject);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::engineMesh::engineMesh(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
dict_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"engineGeometry",
|
||||
time().constant(),
|
||||
time(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
),
|
||||
rpm_
|
||||
(
|
||||
refCast<const userTimes::engine>(time().userTime()).rpm()
|
||||
),
|
||||
conRodLength_("conRodLength", dimLength, dict_),
|
||||
bore_("bore", dimLength, dict_),
|
||||
stroke_("stroke", dimLength, dict_),
|
||||
clearance_("clearance", dimLength, dict_),
|
||||
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)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "cannot find piston patch"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (!foundLiner)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "cannot find liner patch"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (!foundCylinderHead)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "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()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::engineMesh::theta() const
|
||||
{
|
||||
return time().userTimeValue();
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::engineMesh::deltaTheta() const
|
||||
{
|
||||
return time().timeToUserTime(time().deltaTValue());
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::engineMesh::pistonPosition(const scalar theta) const
|
||||
{
|
||||
return
|
||||
(
|
||||
conRodLength_.value()
|
||||
+ stroke_.value()/2.0
|
||||
+ clearance_.value()
|
||||
)
|
||||
- (
|
||||
stroke_.value()*::cos(degToRad(theta))/2.0
|
||||
+ ::sqrt
|
||||
(
|
||||
sqr(conRodLength_.value())
|
||||
- sqr(stroke_.value()*::sin(degToRad(theta))/2.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar Foam::engineMesh::pistonPosition() const
|
||||
{
|
||||
return dimensionedScalar
|
||||
(
|
||||
"pistonPosition",
|
||||
dimLength,
|
||||
pistonPosition(theta())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar Foam::engineMesh::pistonDisplacement() const
|
||||
{
|
||||
return dimensionedScalar
|
||||
(
|
||||
"pistonDisplacement",
|
||||
dimLength,
|
||||
pistonPosition(theta() - deltaTheta()) - pistonPosition().value()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar Foam::engineMesh::pistonSpeed() const
|
||||
{
|
||||
return dimensionedScalar
|
||||
(
|
||||
"pistonSpeed",
|
||||
dimVelocity,
|
||||
pistonDisplacement().value()/(time().deltaTValue() + vSmall)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,191 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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 "fvMesh.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class engineMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class engineMesh
|
||||
:
|
||||
public fvMesh
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
const IOdictionary dict_;
|
||||
|
||||
//- RPM
|
||||
dimensionedScalar rpm_;
|
||||
|
||||
//- Optional engine geometry parameters
|
||||
dimensionedScalar conRodLength_;
|
||||
dimensionedScalar bore_;
|
||||
dimensionedScalar stroke_;
|
||||
dimensionedScalar clearance_;
|
||||
|
||||
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);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
engineMesh(const engineMesh&) = delete;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<engineMesh> New(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~engineMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Is mesh dynamic
|
||||
virtual bool dynamic() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Return the engines current operating RPM
|
||||
const dimensionedScalar& rpm() const
|
||||
{
|
||||
return rpm_;
|
||||
}
|
||||
|
||||
//- Return the engines connecting-rod length
|
||||
const dimensionedScalar& conRodLength() const
|
||||
{
|
||||
return conRodLength_;
|
||||
}
|
||||
|
||||
//- Return the engines bore
|
||||
const dimensionedScalar& bore() const
|
||||
{
|
||||
return bore_;
|
||||
}
|
||||
|
||||
//- Return the engines stroke
|
||||
const dimensionedScalar& stroke() const
|
||||
{
|
||||
return stroke_;
|
||||
}
|
||||
|
||||
//- Return the engines clearance-gap
|
||||
const dimensionedScalar& clearance() const
|
||||
{
|
||||
return clearance_;
|
||||
}
|
||||
|
||||
//- Return current crank-angle
|
||||
virtual scalar theta() const;
|
||||
|
||||
//- Return crank-angle increment
|
||||
virtual scalar deltaTheta() const;
|
||||
|
||||
//- Calculate the piston position from the engine geometry
|
||||
// and given crank angle.
|
||||
scalar pistonPosition(const scalar theta) const;
|
||||
|
||||
//- Return current piston position
|
||||
dimensionedScalar pistonPosition() const;
|
||||
|
||||
//- Return piston displacement for current time step
|
||||
dimensionedScalar pistonDisplacement() const;
|
||||
|
||||
//- Return piston speed for current time step
|
||||
dimensionedScalar pistonSpeed() const;
|
||||
|
||||
|
||||
virtual void move() = 0;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const engineMesh&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,73 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 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())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown engineMesh type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid engineMesh types are :" << endl
|
||||
<< IOobjectConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<engineMesh>(cstrIter()(io));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,99 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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,
|
||||
dict_
|
||||
)
|
||||
{
|
||||
dict_.readIfPresent("pistonLayers", pistonLayers_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvMotionSolverEngineMesh::~fvMotionSolverEngineMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fvMotionSolverEngineMesh::move()
|
||||
{
|
||||
scalar deltaZ = 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/time().deltaTValue();
|
||||
|
||||
motionSolver_.pointMotionU().boundaryFieldRef()[pistonIndex_] ==
|
||||
pistonSpeed;
|
||||
|
||||
{
|
||||
scalarField linerPoints
|
||||
(
|
||||
boundary()[linerIndex_].patch().localPoints().component(vector::Z)
|
||||
);
|
||||
|
||||
motionSolver_.pointMotionU().boundaryFieldRef()[linerIndex_] ==
|
||||
pistonSpeed*pos0(deckHeight_.value() - linerPoints)
|
||||
*(deckHeight_.value() - linerPoints)
|
||||
/(deckHeight_.value() - pistonPlusLayers);
|
||||
}
|
||||
|
||||
motionSolver_.solve();
|
||||
movePoints(motionSolver_.curPoints());
|
||||
|
||||
pistonPosition_.value() += deltaZ;
|
||||
|
||||
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
||||
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,103 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("fvMotionSolver");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
fvMotionSolverEngineMesh(const IOobject& io);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
fvMotionSolverEngineMesh(const fvMotionSolverEngineMesh&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
~fvMotionSolverEngineMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
void move();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fvMotionSolverEngineMesh&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,96 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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)
|
||||
{
|
||||
dict_.readIfPresent("pistonLayers", pistonLayers_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::layeredEngineMesh::~layeredEngineMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::layeredEngineMesh::move()
|
||||
{
|
||||
scalar deltaZ = 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);
|
||||
}
|
||||
}
|
||||
|
||||
movePoints(newPoints);
|
||||
|
||||
pistonPosition_.value() += deltaZ;
|
||||
scalar pistonSpeed = deltaZ/time().deltaTValue();
|
||||
|
||||
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
|
||||
<< "Piston speed = " << pistonSpeed << " m/s" << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,98 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 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_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("layered");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
layeredEngineMesh(const IOobject& io);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
layeredEngineMesh(const layeredEngineMesh&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
~layeredEngineMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
void move();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const layeredEngineMesh&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +0,0 @@
|
||||
#include "createDyMControls.H"
|
||||
|
||||
maxDeltaT = runTime.userTimeToTime(maxDeltaT);
|
||||
@ -1,18 +0,0 @@
|
||||
Info<< "Create mesh for time = "
|
||||
<< runTime.timeName() << nl << endl;
|
||||
|
||||
autoPtr<engineMesh> meshPtr
|
||||
(
|
||||
engineMesh::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
engineMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
Foam::IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
engineMesh& mesh = meshPtr();
|
||||
@ -1,3 +0,0 @@
|
||||
#include "createTimeControls.H"
|
||||
|
||||
maxDeltaT = runTime.userTimeToTime(maxDeltaT);
|
||||
@ -1,3 +0,0 @@
|
||||
#include "readDyMControls.H"
|
||||
|
||||
maxDeltaT = runTime.userTimeToTime(maxDeltaT);
|
||||
@ -1,3 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
maxDeltaT = runTime.userTimeToTime(maxDeltaT);
|
||||
Reference in New Issue
Block a user