Extend-bazaar/solvers/combustion/flameletFoam

From OpenFOAMWiki
< Extend-bazaar‎ | solvers‎ | combustion
Revision as of 12:41, 6 April 2015 by Wyldckat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1 Description

Valid versions: OF Version 21.png OF Version 23.png

This code realizes a steady laminar flamelet approach for turbulent non-premixed combustion. The solver is based on rhoReactingFoam, i.e. it is pressure-based (PISO), compressible and runs with both LES and RAS turbulence.

The theory is mainly taken from the work of N. Peters [1, 2] and is based on the view of a turbulent flame as an ensemble of laminar flamelets. The calculation of these flamelets is a one-dimensional problem and can be done in a pre-processing step. Integration using a presumed \beta-Probability Density Function (PDF) accounts for the interaction between turbulent fluctuations and chemistry. The results of the pre-processing procedure are stored in tables which are accessed during the simulation. Values of interest, such as species mass fraction or enthalpy, are looked-up and connected to the flow using three parameters - the mixture fraction Z, its variance \tilde{Z''^2} and the scalar dissipation rate \chi. In doing so, the expensive solution of chemical mechanisms during run-time can be avoided and the run-time thus reduces significantly.

As described, the flamelet approach requires the successive execution of several steps:

I. Flamelet Generation:

The flamelets are represented using a laminar counter-flow diffusion flame which can be described with the one-dimensional flamelet equations as proposed by N. Peters [2]. The equations are solved with Cantera 2.0.0, an open-source chemistry kinetics software that needs to be installed. Cantera provides the environment to solve chemistry mechanisms efficiently on adaptive grids. An extension to Cantera 2.0.0 is included in this package that simulates laminar counter-flow diffusion flames and prepares the result in a way that it is readable with OpenFOAM.

II. Flamelet Integration:

The flamelet results from Cantera need to be integrated with a \beta-PDF before they can be used in a turbulent simulation. An OpenFOAM utility, named canteraToFoam, is provided that reads the Cantera output, integrates the flamelets and arranges the data in tables, accessible for the solver.

III. Run the Simulation:

The solver flameletFoam is based on rhoReactingFoam. However, no chemistry mechanism, nor a transport equation for species mass fraction or enthalpy is solved. Instead a passive scalar, the mixture fraction, and, depending on the turbulence model, its variance is transported. The scalar dissipation rate is determined using an explicit model. These three values enable to look-up the required species mass fractions and enthalpies in the flamelet tables which were created with canteraToFoam.

IV. Post-Processing: Calculate the Species Mass Fraction:

Especially for large simulations, it can take a lot of disk space to write all mass fraction fields for all write times. These fields are therefore not written automatically, but can be calculated in a post-processing step for the required fields and times. For this purpose, the package contains the utility flameletFoamPost.

2 Installation

The prerequisite for using this package is a Linux operating system. The procedure described below was tested on OpenSUSE 12.1 as well as on Ubuntu 12.4 and 14.4.

2.1 Cantera Source

Install Cantera 2.0.0:

  • Download Cantera 2.0.0 HERE
  • Make sure the following packages are on your system: g++ scons libboost-all-dev libsundials-serial-dev subversion libblas-dev liblapack-dev
  • Navigate to the Cantera folder and execute
     scons build optimize=n blas_lapack_libs=blas,lapack prefix=/opt/cantera python_package=none
  • Start the installation (as root):
     scons install
  • Load the environment variables or add this line to your .bashrc:
     source /opt/cantera/bin/setup_cantera

More documentation about the installation of Cantera can be found on the developers homepage: see http://cantera.github.io/docs/sphinx/html/compiling.html.

Problems that might occur:

  • cannot find -lctlapack or cannot find -lctblas -> reinstall Cantera 2.0.0 adding the option single_library=yes
  • cannot find -lf2c -> Install the package libf2c2-dev

Install the counter-flow diffusion flame solver:

  • Prepare a directory on your system, e.g.:
     mkdir ~/cantera/Cantera-CounterflowFlame/
  • Download the solver using git:
     git clone https://github.com/flameletFoam/Cantera-CounterflowFlame/ ~/cantera/Cantera-CounterflowFlame/
  • Go to the src folder of the package. Modify the Makefile to set the correct path to Cantera.mak, i.e.:
     ($YOUR_CANTERA_INSTALLATION_FOLDER$)/build/platform/Cantera.mak
    Typically, this is $HOME/cantera/cantera-2.0.0/build/platform/Cantera.mak
  • Build the source code:
     make
  • The executable flamelet should now appear in the main folder.

