View Issue Details

IDProjectCategoryView StatusLast Update
0001888OpenFOAM[All Projects] Bugpublic2015-11-20 18:58
ReporterDanielJAssigned Tohenry 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version14.04
Product Versiondev 
Fixed in Version 
Summary0001888: ChemkinReader - allow definition of transport properties for individual species
DescriptionCurrently Chemkin reader has hardcoded Sutherland coefficients independent of mixture composition. I propose to add possibility of reading transport properties of individual species.

I attached a patch with an implementation of this feature that adds optional entry 'CHEMKINTransportFile' in thermophysicalProperties file. This entry should contain a path to a file with defined transport properties of individual mixture components. This way it is possible to use the same file as 'foamChemistryThermoFile' used with foamChemistryReader.
This implementation is backward compatible - all old cases will behave exactly as before. Also this patch corrects a bug that occurs when 'CHEMKINThermoFile' entry is not defined.
TagsNo tags attached.

Activities

DanielJ

2015-11-01 13:51

reporter  

ChemkinReader-support-for-transport-properties.patch (8,287 bytes)
From fde66d51bb67620e8cd677ee878de5a2566204c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com>
Date: Sun, 1 Nov 2015 14:31:52 +0100
Subject: [PATCH] ChemkinReader - support for transport properties of
 individual species

---
 .../chemistryReaders/chemkinReader/chemkinLexer.L  |  5 +--
 .../chemistryReaders/chemkinReader/chemkinReader.C | 41 +++++++++++++++++++---
 .../chemistryReaders/chemkinReader/chemkinReader.H |  9 ++++-
 .../transport/sutherland/sutherlandTransport.C     | 31 ++++++++++++++--
 .../transport/sutherland/sutherlandTransport.H     | 21 ++++++-----
 5 files changed, 89 insertions(+), 18 deletions(-)

diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
index 98a7bbd..ae98050 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
@@ -645,8 +645,9 @@ bool finishReaction = false;
                     highCpCoeffs,
                     lowCpCoeffs
                 ),
-                1.67212e-6,
-                170.672
+                transportDict_.isDict(currentSpecieName)?
+                transportDict_.subDict(currentSpecieName):
+                defTransportDict_
             )
         );
 
diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
index 2334241..db49297 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
@@ -774,9 +774,26 @@ void Foam::chemkinReader::addReaction
 void Foam::chemkinReader::read
 (
     const fileName& CHEMKINFileName,
-    const fileName& thermoFileName
+    const fileName& thermoFileName,
+    const fileName& transportFileName
 )
 {
+    // Initialize default transport dictionary
+    dictionary transport;
+    transport.add("As", 1.67212e-6);
+    transport.add("Ts", 170.672);
+    defTransportDict_.add("transport",transport);
+
+    if (transportFileName != fileName::null)
+    {
+        transportDict_.read(IFstream(transportFileName)());
+
+        if (transportDict_.isDict("default"))
+        {
+            defTransportDict_ = transportDict_.subDict("default");
+        }
+    }
+
     if (thermoFileName != fileName::null)
     {
         std::ifstream thermoStream(thermoFileName.c_str());
@@ -843,7 +860,7 @@ Foam::chemkinReader::chemkinReader
     newFormat_(newFormat),
     imbalanceTol_(ROOTSMALL)
 {
-    read(CHEMKINFileName, thermoFileName);
+    read(CHEMKINFileName, thermoFileName, fileName::null);
 }
 
 
@@ -869,11 +886,22 @@ Foam::chemkinReader::chemkinReader
 
     fileName thermoFile = fileName::null;
 
+    fileName transportFile = fileName::null;
+
     if (thermoDict.found("CHEMKINThermoFile"))
     {
         thermoFile = fileName(thermoDict.lookup("CHEMKINThermoFile")).expand();
     }
 
+    if (thermoDict.found("CHEMKINTransportFile"))
+    {
+        transportFile =
+            fileName
+            (
+                thermoDict.lookup("CHEMKINTransportFile")
+            ).expand();
+    }
+
     // allow relative file names
     fileName relPath = thermoDict.name().path();
     if (relPath.size())
@@ -883,13 +911,18 @@ Foam::chemkinReader::chemkinReader
             chemkinFile = relPath/chemkinFile;
         }
 
-        if (!thermoFile.isAbsolute())
+        if (thermoFile != fileName::null && !thermoFile.isAbsolute())
         {
             thermoFile = relPath/thermoFile;
         }
+
+        if (transportFile != fileName::null && !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 ee1986f..82be8b7 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H
@@ -208,6 +208,12 @@ private:
         //- List of the reactions
         ReactionList<gasHThermoPhysics> reactions_;
 
+        //- Transport properties dictionary
+        dictionary transportDict_;
+
+        //- Default transport properties dictionary
+        dictionary defTransportDict_;
+
         //- Flag to indicate that file is in new format
         Switch newFormat_;
 
@@ -302,7 +308,8 @@ private:
         void read
         (
             const fileName& CHEMKINFileName,
-            const fileName& thermoFileName
+            const fileName& thermoFileName,
+            const fileName& transportFileName
         );
 
 
diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C
index d23f604..756f6b7 100644
--- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C
+++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C
@@ -26,6 +26,15 @@ License
 #include "sutherlandTransport.H"
 #include "IOstreams.H"
 
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+template<class Thermo>
+void Foam::sutherlandTransport<Thermo>::readFrom(const dictionary& dict)
+{
+    As_ = readScalar(dict.subDict("transport").lookup("As"));
+    Ts_ = readScalar(dict.subDict("transport").lookup("Ts"));
+}
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 template<class Thermo>
@@ -43,11 +52,27 @@ template<class Thermo>
 Foam::sutherlandTransport<Thermo>::sutherlandTransport(const dictionary& dict)
 :
     Thermo(dict),
-    As_(readScalar(dict.subDict("transport").lookup("As"))),
-    Ts_(readScalar(dict.subDict("transport").lookup("Ts")))
-{}
+    As_(0.0),
+    Ts_(0.0)
+{
+    readFrom(dict);
+}
 
 
+template<class Thermo>
+Foam::sutherlandTransport<Thermo>::sutherlandTransport
+(
+    const Thermo& t,
+    const dictionary& dict
+)
+:
+    Thermo(t),
+    As_(0.0),
+    Ts_(0.0)
+{
+    readFrom(dict);
+}
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 template<class Thermo>
diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H
index 25973ac..2c3e270 100644
--- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H
+++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H
@@ -106,6 +106,14 @@ class sutherlandTransport
 
     // Private Member Functions
 
+        //- Construct from components
+        inline sutherlandTransport
+        (
+            const Thermo& t,
+            const scalar As,
+            const scalar Ts
+        );
+
         //- Calculate the Sutherland coefficients
         //  given two viscosities and temperatures
         inline void calcCoeffs
@@ -114,19 +122,13 @@ class sutherlandTransport
             const scalar mu2, const scalar T2
         );
 
+        //- Read coefficients from dictionary
+        void readFrom(const dictionary& dict);
 
 public:
 
     // Constructors
 
-        //- Construct from components
-        inline sutherlandTransport
-        (
-            const Thermo& t,
-            const scalar As,
-            const scalar Ts
-        );
-
         //- Construct from two viscosities
         inline sutherlandTransport
         (
@@ -144,6 +146,9 @@ public:
         //- Construct from dictionary
         sutherlandTransport(const dictionary& dict);
 
+        //- Construct from base thermo and dictionary
+        sutherlandTransport(const Thermo& t,const dictionary& dict);
+
         //- Construct and return a clone
         inline autoPtr<sutherlandTransport> clone() const;
 
-- 
1.9.1

henry

2015-11-06 17:05

manager   ~0005577

Thanks for your effort and the patch. I think it is a very good idea to sort out the hard-coded transport properties for CHEMKIN input but maintaining backward compatibility introduces a lot of clutter to maintain. I think it would be better if providing the transport properties is a requirement. If you could simplify the changes in this manner and provide an appropriate input file for the transport properties it would be much appreciated.

henry

2015-11-06 17:39

manager   ~0005578

I have updated sutherlandTransport based on your patch:

commit d46bbbf44082a9c663853d914daf5dc477dd7c50

DanielJ

2015-11-07 10:52

reporter   ~0005579

What about the default values for transport properties in a file? I think that a default value is a useful option because often this parameters are not known or sometimes are not important (for example when we have only trace concentration of some species or a specie in a mechanism is not present in our system).

henry

2015-11-07 11:20

manager   ~0005580

A general approach would be to support wildcards in the lookup of the transport properties which would also be consistent with the rest of OpenFOAM.

DanielJ

2015-11-07 12:57

reporter  

Chemkin-Reader-read-transport-properties.patch (4,679 bytes)
From 747628b5a78da09ed98f977376dbec3d9e887e53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com>
Date: Sat, 7 Nov 2015 13:53:23 +0100
Subject: [PATCH] Chemkin Reader - reading transport properties

---
 .../chemistryReaders/chemkinReader/chemkinLexer.L  |  3 +-
 .../chemistryReaders/chemkinReader/chemkinReader.C | 38 +++++++++++++++++++---
 .../chemistryReaders/chemkinReader/chemkinReader.H |  8 ++++-
 3 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L
index 98a7bbd..841808a 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 2334241..441bcd1 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
@@ -771,12 +771,31 @@ void Foam::chemkinReader::addReaction
 }
 
 
+void Foam::chemkinReader::createDefaultTransport()
+{
+    dictionary transport;
+    transport.add("As", 1.67212e-6);
+    transport.add("Ts", 170.672);
+
+    dictionary defaultDict;
+    defaultDict.add("transport",transport);
+
+    transportDict_.add(keyType(".*",true),defaultDict);
+}
+
+
 void Foam::chemkinReader::read
 (
     const fileName& CHEMKINFileName,
-    const fileName& thermoFileName
+    const fileName& thermoFileName,
+    const fileName& transportFileName
 )
 {
+    if (transportFileName != fileName::null)
+    {
+        transportDict_.read(IFstream(transportFileName)());
+    }
+
     if (thermoFileName != fileName::null)
     {
         std::ifstream thermoStream(thermoFileName.c_str());
@@ -843,7 +862,8 @@ Foam::chemkinReader::chemkinReader
     newFormat_(newFormat),
     imbalanceTol_(ROOTSMALL)
 {
-    read(CHEMKINFileName, thermoFileName);
+    createDefaultTransport();
+    read(CHEMKINFileName, thermoFileName, fileName::null);
 }
 
 
@@ -874,6 +894,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())
@@ -883,13 +908,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 ee1986f..780f020 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,9 +305,12 @@ private:
         void read
         (
             const fileName& CHEMKINFileName,
-            const fileName& thermoFileName
+            const fileName& thermoFileName,
+            const fileName& transportFileName
         );
 
+        // Fill transport dictionary with default values
+        void createDefaultTransport();
 
         //- Disallow default bitwise copy construct
         chemkinReader(const chemkinReader&);
-- 
1.9.1

DanielJ

2015-11-09 18:26

reporter   ~0005591

Current patch removed the backward compatibility code, but still needed "default properties" to make chemkinToFoam work without specifying transport properties.

henry

2015-11-09 18:39

manager   ~0005592

My understanding is that you (and I) want to avoid having transport properties hard-coded in OpenFOAM so

+void Foam::chemkinReader::createDefaultTransport()
+{
+ dictionary transport;
+ transport.add("As", 1.67212e-6);
+ transport.add("Ts", 170.672);
+
+ dictionary defaultDict;
+ defaultDict.add("transport",transport);
+
+ transportDict_.add(keyType(".*",true),defaultDict);
+}

seems rather unwise. We should make the transport properties specified in the input files just as done for the thermo properties.

DanielJ

2015-11-09 19:04

reporter   ~0005593

If you look closer at the code you will see that the createDefaultTransport method is only used in the constructor that is only used by the chemkinToFoam utility. In my opinion this utility should not require from the user to prepare additional transport properties file and therefore default properties should be defined somewhere. I think that messing up the chemkinToFoam code for that would be an uglier solution. If you think that transport file should also be required for chemkinToFoam we can agree to disagree and I will correct the code :)

henry

2015-11-12 20:31

manager   ~0005606

Why should the transport data not be provided for chemkinToFoam? At the moment the built-in transport properties are written into the FOAMThermodynamicsFile that chemkinToFoam writes; wouldn't it be better to write the real data? Wouldn't it be best if the reaction codes use the same data irrespective of manner in which it is read, either directly from the CHEMKIN files or from the files generated by chemkinToFoam?

DanielJ

2015-11-16 15:12

reporter   ~0005615

I am looking at this from the user perspective. If I want to convert Chemkin files to OpenFOAM I do not expected having to prepare another transport file to 'glue' this two formats but expect the program to do it for me in some reasonable manner. If I need to change the transport properties I can do it using changeDictionary. This way I can have the same effect but will not be scared by this additional transport file that I do not know where to get from.
I know that that the code will be messier but in my opinion easier to use, especially for beginners.

PS. I seems that chemkinToFoam cannot write results to a subdirectory if that subdirectory does not yet exist.

henry

2015-11-16 15:24

manager   ~0005616

Your proposal introduces a (hidden) inconsistency; running directly with the CHEMKIN files or first converting them to OpenFOAM format will produce different results. With the current code at least the behavior is the same.

I think any improvement we make to the handling of CHEMKIN files should not introduce an inconsistency. I do not understand why you are happy to supply transport properties to run with the CHEMKIN file but not when converting it to OpenFOAM.

Another option to guarantee consistency would be to support only the conversion of CHEMKIN files to OpenFOAM format and the solvers will read the OpenFOAM files only. Then we could drop the conversion of the thermo data which must be supplied separately.

DanielJ

2015-11-16 16:12

reporter   ~0005617

I see this inconsistency, however now if you only have Chemkin files you cannot run the simulation and this inconsistency will not go unnoticed.

Yes I am happy to specify transport to solvers because I want to run simulation with this transport properties. However if I use chemkinToFoam I want to convert, in some reasonable manner, information from Chemkin files into OpenFOAM and that is it.

This is all just my opinion and I might be completely wrong on this position. As I said before I do not mind having my opinion on this particular topic discarded, I think that this way it might even be more productive :)

