ENH: engineTime: Generalized to provide run-time selection of piston-motion

Standard crank-connecting rod and the new free-piston kinematics motion options
are provides, others can easily be added.

Contributed by Francesco Contino and Nicolas Bourgeois, BURN Research Group.
This commit is contained in:
Henry Weller
2017-09-19 09:26:26 +01:00
committed by Andrew Heather
parent d425421c0a
commit 01efb2c85b
32 changed files with 1599 additions and 109 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
runTime++;
Info<< "Crank angle = " << runTime.theta() << " CA-deg"
Info<< "Engine time = " << runTime.theta() << runTime.unit()
<< endl;
mesh.move();

View File

@ -0,0 +1,3 @@
#include "createTimeControls.H"
maxDeltaT = runTime.userTimeToTime(maxDeltaT);

View File

@ -1,4 +1,8 @@
engineTime/engineTime.C
engineTime/engineTime/engineTime.C
engineTime/engineTime/engineTimeNew.C
engineTime/freePiston/freePiston.C
engineTime/crankConRod/crankConRod.C
ignition/ignition.C
ignition/ignitionIO.C
ignition/ignitionSite.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,12 +23,22 @@ License
\*---------------------------------------------------------------------------*/
#include "engineTime.H"
#include "crankConRod.H"
#include "unitConversion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(crankConRod, 0);
addToRunTimeSelectionTable(engineTime, crankConRod, dictionary);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::engineTime::timeAdjustment()
void Foam::crankConRod::timeAdjustment()
{
deltaT_ = degToTime(deltaT_);
endTime_ = degToTime(endTime_);
@ -46,7 +56,7 @@ void Foam::engineTime::timeAdjustment()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::engineTime::engineTime
Foam::crankConRod::crankConRod
(
const word& name,
const fileName& rootPath,
@ -56,7 +66,7 @@ Foam::engineTime::engineTime
const fileName& dictName
)
:
Time
engineTime
(
name,
rootPath,
@ -64,18 +74,6 @@ Foam::engineTime::engineTime
systemName,
constantName
),
dict_
(
IOobject
(
"engineGeometry",
constant(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
),
rpm_(dict_.lookup("rpm")),
conRodLength_(dimensionedScalar("conRodLength", dimLength, 0)),
bore_(dimensionedScalar("bore", dimLength, 0)),
@ -92,6 +90,7 @@ Foam::engineTime::engineTime
startTime_ = degToTime(startTime_);
value() = degToTime(value());
deltaTSave_ = deltaT_;
deltaT0_ = deltaT_;
}
@ -99,16 +98,14 @@ Foam::engineTime::engineTime
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Read the controlDict and set all the parameters
void Foam::engineTime::readDict()
void Foam::crankConRod::readDict()
{
Time::readDict();
timeAdjustment();
}
// Read the controlDict and set all the parameters
bool Foam::engineTime::read()
bool Foam::crankConRod::read()
{
if (Time::read())
{
@ -122,29 +119,33 @@ bool Foam::engineTime::read()
}
Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
Foam::scalar Foam::crankConRod::degToTime(const scalar theta) const
{
// 6 * rpm => deg/s
return theta/(6.0*rpm_.value());
}
Foam::scalar Foam::engineTime::timeToDeg(const scalar t) const
Foam::scalar Foam::crankConRod::timeToDeg(const scalar t) const
{
// 6 * rpm => deg/s
return t*(6.0*rpm_.value());
}
Foam::scalar Foam::engineTime::theta() const
Foam::scalar Foam::crankConRod::theta() const
{
return timeToDeg(value());
}
// Return current crank-angle translated to a single revolution
// (value between -180 and 180 with 0 = top dead centre)
Foam::scalar Foam::engineTime::thetaRevolution() const
Foam::word Foam::crankConRod::unit() const
{
return " CAD";
}
Foam::scalar Foam::crankConRod::thetaRevolution() const
{
scalar t = theta();
@ -162,13 +163,13 @@ Foam::scalar Foam::engineTime::thetaRevolution() const
}
Foam::scalar Foam::engineTime::deltaTheta() const
Foam::scalar Foam::crankConRod::deltaTheta() const
{
return timeToDeg(deltaTValue());
}
Foam::scalar Foam::engineTime::pistonPosition(const scalar theta) const
Foam::scalar Foam::crankConRod::pistonPosition(const scalar theta) const
{
return
(
@ -187,46 +188,14 @@ Foam::scalar Foam::engineTime::pistonPosition(const scalar theta) const
}
Foam::dimensionedScalar Foam::engineTime::pistonPosition() const
{
return dimensionedScalar
(
"pistonPosition",
dimLength,
pistonPosition(theta())
);
}
Foam::dimensionedScalar Foam::engineTime::pistonDisplacement() const
{
return dimensionedScalar
(
"pistonDisplacement",
dimLength,
pistonPosition(theta() - deltaTheta()) - pistonPosition().value()
);
}
Foam::dimensionedScalar Foam::engineTime::pistonSpeed() const
{
return dimensionedScalar
(
"pistonSpeed",
dimVelocity,
pistonDisplacement().value()/(deltaTValue() + VSMALL)
);
}
Foam::scalar Foam::engineTime::userTimeToTime(const scalar theta) const
Foam::scalar Foam::crankConRod::userTimeToTime(const scalar theta) const
{
return degToTime(theta);
}
Foam::scalar Foam::engineTime::timeToUserTime(const scalar t) const
Foam::scalar Foam::crankConRod::timeToUserTime(const scalar t) const
{
return timeToDeg(t);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,12 +22,12 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::engineTime
Foam::crankConRod
Description
Manage time in terms of engine RPM and crank-angle.
When engineTime is in effect, the userTime is reported in degrees
When crankConRod is in effect, the userTime is reported in degrees
crank-angle instead of in seconds. The RPM to be used is specified in
\c constant/engineGeometry. If only a time conversion is required,
the geometric engine parameters can be dropped or set to zero.
@ -42,19 +42,16 @@ Description
clearance clearance [0 1 0 0 0] 0.0;
\endverbatim
Note
The engineTime can currently only be selected at compile-time.
SourceFiles
engineTime.C
crankConRod.C
\*---------------------------------------------------------------------------*/
#ifndef engineTime_H
#define engineTime_H
#ifndef crankConRod_H
#define crankConRod_H
#include "Time.H"
#include "IOdictionary.H"
#include "engineTime.H"
#include "dictionary.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -63,17 +60,15 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class engineTime Declaration
Class crankConRod Declaration
\*---------------------------------------------------------------------------*/
class engineTime
class crankConRod
:
public Time
public engineTime
{
// Private data
IOdictionary dict_;
//- RPM is required
dimensionedScalar rpm_;
@ -87,20 +82,24 @@ class engineTime
// Private Member Functions
//- Disallow default bitwise copy construct
engineTime(const engineTime&);
crankConRod(const crankConRod&);
//- Disallow default bitwise assignment
void operator=(const engineTime&);
void operator=(const crankConRod&);
//- Adjust read time values
void timeAdjustment();
public:
//- Runtime type information
TypeName("crankConRod");
// Constructors
//- Construct from objectRegistry arguments
engineTime
crankConRod
(
const word& name,
const fileName& rootPath,
@ -111,7 +110,7 @@ public:
);
//- Destructor
virtual ~engineTime()
virtual ~crankConRod()
{}
@ -132,12 +131,6 @@ public:
// Access
//- Return the engine geometry dictionary
const IOdictionary& engineDict() const
{
return dict_;
}
//- Return the engines current operating RPM
const dimensionedScalar& rpm() const
{
@ -170,23 +163,17 @@ public:
//- Return current crank-angle
scalar theta() const;
virtual scalar theta() const;
//- Return time unit
virtual word unit() const;
//- Return current crank-angle translated to a single revolution
// (value between -180 and 180 with 0 = top dead centre)
scalar thetaRevolution() const;
//- Return crank-angle increment
scalar deltaTheta() 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 scalar deltaTheta() const;
// Member functions overriding the virtual functions in time

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 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 "engineTime.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(engineTime, 0);
defineRunTimeSelectionTable(engineTime, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::engineTime::engineTime
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName,
const fileName& constantName,
const fileName& dictName
)
:
Time
(
name,
rootPath,
caseName,
systemName,
constantName
),
dict_
(
IOobject
(
"engineGeometry",
constant(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::engineTime::readDict()
{
Time::readDict();
}
bool Foam::engineTime::read()
{
if (Time::read())
{
return true;
}
else
{
return false;
}
}
Foam::dimensionedScalar Foam::engineTime::pistonPosition() const
{
return dimensionedScalar
(
"pistonPosition",
dimLength,
pistonPosition(theta())
);
}
Foam::dimensionedScalar Foam::engineTime::pistonDisplacement() const
{
return dimensionedScalar
(
"pistonDisplacement",
dimLength,
pistonPosition(theta() - deltaTheta()) - pistonPosition().value()
);
}
Foam::dimensionedScalar Foam::engineTime::pistonSpeed() const
{
return dimensionedScalar
(
"pistonSpeed",
dimVelocity,
pistonDisplacement().value()/(deltaTValue() + VSMALL)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 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::engineTime
Description
An abstract class for the time description of the piston motion
SourceFiles
engineTime.C
\*---------------------------------------------------------------------------*/
#ifndef engineTime_H
#define engineTime_H
#include "Time.H"
#include "IOdictionary.H"
#include "dimensionedScalar.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class engineTime Declaration
\*---------------------------------------------------------------------------*/
class engineTime
:
public Time
{
protected:
const IOdictionary dict_;
public:
//- Runtime type information
TypeName("engineTime");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
engineTime,
dictionary,
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName,
const fileName& constantName,
const fileName& dictName
),
(name, rootPath, caseName, systemName, constantName, dictName)
);
// Constructors
//- Construct from objectRegistry arguments
engineTime
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName = "system",
const fileName& constantName = "constant",
const fileName& dictName = "engineGeometry"
);
// Selector
static autoPtr<engineTime> New
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName = "system",
const fileName& constantName = "constant",
const fileName& dictName = "engineGeometry"
);
//- Destructor
virtual ~engineTime()
{}
// Member Functions
// Conversion
//- Calculate the piston position from the engine geometry
// and given timr (CA or s)
virtual scalar pistonPosition(const scalar theta) const = 0;
// Access
//- Return the engine geometry dictionary
inline const IOdictionary& engineDict() const
{
return dict_;
}
//- Return current engine time
// (value might be expressed in CA or s depending on the model)
virtual scalar theta() const = 0;
//- Return time unit
virtual word unit() const = 0;
//- Return engine time increment
// (value might be expressed in CA or s depending on the model)
virtual scalar deltaTheta() const = 0;
//- 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;
// Member functions overriding the virtual functions in time
//- Read the control dictionary and set the write controls etc.
virtual void readDict();
// Edit
//- Read the controlDict and set all the parameters
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 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 "engineTime.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::engineTime> Foam::engineTime::New
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName,
const fileName& constantName,
const fileName& dictName
)
{
IFstream engineDictFile("."/constantName/dictName);
dictionary engineDict(engineDictFile);
const word engineType
(
engineDict.lookupOrDefault<word>("engineType", "crankConRod")
);
Info<< "Selecting engine type " << engineType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(engineType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown engine type "
<< engineType << nl << nl
<< "Valid engine types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<engineTime>
(
cstrIter()
(
name,
rootPath,
caseName,
systemName,
constantName,
dictName
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,91 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "freePiston.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(freePiston, 0);
addToRunTimeSelectionTable(engineTime, freePiston, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::freePiston::freePiston
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName,
const fileName& constantName,
const fileName& dictName
)
:
engineTime
(
name,
rootPath,
caseName,
systemName,
constantName
),
pistonPositionTime_
(
Function1<scalar>::New("pistonPositionTime", dict_)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::freePiston::theta() const
{
return value();
}
Foam::word Foam::freePiston::unit() const
{
return " s";
}
Foam::scalar Foam::freePiston::deltaTheta() const
{
return deltaTValue();
}
Foam::scalar Foam::freePiston::pistonPosition(const scalar theta) const
{
return pistonPositionTime_->value(theta);
}
// ************************************************************************* //

View File

@ -0,0 +1,145 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::freePiston
Description
In case of free pistons, the piston position is determined by a user-defined
position according to time.
The piston trajectory is specified in \c constant/engineGeometry using a
table or a separated file. The position is relative to the cylinder head,
i.e. decreasing when compressing.
For example,
\verbatim
pistonPositionTime table ( (0 0.13) (0.020 0.03) );
\endverbatim
or with a tableFile
\verbatim
pistonPositionTime tableFile;
pistonPositionTimeCoeffs
{
fileName "data";
outOfBounds clamp;
interpolationScheme linear;
}
\endverbatim
SourceFiles
freePiston.C
\*---------------------------------------------------------------------------*/
#ifndef freePiston_H
#define freePiston_H
#include "engineTime.H"
#include "dictionary.H"
#include "dimensionedScalar.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class freePiston Declaration
\*---------------------------------------------------------------------------*/
class freePiston
:
public engineTime
{
// Private data
autoPtr<Function1<scalar>> pistonPositionTime_;
// Private Member Functions
//- Disallow default bitwise copy construct
freePiston(const freePiston&);
//- Disallow default bitwise assignment
void operator=(const freePiston&);
public:
//- Runtime type information
TypeName("freePiston");
// Constructors
//- Construct from objectRegistry arguments
freePiston
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName = "system",
const fileName& constantName = "constant",
const fileName& dictName = "engineGeometry"
);
//- Destructor
virtual ~freePiston()
{}
// Member Functions
// Conversion
//- Calculate the piston position from the engine geometry
// and given crank angle.
scalar pistonPosition(const scalar theta) const;
// Access
//- Return current engine time
virtual scalar theta() const;
//- Return time unit
virtual word unit() const;
//- Return engine time increment
virtual scalar deltaTheta() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,14 +80,14 @@ Foam::ignitionSite::ignitionSite
(
db_.userTimeToTime
(
edb.degToTime(readScalar(ignitionSiteDict_.lookup("start")))
edb.userTimeToTime(readScalar(ignitionSiteDict_.lookup("start")))
)
),
duration_
(
db_.userTimeToTime
(
edb.degToTime(readScalar(ignitionSiteDict_.lookup("duration")))
edb.userTimeToTime(readScalar(ignitionSiteDict_.lookup("duration")))
)
),
strength_(readScalar(ignitionSiteDict_.lookup("strength"))),

View File

@ -1,8 +1,13 @@
Info<< "Create engine time\n" << endl;
Info<< "Create engine time\n" << endl;
engineTime runTime
autoPtr<engineTime> runTimePtr
(
engineTime::New
(
Time::controlDictName,
args.rootPath(),
args.caseName()
);
)
);
engineTime& runTime = runTimePtr();

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
location "0";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [0 0 0 1 0 0 0];
internalField uniform $:internalField.T;
boundaryField
{
back
{
type wedge;
}
front
{
$back;
}
liner
{
$:wall.T;
}
cylinderHead
{
$liner;
}
piston
{
$liner;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM:.Uhe Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [0 1 -1 0 0 0 0];
internalField uniform $:internalField.U;
boundaryField
{
back
{
type wedge;
}
front
{
$back;
}
liner
{
$:wall.U;
}
cylinderHead
{
$liner;
}
piston
{
$:piston.U;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [0 0 0 0 0 0 0];
internalField uniform 1;
boundaryField
{
back
{
type wedge;
}
front
{
$back;
}
liner
{
$:wall.p;
}
cylinderHead
{
$liner;
}
piston
{
$liner;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
location "0";
object alphat;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [1 -1 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
back
{
type wedge;
}
front { $back; }
liner { $:wall.alphat; }
cylinderHead { $liner; }
piston { $liner; }
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [0 2 -3 0 0 0 0];
internalField uniform $:internalField.epsilon;
boundaryField
{
back
{
type wedge;
}
front
{
$back;
}
liner
{
$:wall.epsilon;
}
cylinderHead
{
$liner;
}
piston
{
$liner;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,70 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object boundaryConditions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
wall
{
p
{
type zeroGradient;
}
U
{
type fixedValue;
value uniform (0 0 0);
}
T
{
type zeroGradient;
}
k
{
type kqRWallFunction;
value uniform $:internalField.k;
}
epsilon
{
type epsilonWallFunction;
value uniform $:internalField.epsilon;
}
nut
{
type nutkWallFunction;
value uniform 0;
}
alphat
{
type compressible::alphatWallFunction;
Prt 0.85;
value uniform 0;
}
}
piston
{
U
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object caseSettings;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
internalField
{
U (0 0 0);
epsilon 5.70e-5;
k 2.40e-5;
T 350;
p 1e5;
}
#include "boundaryConditions"
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM:.khe Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [0 2 -2 0 0 0 0];
internalField uniform $:internalField.k;
boundaryField
{
back
{
type wedge;
}
front
{
$back;
}
liner
{
$:wall.k;
}
cylinderHead
{
$liner;
}
piston
{
$liner;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
back
{
type wedge;
}
front { $back; }
liner { $:wall.nut; }
cylinderHead { $liner; }
piston { $liner; }
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM:.phe Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "include/caseSettings"
dimensions [1 -1 -2 0 0 0 0];
internalField uniform $:internalField.p;
boundaryField
{
back
{
type wedge;
}
front
{
$back;
}
liner
{
$:wall.p;
}
cylinderHead
{
$liner;
}
piston
{
$liner;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object engineGeometry;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
engineMesh layered;
engineType freePiston;
pistonPositionTime table
(
(0 0.13)
(0.020 0.013)
);
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 0);
// ************************************************************************* //

View File

@ -0,0 +1,8 @@
species
(
air
);
reactions
{
}

View File

@ -0,0 +1,21 @@
air
{
specie
{
nMoles 1;
molWeight 28.9596;
}
thermodynamics
{
Tlow 200;
Thigh 3500;
Tcommon 1000;
highCpCoeffs ( 3.57304 -7.24383e-04 1.67022e-06 -1.26501e-10 -4.20580e-13 -1047.41 3.12431 );
lowCpCoeffs ( 3.09589 1.22835e-03 -4.14267e-07 6.56910e-11 -3.87021e-15 -983.191 5.34161 );
}
transport
{
As 1.67212e-06;
Ts 170.672;
}
}

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType
{
type hePsiThermo;
mixture reactingMixture;
transport sutherland;
thermo janaf;
equationOfState perfectGas;
specie specie;
energy sensibleInternalEnergy;
}
inertSpecie air;
chemistryReader foamChemistryReader;
foamChemistryFile "$FOAM_CASE/constant/include/reactions.air";
foamChemistryThermoFile "$FOAM_CASE/constant/include/thermo.air";
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,87 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(0.05 -0.000872753 0)
(0.05 0.000872753 0)
(0 0 0.13)
(0.05 -0.000872753 0.13)
(0.05 0.000872753 0.13)
);
blocks
(
hex (0 1 2 0 3 4 5 3) (50 1 130) simpleGrading (1 1 1)
);
boundary
(
front
{
type wedge;
faces
(
(0 1 4 3)
);
}
back
{
type wedge;
faces
(
(0 3 5 2)
);
}
piston
{
type wall;
faces
(
(0 2 1 0)
);
}
cylinderHead
{
type wall;
faces
(
(3 4 5 3)
);
}
axis
{
type empty;
faces
(
(0 3 3 0)
);
}
liner
{
type wall;
faces
(
(1 2 5 4)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application coldEngineFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.03;
deltaT 5.0e-7;
writeControl adjustableRunTime;
writeInterval 0.001;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 8;
runTimeModifiable true;
adjustTimeStep yes;
maxCo 0.25;
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwind grad(U);
div(phi,e) Gauss linearUpwind grad(e);
div(phiv,p) Gauss linear;
div(phi,K) Gauss linear;
div(meshPhi,p) Gauss linear;
div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p;
}
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"rho.*"
{
solver diagonal;
}
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.1;
}
pFinal
{
$p;
relTol 0;
}
"(U|e|k|epsilon)"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-5;
relTol 0.1;
}
"(U|e|k|epsilon)Final"
{
$U;
relTol 0;
}
}
PIMPLE
{
nCorrectors 2;
nNonOrthogonalCorrectors 1;
momentumPredictor yes;
}
// ************************************************************************* //