2.2 OpenFOAM Source

  • Prepare a directory on your system, e.g.:
     mkdir ~/OpenFOAM/flamletFoam/
  • If you use OpenFoam-2.1:
     git clone https://github.com/flameletFoam/flameletFoam-2.1.x/ ~/OpenFOAM/flameletFoam/
  • If you use OpenFoam-2.3.x:
     git clone https://github.com/flameletFoam/flameletFoam-2.3.x/ ~/OpenFOAM/flameletFoam/
  • If you use OpenFoam-2.3.0:
     git clone https://github.com/flameletFoam/flameletFoam-2.3.0/ ~/OpenFOAM/flameletFoam/
  • Set an environment variable to the flameletFoam "src"-folder:
     export LIB_FLAMELET_SRC=$HOME/($YOUR_PATH)/flameletFoam/src
  • Execute
     ./Allwmake

3 Usage examples

If you don't want to create your own flamelet library (use Cantera), you can test the OpenFOAM solver with the tutorial setup. In that case please go directly to the subsection canteraToFoam - Flamelet Integration.

3.1 Cantera - Flamelet Generation

Navigate to the cantera folder that you downloaded. Examples for the case setup are located in the examples folder. To start a simulation, copy the input.txt and the solution.xml file to the cantera folder. However, before starting the executable flamelet it is worth taking a look at the parameters in input.txt. Here, the boundary conditions for the counter-flow diffusion flame simulation are defined. An initial solution is stored in the solution.xml file. Starting from a good initial solution is crucial to reach convergence. In the mechanisms folder, two chemistry mechanisms, GRI3.0 (CH4/O2) and Connaire (H2/O2), are provided. Follow these steps to start the simulation:

  • Execute
    ./flamelet
  • The solver will ask, if a initial solution is to be taken. If an initial solution exists, it is recommended to use it.
  • However, if no initial solution is chosen, the flow will be initialized with an equilibrium solution. In that case, the equivalence ratio and the type of fuel and oxidizer have to be provided.
  • After convergence, the result will be stored in the canteraTables folder. The file name includes the scalar dissipation rate of the solution. An initial solution for the next simulation will be stored as solution.xml. Note that the previous initial solution is overwritten.

To capture the strain effects, it is necessary to provide flamelets for scalar dissipation rates ranging from 0 to extinction. To create more tables at higher scalar dissipation rates, follow these steps:

  • Open the input.txt and increase the mass flow rate.
  • Decrease the domain length to fit the flame in the domain. This might be an iterative process, i.e. check the results and adjust the domain length.
  • Run the simulation and use the initial solution of the previous run.
  • Repeat this process until the extinction limit is reached. The step size between scalar dissipation rate between the runs should decrease when approaching extinction.

Some notes on convergence: The counter flow diffusion flame simulation is rather sensitive to changes of the boundary conditions. A good initial solution is therefore crucial. It proved to be a good strategy to use the inputs and initial solutions of the provided examples as a starting point. To match the boundary conditions of other flames, the values in the input file can be changed incrementally. Using the equilibrium solution is another possibility, but reaching convergence can be tedious.

3.2 canteraToFoam - Flamelet Integration

To account for the interaction between turbulence and chemistry, the laminar flamelets have to be integrated with a \beta-PDF. This is done by executing the utility canteraToFoam. A tutorial case is included for both RANS and LES simulations. Go to ./tutorial/pilotedDiffusionFlame/ where you will find the setups. The tables are located in the tables folder either in the ras or les example. These flamelets refer to the boundary conditions of the Sandia Flame D experiments. A full GRI3.0 CH4/O2 chemistry mechanism was used to create the flamelet library. To integrate those, follow these steps:

  • Open /constant/tableProperties/" and check the entries.
  • With the canteraFileName keyword, the location of the Cantera tables is defined. In this case the tables in the tutorial are used.
  • The scalar list chi_param defines the scalar dissipation rates that are used. A table has to exist for each entry.
  • The scalar list Zeta_param refers to the normalized mixture fraction variances for the PDF integration. Values below 0 or above 1 are unphysical. More entries result in a better resolution of the tables.
  • With Z_param the user can define how many points in mixture fraction space are used for the table look-up.
  • The utility canteraToFoam needs a mesh - thus run:
     blockMesh
  • Then run
     canteraToFoam

After successful execution, the integrated tables are located in the constant folder. Each table is a three-dimensional tensor. The entries correspond to the values for Z, Zeta and chi that are chosen in the tableProperties dictionary.

3.3 flameletFoam - Start the Simulation

Before starting the simulation, it is worth having a look at combustionProperties, turbulenceProperties and the 0-folder.

combustionProperties

  • The steady laminar flamelet model is chosen with the YSLFModel keyword.
  • The switches useScalarDissipation and useMixtureFractionVariance are set to true by default. Selecting false means that the calculated value for scalar dissipation chi and mixture fraction variance varZ are set to zero, i.e. strain and turbulence-chemistry interaction is neglected. This can be useful if the simulation runs unstable.

RASProperties

  • The kEpsilon model is used in the tutorial, but any other compressible RAS model is available.
  • With the Cchi keyword, the user may change the model constant for the calculation of chi. The default value is 2.
  • The user may also choose values for the laminar and turbulent Schmidt number. The default value is 1 for both.

LESProperties

  • The Smagorinsky model is used in the tutorial, but any other compressible LES model is available.
  • With the keyword "transportVarZ" the user can choose whether a transport equation is solved for varZ "on", or an explicit model is used "off".
  • With the Cchi and theCvarZ keywords, the user may change the model constant for the calculation of chi and "varZ" (for explicit model only). The default value is 2 and 1, respectively.
  • The user may also choose values for the laminar and turbulent Schmidt number. The default value is 1 for both.

0-folder

  • Additional fields that are needed are the mixture fraction Z, its variance varZ and the scalar dissipation rate chi.
  • The temperature and the species mass fractions are well defined by these values and the tables. Thus, no species mass fractions need to be defined.
  • The temperature field, however, is required. The boundaries have to be set to calculated or "zeroGradient".
Start the simulation:
 flameletFoam

3.4 flameletFoamPost - Calculate the Species Mass Fraction

Especially if many species are involved, the effort to write these fields can cost a significant amount of time and disk space. For that reason, the species mass fractions are not written automatically and can not be found in the time folders.

However, if the values are of interest, they can be calculated with the utility flameletFoamPost:
 flameletFoamPost -latestTime -fields '(CH4 O2 CO2 OH)'

4 Further Documentation

This code was presented on the 8th International OpenFOAM workshop in Jeju, Korea. Detailed information about theory and modeling as well as a code validation can be found in the conference paper [3]: OFW8

Should you find bugs or have suggestions how to make the code better, please post on cfd-online using the following thread: http://www.cfd-online.com/Forums/openfoam-programming-development/145761-flameletfoam.html

Or visit the website of our institute: http://www.unibw.de/thermo/index_html-en.

5 Acknowledgments

Financial support has been provided by the German Research Foundation (Deutsche Forschungsgemeinschaft DFG) in the framework of the Sonderforschungsbereich Transregio 40

6 References

[1] N. Peters. Laminar diffusion flamelet models in non-premixed turbulent combustion. Progress in Energy and Combustion Science, 10(3):319–339, 1984.

[2] N. Peters. Turbulent Combustion. Cambridge University Press, 2000

[3] H. Mueller, F. Ferraro, and M. Pfitzner, “Implementation of a steady laminar flamelet model for non-premixed combustion in les and rans simulations,” 8th International OpenFOAM Workshop, June 11-14 2013, Jeju, Korea, 2013.

7 History

11 Feb 2014: First upload

28 Feb 2014: Revised Counterflow Diffusion Flame solver (Cantera)

09 May 2014: Bug fix for canteraReader.C / Corrected PDF extrapolation for singularities at the fuel side

11 Dec 2014: Added links to github / Added version for OpenFOAM-2.3 / Modified text accordingly

8 Known forks/variants of flameletFoam

  • Port of flameletFoam from OpenFOAM 2.1.0 to 2.3.0: new flameletFoam for OpenFoam-2.3.0
    • The author of this fork/variant has also attempted to implement FGM (Flamelet Generated Manifold) in it.