henry

2015-11-16 16:26

manager   ~0005618

> I see this inconsistency, however now if you only have Chemkin files you
> cannot run the simulation and this inconsistency will not go unnoticed.

Currently you can run with either the CHEMKIN files or the converted files and the transport properties are the same in both cases, i.e. consistently wrong except for air. I agree that the transport properties should not be built-in and should be supplied by the user in a consistent manner so the behavior of the solvers is the same either using the CHEMKIN files or the converted files.

I see two options to maintain consistency:

1. Only support the convesion of CHEMKIN files and don't provide transport properties for this conversion.

2. Always supply transport properties with the CHEMKIN files both for conversion and direct read by the solver.

DanielJ

2015-11-16 17:02

reporter   ~0005619

Out of this two options I much more prefer the second.

DanielJ

2015-11-17 11:14

reporter  

Chemkin-Reader-and-chemkinToFoam-read-transport-properties.patch (6,232 bytes)
From e6773d7da67bf708fde01dc4e32ded33e9aaebc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com>
Date: Tue, 17 Nov 2015 12:09:09 +0100
Subject: [PATCH] Chemkin Reader and chemkinToFoam - read transport properties

---
 .../thermophysical/chemkinToFoam/chemkinToFoam.C   |  7 ++++---
 .../chemistryReaders/chemkinReader/chemkinLexer.L  |  3 +--
 .../chemistryReaders/chemkinReader/chemkinReader.C | 24 +++++++++++++++++-----
 .../chemistryReaders/chemkinReader/chemkinReader.H | 10 ++++++---
 4 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
index 8399c10..88a68c1 100644
--- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
+++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
@@ -41,6 +41,7 @@ using namespace Foam;
 int main(int argc, char *argv[])
 {
     argList::validArgs.append("CHEMKINFile");
+    argList::validArgs.append("CHEMKINTransport");
     argList::validArgs.append("CHEMKINThermodynamicsFile");
     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[2], args[3], 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 98a7bbd..841808a 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 2334241..fb4a218 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());
@@ -830,8 +833,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
 )
@@ -843,7 +847,7 @@ Foam::chemkinReader::chemkinReader
     newFormat_(newFormat),
     imbalanceTol_(ROOTSMALL)
 {
-    read(CHEMKINFileName, thermoFileName);
+    read(CHEMKINFileName, thermoFileName, transportFileName);
 }
 
 
@@ -874,6 +878,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())
@@ -883,13 +892,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 ee1986f..74ee551 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
         );
-- 
1.9.1

DanielJ

2015-11-17 11:15

reporter   ~0005624

I uploaded a patch that should conform to the second option.

henry

2015-11-20 17:17

manager   ~0005645

I am testing your changes but unfortunately your patch does not include the changes required to the tutorials so none of the test currently run.

henry

2015-11-20 18:58

manager   ~0005646

Resolved in OpenFOAM-dev by commit cc942ed18e9e6a61f8e04f4683b028fa06907922

Issue History

Date Modified Username Field Change
2015-11-01 13:51 DanielJ New Issue
2015-11-01 13:51 DanielJ File Added: ChemkinReader-support-for-transport-properties.patch
2015-11-06 17:05 henry Note Added: 0005577
2015-11-06 17:39 henry Note Added: 0005578
2015-11-07 10:52 DanielJ Note Added: 0005579
2015-11-07 11:20 henry Note Added: 0005580
2015-11-07 12:57 DanielJ File Added: Chemkin-Reader-read-transport-properties.patch
2015-11-09 18:26 DanielJ Note Added: 0005591
2015-11-09 18:39 henry Note Added: 0005592
2015-11-09 19:04 DanielJ Note Added: 0005593
2015-11-12 20:31 henry Note Added: 0005606
2015-11-16 15:12 DanielJ Note Added: 0005615
2015-11-16 15:24 henry Note Added: 0005616
2015-11-16 16:12 DanielJ Note Added: 0005617
2015-11-16 16:26 henry Note Added: 0005618
2015-11-16 17:02 DanielJ Note Added: 0005619
2015-11-17 11:14 DanielJ File Added: Chemkin-Reader-and-chemkinToFoam-read-transport-properties.patch
2015-11-17 11:15 DanielJ Note Added: 0005624
2015-11-20 17:17 henry Note Added: 0005645
2015-11-20 18:58 henry Note Added: 0005646
2015-11-20 18:58 henry Status new => resolved
2015-11-20 18:58 henry Resolution open => fixed
2015-11-20 18:58 henry Assigned To => henry