Skip to content
Snippets Groups Projects
Name Last commit Last update
Example
TIRAMISU
README.md

LRGP - TIRAMISU

Name

TIRAMISU (Thermodynamical Interpretation of Reactions and Automated Merging for Inter-Scheme Union)

Description

The TIRAMISU automatic fusion code allows to efficiently merge large kinetic mechanisms by translating automaticaly species and extracting sub-mechanisms. Allow a complete merging between two mechanism or a sub-mechanism extraction.

Dependencies

Python 3.11.8 library: os, sys, pickle, time, datetime, copy, re, numpy, matplotlib, itertools, collections

Explanation

To use it, download the TIRAMISU folder. Two example, one of a full merging and the other of a sub-mechanism extraction, are available in the EXAMPLE folder. The two code to use are Main_exe_1.py and Main_exe_2.py (in this order). You can either execute the code from a terminal by calling "python Main_exe_x.py input.txt" (with x=1 or 2) or by using an IDE and commenting line 10 & 11 and uncommenting line 12 & 13 (then replace "0.txt" in line 12 by your input file).

Input file :

The input file is the same for the first and second part of the code (Main_exe_1.py and Main_exe_2.py).
"!" is used to comment line.

The first 3 lines should be the 3 necessary path (in the same order as below):

  • The path to the first mechanism and each mech file. Example: C:/Users/mech1/ mech1.mech mech1.therm mech1.trans
    If the NASA polynomial are in the mech file, put two time the mech file. Example: C:/Users/mech1/ LLNL.mech mech1.mech mech1.trans
    If there is no transport, put only the mech and therm file. Example: C:/Users/mech1/ mech1.mech mech1.therm

  • The path to the second mechanism and each mech file. Example: C:/Users/mech2/ mech2.mech mech2.therm mech2.trans
    If the NASA polynomials are in the mech file, put two time the mech file. Example: C:/Users/mech2/ mech2.mech mech2.mech mech2.trans
    If there is no transport, put only the mech and therm file. Example: C:/Users/mech1/ mech2.mech mech2.therm

  • The path to the output. C:/Users/output/

The mech1 is by default the core mechanism and mech2 the mechanism to translate.
The other lines can be in any order.

"task" is an optional keyword that controls whethe a full merging or a sub-mechanism extraction is wanted. Default is full merging. Example: task=full or task=extraction

"depth" is an optional keyword for extraction task. It controls the maximum number of loop the extraction step does. Default is no maximum (1e10). Example: depth=3

"mech_to_extract" is a MANDATORY keyword for the extraction task. It controls wich species sub-mechanism to extract. Example: mech_to_extract=ic8h18, nc7h16

"translation" is an optional boolean used to enable or disable the translation step. It is only useful if there is already a tmp_species_traduction.tmp or .inp file generated previously.
If the two mechanisms have the same translation, it is also possible to disable the translation and create an empty tmp_species_traduction.inp. Example: translation=True

"n" is an optional keyword that controls the maximum number of permutations that are allowed in method 2. If the number of possible permutations in an isomer group is greater than n, then only method 1 will be used. Example: n=10000

"introduction" is an optional keyword used to customize the first lines of the merged mechanism. Example: introduction=test!?!

"string_to_del" is an optional keyword used to remove species containing a specific string. Example: string_to_del=bb, pb, c6h5c3, c6h5c4, cyc

"list_to_del" is an optional keyword used to remove specific species. Example: list_to_del=a1c2hac, a1c2h3ac, a2-x, a2o

"order" is an optional keyword used to control which mechanism as priority on which part of the mechanism. Possible input are "kt", "k", "t", "n".
k = model_core main for kinetic data and model_to_translate main for thermo data.
t = model_to_translate main for kinetic data and core_mechanism main for thermo data.
kt = model_core main for kinetic and themo data.
n = model_to_translate main for kinetic and thermo data.
Default order task is kt. You can also specify a list of order to generate multiple mechanism in the form "order=order1, order2, order3, ..."
ORDER FOR EXTRACTION_MERGING IS ALWAYS SET TO "kt" !!!
Example: order=k

How to use :

Once the input created, use "python Main_exe_1.py input". A tmp_species_traduction.tmp file will be created. This file contains all the temporary translation done by the code and also which translation needs to be done manually.
This file is separated by isomer group. Each isomer group start with its composition (example: c1 o1 h1).
The next line contains all translation possible contained in mech1.
Then, each isomer for mech2 is presented, associated with its translation or a possibility of translations.
Each line starting with !CHECK needs to be looked carefully. Choose the right translation and remove the !CHECK or the species will be treated as if there is no translation.
If you want to remove a translation, you can comment the line with "!" or change the species with a None.
Everything after a "!" on a line will be treated as a comment.
Explanation of a !CHECK line :

  • !CHECK species_to_translate = [species1, species2, species3] ![value1, value2, value3]
  • First list [species1, species2, species3]
    species1: This is the species name given by the first translation method.
    species2: This is the species name corresponding to the best arrangement found by the second translation method.
    species3: This is the species name corresponding to the second-best arrangement found by the second translation method.
    An arrangement here refers to the match found between all the species to be translated (in the isomer group) and all the species used for translation (in the isomer group). The best arrangement is the one with the minimum mean normalized mean absolute difference (mean NMAD).
  • Second list [value1, value2, value3]
    value1: This is the direct NMAD between the species_to_translate and species1, given by the first method.
    value2: This is the mean NMAD for the best arrangement of the whole isomer group, given by the second method.
    value3: This is the mean NMAD for the second-best arrangement of the whole isomer group, given by the second method.

Once you are satisfied with the translation, copy the file and change the ".tmp" to ".inp". Now you can use "python Main_exe_2.py input".

Example :

Two example are available in this project. They contain the two mechanisms and the input for the two tasks possible (extraction_merging.txt and full_merging.txt).
The results obtained with these two examples are also available so you can compare.
The base tmp_species_traduction.tmp and the modified tmp_species_traduction.inp are also available.