From 093b4aade674f1b1bdebb5272b85f17fe5b9f540 Mon Sep 17 00:00:00 2001 From: Henry Weller <http://cfd.direct> Date: Fri, 20 Nov 2015 18:55:36 +0000 Subject: [PATCH] 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 --- .../chemkinToFoam/chemkinToFoam.C | 9 ++++--- .../chemkinReader/chemkinLexer.L | 3 +-- .../chemkinReader/chemkinReader.C | 24 +++++++++++++---- .../chemkinReader/chemkinReader.H | 10 ++++--- .../chemFoam/gri/chemkin/transportProperties | 27 +++++++++++++++++++ .../chemFoam/gri/constant/chemistryProperties | 2 +- .../gri/constant/thermophysicalProperties | 3 +-- .../chemFoam/gri/system/controlDict | 6 +++-- .../chemFoam/h2/chemkin/transportProperties | 27 +++++++++++++++++++ .../h2/constant/thermophysicalProperties | 3 +-- .../combustion/chemFoam/h2/system/controlDict | 6 +++-- .../ic8h18/chemkin/transportProperties | 27 +++++++++++++++++++ .../ic8h18/constant/thermophysicalProperties | 3 +-- .../chemFoam/ic8h18/system/controlDict | 6 +++-- .../nc7h16/chemkin/transportProperties | 27 +++++++++++++++++++ .../nc7h16/constant/thermophysicalProperties | 3 +-- .../chemFoam/nc7h16/system/controlDict | 6 +++-- .../aachenBomb/chemkin/transportProperties | 27 +++++++++++++++++++ .../constant/thermophysicalProperties | 2 +- 19 files changed, 189 insertions(+), 32 deletions(-) create mode 100644 tutorials/combustion/chemFoam/gri/chemkin/transportProperties create mode 100644 tutorials/combustion/chemFoam/h2/chemkin/transportProperties create mode 100644 tutorials/combustion/chemFoam/ic8h18/chemkin/transportProperties create mode 100644 tutorials/combustion/chemFoam/nc7h16/chemkin/transportProperties create mode 100644 tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/transportProperties diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C index 8399c108565..e91f968a872 100644 --- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C +++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C @@ -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; diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L index a081d6fc141..1c8af0b1235 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L @@ -645,8 +645,7 @@ bool finishReaction = false; highCpCoeffs, lowCpCoeffs ), - 1.67212e-6, - 170.672 + transportDict_.subDict(currentSpecieName) ) ); diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C index 06e6b6ea92d..eef9f3a4dd9 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C @@ -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); } diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H index ee1986f60b0..74ee5512dac 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H @@ -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 ); diff --git a/tutorials/combustion/chemFoam/gri/chemkin/transportProperties b/tutorials/combustion/chemFoam/gri/chemkin/transportProperties new file mode 100644 index 00000000000..6e932ca799b --- /dev/null +++ b/tutorials/combustion/chemFoam/gri/chemkin/transportProperties @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/gri/constant/chemistryProperties b/tutorials/combustion/chemFoam/gri/constant/chemistryProperties index bf097e0ba39..ed98ad965b2 100644 --- a/tutorials/combustion/chemFoam/gri/constant/chemistryProperties +++ b/tutorials/combustion/chemFoam/gri/constant/chemistryProperties @@ -33,7 +33,7 @@ EulerImplicitCoeffs odeCoeffs { - solver seulex; + solver Rosenbrock34; //SIBS; //seulex; absTol 1e-12; relTol 1e-1; } diff --git a/tutorials/combustion/chemFoam/gri/constant/thermophysicalProperties b/tutorials/combustion/chemFoam/gri/constant/thermophysicalProperties index c979a11fd07..90267ad29f8 100644 --- a/tutorials/combustion/chemFoam/gri/constant/thermophysicalProperties +++ b/tutorials/combustion/chemFoam/gri/constant/thermophysicalProperties @@ -27,8 +27,7 @@ thermoType } CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; - CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; - +CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; // ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/gri/system/controlDict b/tutorials/combustion/chemFoam/gri/system/controlDict index 4a0eb6c38ed..be3000bcf40 100644 --- a/tutorials/combustion/chemFoam/gri/system/controlDict +++ b/tutorials/combustion/chemFoam/gri/system/controlDict @@ -47,7 +47,9 @@ timePrecision 6; runTimeModifiable yes; -suppressSolverInfo yes; - +DebugSwitches +{ + SolverPerformance 0; +} // ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/h2/chemkin/transportProperties b/tutorials/combustion/chemFoam/h2/chemkin/transportProperties new file mode 100644 index 00000000000..6e932ca799b --- /dev/null +++ b/tutorials/combustion/chemFoam/h2/chemkin/transportProperties @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/h2/constant/thermophysicalProperties b/tutorials/combustion/chemFoam/h2/constant/thermophysicalProperties index c979a11fd07..90267ad29f8 100644 --- a/tutorials/combustion/chemFoam/h2/constant/thermophysicalProperties +++ b/tutorials/combustion/chemFoam/h2/constant/thermophysicalProperties @@ -27,8 +27,7 @@ thermoType } CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; - CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; - +CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; // ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/h2/system/controlDict b/tutorials/combustion/chemFoam/h2/system/controlDict index caebf52265a..9c63da2ad9e 100644 --- a/tutorials/combustion/chemFoam/h2/system/controlDict +++ b/tutorials/combustion/chemFoam/h2/system/controlDict @@ -47,7 +47,9 @@ timePrecision 6; runTimeModifiable yes; -suppressSolverInfo yes; - +DebugSwitches +{ + SolverPerformance 0; +} // ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/ic8h18/chemkin/transportProperties b/tutorials/combustion/chemFoam/ic8h18/chemkin/transportProperties new file mode 100644 index 00000000000..6e932ca799b --- /dev/null +++ b/tutorials/combustion/chemFoam/ic8h18/chemkin/transportProperties @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/ic8h18/constant/thermophysicalProperties b/tutorials/combustion/chemFoam/ic8h18/constant/thermophysicalProperties index c979a11fd07..90267ad29f8 100644 --- a/tutorials/combustion/chemFoam/ic8h18/constant/thermophysicalProperties +++ b/tutorials/combustion/chemFoam/ic8h18/constant/thermophysicalProperties @@ -27,8 +27,7 @@ thermoType } CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; - CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; - +CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; // ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/ic8h18/system/controlDict b/tutorials/combustion/chemFoam/ic8h18/system/controlDict index 622cadcc0c1..7c100daec0e 100644 --- a/tutorials/combustion/chemFoam/ic8h18/system/controlDict +++ b/tutorials/combustion/chemFoam/ic8h18/system/controlDict @@ -47,7 +47,9 @@ timePrecision 6; runTimeModifiable yes; -suppressSolverInfo yes; - +DebugSwitches +{ + SolverPerformance 0; +} // ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/nc7h16/chemkin/transportProperties b/tutorials/combustion/chemFoam/nc7h16/chemkin/transportProperties new file mode 100644 index 00000000000..6e932ca799b --- /dev/null +++ b/tutorials/combustion/chemFoam/nc7h16/chemkin/transportProperties @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/nc7h16/constant/thermophysicalProperties b/tutorials/combustion/chemFoam/nc7h16/constant/thermophysicalProperties index c979a11fd07..90267ad29f8 100644 --- a/tutorials/combustion/chemFoam/nc7h16/constant/thermophysicalProperties +++ b/tutorials/combustion/chemFoam/nc7h16/constant/thermophysicalProperties @@ -27,8 +27,7 @@ thermoType } CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; - CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; - +CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; // ************************************************************************* // diff --git a/tutorials/combustion/chemFoam/nc7h16/system/controlDict b/tutorials/combustion/chemFoam/nc7h16/system/controlDict index fe0feaaf9df..e2a357da58a 100644 --- a/tutorials/combustion/chemFoam/nc7h16/system/controlDict +++ b/tutorials/combustion/chemFoam/nc7h16/system/controlDict @@ -47,7 +47,9 @@ timePrecision 6; runTimeModifiable yes; -suppressSolverInfo yes; - +DebugSwitches +{ + SolverPerformance 0; +} // ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/transportProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/transportProperties new file mode 100644 index 00000000000..c69c457866b --- /dev/null +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin/transportProperties @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties index ebae047d0b2..312d8c6b954 100644 --- a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/thermophysicalProperties @@ -27,8 +27,8 @@ thermoType } CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; - CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat"; +CHEMKINTransportFile "$FOAM_CASE/chemkin/transportProperties"; newFormat yes; -- GitLab