Methane laminar flamespeed using openFoam

How to use Chemkin OpenFoam converter to simulate methane flames

Have you ever tried using the chemkin openFoam converter (chemkinToFoam)?

From searching online people have had problems with both the conversion steps and interpreting the simulation results. This post demonstrates how to use chemkinToFoam to convert the GRI-Mech 3.0 mechanism to openFoam format. A video showing the process is given below, followed by a description of some of the input format problems and assumptions.

Video showing how to use chemkin openFoam converter (chemkinToFoam)

Methane Flame Test Case

The test case used in the video is a one-dimensional methane flame. The equivalence ratio is 0.8 and the initial conditions are computed using Cantera. This solution is interpolated onto the openFoam mesh and stored in the \0 folder. A future post will explain this process in more detail for those who are interested.

Download the test case using this link:

Test Case: Methane Flame With 0.8 Equivalence Ratio

Copy the files and use the command “tar -xvzf Chemkin-OpenFoam-Methane-Flame-Simulation.tar.gz” to unzip the folder

This test case uses the Gri-Mech 3.0 kinetic mechanism. This detailed mechanism contains 325 reactions and 53 species. The chemistry file (grimech30.dat) and thermodynamics file (thermo30.dat) can be retrieved from the Gri-Mech 3.0 Website.

Input File Format Problems

In order to use the chemkin openFoam converter, two changes to the input format are needed:

  1. Replace THERMO with THERMO ALL in thermo30.dat
  2. Search and replace CH2(S) to CH2S in both files

I am not sure why chemkinToFoam is expecting THERMO ALL in the header, but this change is needed for the files to convert. The parser does not like brackets in the species names, so these must be changed as well. After fixing the format issues use the command “chemkinToFoam grimech30.dat thermo30.dat grimech30_foam.dat thermo30_foam.dat” to convert the files.

Input Format Problems Chemkin OpenFoam Converter chemkinToFoam
Input format problems using GRI-Mech 3.0 mechanism with chemkin openFoam converter (chemkinToFoam)

Other Problems and Assumptions

There are two other things to keep in mind when using files converted with chemkinToFoam:

  1. Not all chemkin files are in the correct format for the converter
  2. Viscosity, thermal conductivity, and diffusivity properties are not taken from the thermodynamics file

Some reaction mechanisms given in chemkin format do not actually contain the reaction rate constants (e.g., Lu and Law 19). These files require a second converter and cannot be used directly with the openFoam converter. Also, there are complaints online about converting files with older chemkin formating rules. I have not tested any of these to date.

The second problem involves the treatment of thermodynamic properties in openFoam. The following figure shows the converted openFoam thermo file. Note that the Sutherland parameters are the same for each specie. These parameters appear to be hard-coded in the converter and are not taken from the input thermodynamic data file.

The Sutherland parameters are used to calculate fluid viscosity in openFoam. This parameter is then used to calculate thermal conductivity and diffusivity. Both the constant values used for calculating viscosity, and the assumptions used to determine conductivity and diffusivity will impact the accuracy of the flame simulation.

Constant Sutherland parameters assumed using chemkin openFoam conveter
Constant Sutherland parameters assumed using chemkinToFoam converter

Typical Methane Burning Velocity Results with OpenFoam

Methane flame simulations were completed using the chemistry mechansims Gri-mech 3.0, Lu and Law 19, BFER2, MP1, and DRM19 found at the following links: GRI-Mech 3.0, Lu and Law Reduced Mechanisms, Cantera User Guide, and Kazakov and Frenklach. In all cases the therm30.dat thermodynamics file from the gri-mech 3.0 mechanism was used. It appears that this file is sufficient to use for most reaction mechanisms, although this has not been tested extensively.

Typical flame speed results are summarized in the following plots. The cantera simulation results are shown on the left and openFoam results with the same mechanisms on the right. Cantera uses an adaptive meshing procedure, while the openFoam mesh varied between 50 and 25 micron resolution.

Methane Laminar-Flamespeed Using-Chemkin OpenFoam-Converter chemkinToFoam
Unstreatched laminar burning velocity for methane using detailed and global mechanisms. The experimental data was extracted from the plots of Hu et al., 2015 [1].

The differences in flame speed between Cantera and OpenFoam appear to be due to the thermal conductivity and mass diffusivity assumptions. These will be reviewed further in another post, but the intersted reader can refere to the CFD-online post here: “Difficulties with premixed laminar methane flame in openFoam“.

If you have any questions or would like more information on the problem setup and results, leave a message below or reach out to me on the contact page. You can also email me direct at:

Email: chris@myDustExplosionResearch.com.

[1] E. Hu, X. Li, X. Meng, Y. Chen, Y. Cheng, Y. Xie, and Z. Huang, “Laminar flame speeds and ignition delay times of methane-air mixtures at elevated temperatures and pressures,” Fuel, vol. 158, p. 1—-10, 2015.
[Bibtex]
@ARTICLE{Hu2015,
title={Laminar flame speeds and ignition delay times of methane-air mixtures at elevated temperatures and pressures},
author={Hu, E. and Li, X. and Meng, X. and Chen, Y. and Cheng, Y. and Xie, Y. and Huang, Z.},
journal={Fuel},
volume={158},
pages={1—-10},
year={2015},
}

9 Comments

  • Sun JInguo

    April 20, 2017

    Hello Chris.
    I’m a student in Tsinghua University, China! I am using OpenFOAM4.0 and found the help docs says: chemkinToFoam can convert transporfFile to Foam-format. So I hope you can help me about how to do it? (I am sure my command was right) could you show me a case of OpenFoam4.0
    I would really appreciate this!

    Reply
    • Chris Cloney

      April 20, 2017

      Hello Sun, That would be no problem!

      Can you email me the transport file you are trying to convert and maybe a screen capture of the error message you are getting? My email is chris@myDustExplosionResearch.com. I should be able to convert it and show you how!

      Reply
  • Chourouk

    August 21, 2017

    Hello Chris,
    I’m a student at ENSTA ParisTech and I’m working on my final project with Openfoam 4.1, I need to convert transport and termo files from chemkin to Foam format, but OF4.1 requires 5 arguments and on your tutorial there are 4 arguments, the link of my two chemkin files is: http://www.cerfacs.fr/cantera/docs/mechanisms/kerosene-air/Luche/

    Could you help me please!
    Thank you in advance for your answer.

    Reply
    • Chris Cloney

      August 23, 2017

      Hey Chourouk,

      Looking at this thread: https://www.cfd-online.com/Forums/openfoam/188191-question-about-chemkintofoam.html, it seems that the chemkin transport file is also needed.

      Try including this one: http://combustion.berkeley.edu/gri-mech/version30/files30/transport.dat in your directory and using the command chemkinToFoam

      If that doesn’t work let me know and I will send you some other files to test. Another option (although not a great one depending on what you need version 4.1 for) is to move down to OF 3.0.1 which has the older style converter.

      Let me know if it works!

      Reply
      • Chourouk

        August 24, 2017

        Hey Chris,
        Thank you for your response, but unfortunately it doesn’t work, I think also that the OF 4.1 version does not yet support the chemkin converter.

        Here is the message error that I got every time:
        FOAM FATAL IO ERROR:
        “ill defined primitiveEntry starting at keyword ‘AR’ on line 1 and ending at line 112”

        file: transport.dat at line 112.

        From function void Foam::primitiveEntry::readEntry(const Foam::dictionary&, Foam::Istream&)
        in file db/dictionary/primitiveEntry/primitiveEntryIO.C at line 189.

        FOAM exiting

        If you have another idea I will be really thankful 🙂
        Best regards

        Reply
        • Chris Cloney

          August 24, 2017

          Ok, I spent some time on this and realized it is a black hole. I could not even add a “TOLUENE” reaction to a working file (in OF 3.0.1), because the converter is trying to do an elemental balance of some sort (let alone all the other issues with the new 4.x converter requirements).

          Reply
        • Chris Cloney

          August 24, 2017

          If I were you I would try to avoid the converter altogether. Start with working tutorial from https://github.com/OpenFOAM/OpenFOAM-4.x/tree/master/tutorials/combustion/chemFoam and https://github.com/OpenFOAM/OpenFOAM-4.x/tree/master/tutorials/lagrangian/sprayFoam/aachenBomb/chemkin (should be in your local distribution of OF on your computer).

          Double check that these work and then start building up the chemistry and thermo files to match your kerosene one. You might run into some other problems but you should be much closer to a workable solution!

          Please comment back and let us know how it goes and don’t hesitate to reach out if you get stuck!

          Reply
          • Eric B

            August 29, 2017

            Hi Chris and Chourouk,

            I’ve been trying this too. Searching the bug reports for chemkin led me to this:
            https://bugs.openfoam.org/view.php?id=2582
            https://bugs.openfoam.org/view.php?id=597

            Seems that they’re aware of this issue and won’t approach it without community support or financial donation. Frustrating that it doesn’t work anymore.

            I haven’t tried this in OF5. Hopefully the reverted the patch that caused this.

          • Chris Cloney

            September 3, 2017

            Thanks Eric,

            So it sounds like you now need to use the openFoam input file format for chemistry, but I am not sure why the converter was modified/broken. It works fine in OF 3.0.1.

            If I give you my methane flame files (in OF format) can you check to see if the simulation runs in version 4/5? I do not have it installed on my computer and am just at the end of my thesis, so I don’t want to put it on right now and risk messing up my system.

            If the simulations runs, I can try the OF 3.0.1 converter for the chemistry models you guys are looking at and see if they work. Let me know: chris@myDustExplosionResearch.com

Leave a Reply