Skip to content
Snippets Groups Projects
Commit 093b4aad authored by Henry Weller's avatar Henry Weller
Browse files

chemkinReader: Add support for reading transport properties from dictionary

Note the dictionary is in OpenFOAM format not CHEMKIN.

Patch provided by Daniel Jasinski
Resolves feature request http://www.openfoam.org/mantisbt/view.php?id=1888
parent dab33cce
Branches
Tags
No related merge requests found
Showing
with 189 additions and 32 deletions
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -42,6 +42,7 @@ int main(int argc, char *argv[])
{
argList::validArgs.append("CHEMKINFile");
argList::validArgs.append("CHEMKINThermodynamicsFile");
argList::validArgs.append("CHEMKINTransport");
argList::validArgs.append("FOAMChemistryFile");
argList::validArgs.append("FOAMThermodynamicsFile");
......@@ -57,16 +58,16 @@ int main(int argc, char *argv[])
speciesTable species;
chemkinReader cr(args[1], species, args[2], newFormat);
chemkinReader cr(species, args[1], args[3], args[2], newFormat);
OFstream reactionsFile(args[3]);
OFstream reactionsFile(args[4]);
reactionsFile
<< "species" << cr.species() << token::END_STATEMENT << nl << nl;
cr.reactions().write(reactionsFile);
OFstream thermoFile(args[4]);
OFstream thermoFile(args[5]);
cr.speciesThermo().write(thermoFile);
Info<< "End\n" << endl;
......
......@@ -645,8 +645,7 @@ bool finishReaction = false;
highCpCoeffs,
lowCpCoeffs
),
1.67212e-6,
170.672
transportDict_.subDict(currentSpecieName)
)
);
......
......@@ -774,9 +774,12 @@ void Foam::chemkinReader::addReaction
void Foam::chemkinReader::read
(
const fileName& CHEMKINFileName,
const fileName& thermoFileName
const fileName& thermoFileName,
const fileName& transportFileName
)
{
transportDict_.read(IFstream(transportFileName)());
if (thermoFileName != fileName::null)
{
std::ifstream thermoStream(thermoFileName.c_str());
......@@ -824,8 +827,9 @@ void Foam::chemkinReader::read
Foam::chemkinReader::chemkinReader
(
const fileName& CHEMKINFileName,
speciesTable& species,
const fileName& CHEMKINFileName,
const fileName& transportFileName,
const fileName& thermoFileName,
const bool newFormat
)
......@@ -837,7 +841,7 @@ Foam::chemkinReader::chemkinReader
newFormat_(newFormat),
imbalanceTol_(ROOTSMALL)
{
read(CHEMKINFileName, thermoFileName);
read(CHEMKINFileName, thermoFileName, transportFileName);
}
......@@ -868,6 +872,11 @@ Foam::chemkinReader::chemkinReader
thermoFile = fileName(thermoDict.lookup("CHEMKINThermoFile")).expand();
}
fileName transportFile
(
fileName(thermoDict.lookup("CHEMKINTransportFile")).expand()
);
// allow relative file names
fileName relPath = thermoDict.name().path();
if (relPath.size())
......@@ -877,13 +886,18 @@ Foam::chemkinReader::chemkinReader
chemkinFile = relPath/chemkinFile;
}
if (!thermoFile.isAbsolute())
if (thermoFile != fileName::null && !thermoFile.isAbsolute())
{
thermoFile = relPath/thermoFile;
}
if (!transportFile.isAbsolute())
{
transportFile = relPath/transportFile;
}
}
read(chemkinFile, thermoFile);
read(chemkinFile, thermoFile, transportFile);
}
......
......@@ -208,6 +208,9 @@ private:
//- List of the reactions
ReactionList<gasHThermoPhysics> reactions_;
//- Transport properties dictionary
dictionary transportDict_;
//- Flag to indicate that file is in new format
Switch newFormat_;
......@@ -302,10 +305,10 @@ private:
void read
(
const fileName& CHEMKINFileName,
const fileName& thermoFileName
const fileName& thermoFileName,
const fileName& transportFileName
);
//- Disallow default bitwise copy construct
chemkinReader(const chemkinReader&);
......@@ -324,8 +327,9 @@ public:
//- Construct from CHEMKIN III file name
chemkinReader
(
const fileName& chemkinFile,
speciesTable& species,
const fileName& CHEMKINFileName,
const fileName& transportFileName,
const fileName& thermoFileName = fileName::null,
const bool newFormat = false
);
......
/*--------------------------------*- 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 "chemkin";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
".*"
{
transport
{
As 0;
Ts 0;
}
}
// ************************************************************************* //
......@@ -33,7 +33,7 @@ EulerImplicitCoeffs
odeCoeffs
{
solver seulex;
solver Rosenbrock34; //SIBS; //seulex;
absTol 1e-12;
relTol 1e-1;
}
......
......@@ -27,8 +27,7 @@ thermoType
}
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* //
......@@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes;
suppressSolverInfo yes;
DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* //
/*--------------------------------*- 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 "chemkin";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
".*"
{
transport
{
As 0;
Ts 0;
}
}
// ************************************************************************* //
......@@ -27,8 +27,7 @@ thermoType
}
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* //
......@@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes;
suppressSolverInfo yes;
DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* //
/*--------------------------------*- 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 "chemkin";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
".*"
{
transport
{
As 0;
Ts 0;
}
}
// ************************************************************************* //
......@@ -27,8 +27,7 @@ thermoType
}
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* //
......@@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes;
suppressSolverInfo yes;
DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* //
/*--------------------------------*- 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 "chemkin";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
".*"
{
transport
{
As 0;
Ts 0;
}
}
// ************************************************************************* //
......@@ -27,8 +27,7 @@ thermoType
}
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* //
......@@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes;
suppressSolverInfo yes;
DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* //
/*--------------------------------*- 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 "chemkin";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
".*"
{
transport
{
As 1.67212e-6;
Ts 170.672;
}
}
// ************************************************************************* //
......@@ -27,8 +27,8 @@ thermoType
}
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
newFormat yes;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment