Difference between revisions of "Extend-bazaar/solvers/combustion/flameletFoam"

From OpenFOAMWiki
(corrected the email address)
Line 89: Line 89:
  
 
Navigate to the ''cantera'' folder that you downloaded.
 
Navigate to the ''cantera'' folder that you downloaded.
Before starting the executable ''flamelet'' it is worth taking a look at ''input.txt''.
+
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.
 
Here, the boundary conditions for the counter-flow diffusion flame simulation are defined.
The pressure, temperature and species mole fraction boundary condition have to match the boundary conditions of the case you want to simulate.
+
An initial solution is stored in the ''solution.xml'' file.
The default values match Sandia Flame D [3, 4 5].
+
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.
 
In the ''mechanisms'' folder, two chemistry mechanisms, GRI3.0 (CH4/O2) and Connaire (H2/O2), are provided.
By default, the script uses GRI3.0.
+
Follow these steps to start the simulation:
This can be changed by adapting line 178 in ''./src/flamelet.cpp'' accordingly.
+
When this is done, the code needs to be recompiled.
+
If all boundary conditions and the chemistry mechanism are set, follow these steps to start the simulation:
+
  
 
* Execute <bash>./flamelet</bash>
 
* Execute <bash>./flamelet</bash>
* The solver will ask, if a initial solution is to be taken. If this is the first run, no initial solution exists and the simulation will be initialized with an equilibrium solution. For all successive calculations it is recommended to use the results of the previous run as an initial solution.
+
* The solver will ask, if a initial solution is to be taken. If a initial solution exists, it is recommended to use it.
* If an equilibrium solution is chosen, the solver will ask for the equivalence ratio. 0.8 is a good choice.
+
* 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.
+
* 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 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:
 
To create more tables at higher scalar dissipation rates, follow these steps:
  
* Open the ''input.txt'' and increase the mass flow rate at both inlets. The values should be the same at both sides.
+
* 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.
 
* 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.
 
* 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.
 
* 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 proofed 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.
  
 
=== canteraToFoam - Flamelet Integration ===
 
=== canteraToFoam - Flamelet Integration ===
Line 162: Line 163:
  
 
This code was presented on the 8th International OpenFOAM workshop in Jeju, Korea.
 
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 [6]:
+
Detailed information about theory and modeling as well as a code validation can be found in the conference paper [3]:
 
[http://www.openfoamworkshop2013.org/file/Fri/Track3/HagenMuller-OFW8.tar OFW8]
 
[http://www.openfoamworkshop2013.org/file/Fri/Track3/HagenMuller-OFW8.tar OFW8]
  
Line 178: Line 179:
 
Energy and Combustion Science, 10(3):319–339, 1984.
 
Energy and Combustion Science, 10(3):319–339, 1984.
  
[2] N. Peters. Turbulent Combustion. Cambridge University Press, 2000.
+
[2] N. Peters. Turbulent Combustion. Cambridge University Press, 2000
 
+
[3] R.S. Barlow, J.H. Frank, A.N. Karpetis, and J.-Y. Chen. Piloted methane/air jet flames: Transport
+
effects and aspects of scalar structure. Combustion and Flame, 143:433–449, 2005.
+
 
+
[4] R.S. Barlow and J.H. Frank. Effects of turbulence on species mass fractions in methane/air jet flames.
+
Proc. Combust. Inst., 27(1):1087–1095, 1998.
+
 
+
[5] R.S. Barlow and J.H. Frank. URL: http://www.sandia.gov/TNF/DataArch/FlameD.html.
+
  
[6] 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.
+
[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.
  
 
== History ==
 
== History ==
 
11 Feb 2014: First upload
 
11 Feb 2014: First upload
 +
28 Feb 2014: Revised Counterflow Diffusion Flame solver (Cantera)

Revision as of 12:55, 28 February 2014

1 Description

Valid versions: OF Version 21.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 and Ubuntu 12.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 source 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:

  • Download the solver HERE.
  • Unpack and 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

  • Download the package HERE
  • Unpack and go to the ./src folder. Set an environment variable to this folder. Alternatively, add this line to your .bashrc.
     export LIB_FLAMELET_SRC=$HOME/($YOUR_PATH$)/flameletFoam/src
  • Execute
    ./Allwmake
  • Navigate to the ./flameletFoam/applications folder and execute
wmake utitlities/preProcessing/canterToFoam
wmake utitlities/postProcessing/flameletFoamPost
wmake solver/flameletFoam

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 a 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 proofed 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 in the package. Go to ./tutorial/pilotedDiffusionFlame/ where you will find a set of exemplary tables in the tables folder. These flamelets refer to the boundary conditions of the Sandia Flame D experiments [3, 4 5]. 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. Compressible LES models can also be selected. An example of the LESProperties dictionary can be found in the constant folder.
  • With the Cchi keyword, the user may change the model constant for the calculation of chi. The default value is 2.

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.
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

In case of further questions, please contact: hagen.mueller [at] unibw [dot] de

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)