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
This commit is contained in:
Henry Weller
2015-11-20 18:55:36 +00:00
parent 654433f692
commit cc942ed18e
19 changed files with 189 additions and 32 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,6 +42,7 @@ int main(int argc, char *argv[])
{ {
argList::validArgs.append("CHEMKINFile"); argList::validArgs.append("CHEMKINFile");
argList::validArgs.append("CHEMKINThermodynamicsFile"); argList::validArgs.append("CHEMKINThermodynamicsFile");
argList::validArgs.append("CHEMKINTransport");
argList::validArgs.append("FOAMChemistryFile"); argList::validArgs.append("FOAMChemistryFile");
argList::validArgs.append("FOAMThermodynamicsFile"); argList::validArgs.append("FOAMThermodynamicsFile");
@ -57,16 +58,16 @@ int main(int argc, char *argv[])
speciesTable species; 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 reactionsFile
<< "species" << cr.species() << token::END_STATEMENT << nl << nl; << "species" << cr.species() << token::END_STATEMENT << nl << nl;
cr.reactions().write(reactionsFile); cr.reactions().write(reactionsFile);
OFstream thermoFile(args[4]); OFstream thermoFile(args[5]);
cr.speciesThermo().write(thermoFile); cr.speciesThermo().write(thermoFile);
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -645,8 +645,7 @@ bool finishReaction = false;
highCpCoeffs, highCpCoeffs,
lowCpCoeffs lowCpCoeffs
), ),
1.67212e-6, transportDict_.subDict(currentSpecieName)
170.672
) )
); );

View File

@ -774,9 +774,12 @@ void Foam::chemkinReader::addReaction
void Foam::chemkinReader::read void Foam::chemkinReader::read
( (
const fileName& CHEMKINFileName, const fileName& CHEMKINFileName,
const fileName& thermoFileName const fileName& thermoFileName,
const fileName& transportFileName
) )
{ {
transportDict_.read(IFstream(transportFileName)());
if (thermoFileName != fileName::null) if (thermoFileName != fileName::null)
{ {
std::ifstream thermoStream(thermoFileName.c_str()); std::ifstream thermoStream(thermoFileName.c_str());
@ -824,8 +827,9 @@ void Foam::chemkinReader::read
Foam::chemkinReader::chemkinReader Foam::chemkinReader::chemkinReader
( (
const fileName& CHEMKINFileName,
speciesTable& species, speciesTable& species,
const fileName& CHEMKINFileName,
const fileName& transportFileName,
const fileName& thermoFileName, const fileName& thermoFileName,
const bool newFormat const bool newFormat
) )
@ -837,7 +841,7 @@ Foam::chemkinReader::chemkinReader
newFormat_(newFormat), newFormat_(newFormat),
imbalanceTol_(ROOTSMALL) imbalanceTol_(ROOTSMALL)
{ {
read(CHEMKINFileName, thermoFileName); read(CHEMKINFileName, thermoFileName, transportFileName);
} }
@ -868,6 +872,11 @@ Foam::chemkinReader::chemkinReader
thermoFile = fileName(thermoDict.lookup("CHEMKINThermoFile")).expand(); thermoFile = fileName(thermoDict.lookup("CHEMKINThermoFile")).expand();
} }
fileName transportFile
(
fileName(thermoDict.lookup("CHEMKINTransportFile")).expand()
);
// allow relative file names // allow relative file names
fileName relPath = thermoDict.name().path(); fileName relPath = thermoDict.name().path();
if (relPath.size()) if (relPath.size())
@ -877,13 +886,18 @@ Foam::chemkinReader::chemkinReader
chemkinFile = relPath/chemkinFile; chemkinFile = relPath/chemkinFile;
} }
if (!thermoFile.isAbsolute()) if (thermoFile != fileName::null && !thermoFile.isAbsolute())
{ {
thermoFile = relPath/thermoFile; thermoFile = relPath/thermoFile;
} }
if (!transportFile.isAbsolute())
{
transportFile = relPath/transportFile;
}
} }
read(chemkinFile, thermoFile); read(chemkinFile, thermoFile, transportFile);
} }

View File

@ -208,6 +208,9 @@ private:
//- List of the reactions //- List of the reactions
ReactionList<gasHThermoPhysics> reactions_; ReactionList<gasHThermoPhysics> reactions_;
//- Transport properties dictionary
dictionary transportDict_;
//- Flag to indicate that file is in new format //- Flag to indicate that file is in new format
Switch newFormat_; Switch newFormat_;
@ -302,10 +305,10 @@ private:
void read void read
( (
const fileName& CHEMKINFileName, const fileName& CHEMKINFileName,
const fileName& thermoFileName const fileName& thermoFileName,
const fileName& transportFileName
); );
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
chemkinReader(const chemkinReader&); chemkinReader(const chemkinReader&);
@ -324,8 +327,9 @@ public:
//- Construct from CHEMKIN III file name //- Construct from CHEMKIN III file name
chemkinReader chemkinReader
( (
const fileName& chemkinFile,
speciesTable& species, speciesTable& species,
const fileName& CHEMKINFileName,
const fileName& transportFileName,
const fileName& thermoFileName = fileName::null, const fileName& thermoFileName = fileName::null,
const bool newFormat = false const bool newFormat = false
); );

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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;
}
}
// ************************************************************************* //

View File

@ -33,7 +33,7 @@ EulerImplicitCoeffs
odeCoeffs odeCoeffs
{ {
solver seulex; solver Rosenbrock34; //SIBS; //seulex;
absTol 1e-12; absTol 1e-12;
relTol 1e-1; relTol 1e-1;
} }

View File

@ -27,8 +27,7 @@ thermoType
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes; runTimeModifiable yes;
suppressSolverInfo yes; DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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;
}
}
// ************************************************************************* //

View File

@ -27,8 +27,7 @@ thermoType
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes; runTimeModifiable yes;
suppressSolverInfo yes; DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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;
}
}
// ************************************************************************* //

View File

@ -27,8 +27,7 @@ thermoType
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes; runTimeModifiable yes;
suppressSolverInfo yes; DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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;
}
}
// ************************************************************************* //

View File

@ -27,8 +27,7 @@ thermoType
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
// ************************************************************************* // // ************************************************************************* //

View File

@ -47,7 +47,9 @@ timePrecision 6;
runTimeModifiable yes; runTimeModifiable yes;
suppressSolverInfo yes; DebugSwitches
{
SolverPerformance 0;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,27 @@
/*--------------------------------*- 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;
}
}
// ************************************************************************* //

View File

@ -27,8 +27,8 @@ thermoType
} }
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties";
newFormat yes; newFormat yes;