Reduction of chemical mechanism

965 views
Skip to first unread message

Anuj Kharat

unread,
Jan 13, 2014, 9:32:58 PM1/13/14
to canter...@googlegroups.com
friends,

Has anybody used the cantera for reduction of chemical mechanism for methane?


Anuj

Nick Curtis

unread,
Jan 14, 2014, 10:52:11 AM1/14/14
to canter...@googlegroups.com
Hi Anuj,
I have been working on an add-on for Cantera that allows for reduction and integration of dynamically reduced mechanisms.  However, my efforts recently have been focused on completing my masters thesis, so getting the add-on ready for public use isn't my primary focus at this point in time.  I do anticipate releasing it within the next few months, but as of yet, I do not have a specific date in mind. 

I can tell you that the easiest way to use reduced mechanisms from within Cantera is to create a custom write method for the IdealGasMix class. 
You can use Cantera's built in XML reader/writer (i.e. look at the XML_Node class in xml.cpp & xml.h), to accomplish this. 

Generally what you have to do is determine a list of species you want to keep in the mechanism, and the corresponding reactions.  You can then use the m_r object in an IdealGasMix to find all the different top level nodes.  You can then explore the children of the species and reaction nodes and decide whether or not to write them.  Finally, once you write a reduced XML file, it can be imported just as you would import a CTI file.

However, this requires the use of the C++ interface (as I believe you don't have access to the XML node or class from anywhere else). 

It may be simpler to create a Python script (or something equivalent) that reads in, and modifies the base CTI file, and writes it back out.  This would certainly be my recommendation if you're not very comfortable with Cantera or C++ (although this is a good way to get comfortable with both)


As a last note, this I/O based way of creating reduced mechanisms is not very efficient.  In my own work, I use a boolean vector to turn on/off the calculation of reaction rates, or net production rates.  This does become fairly complicated to stick a dynamic mechanism into CVodes however (basically, you have to reset the integrator each time the mechanism changes).  If your need isn't urgent you can always wait for me to get my act in gear :O

Best,
Nick

anuj kharat

unread,
Jan 14, 2014, 11:52:36 PM1/14/14
to canter...@googlegroups.com
Nick,
I am also doing reduction in mechanism using DRG method
I am able to successfully remove some extra species but removing reactions is bit of tricky.
I want to do this for LPG mixture
I have time till end of April for this
If u make this add-on then please let me test it.
Thanks
Anuj
 


--
You received this message because you are subscribed to the Google Groups "Cantera User's Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To post to this group, send email to canter...@googlegroups.com.
Visit this group at http://groups.google.com/group/cantera-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
Anuj Ravindra Kharat,
Junior Postgraduate,
Department of Aerospace Engineering,
Indian Institute of Science, Bengaluru.

Nick Curtis

unread,
Jan 15, 2014, 11:50:56 AM1/15/14
to canter...@googlegroups.com
Anuj,
For the reactions, I recommend building up a map of reaction -> species
You can access the species in a reaction using the products() and reactants() methods.

Once you have this map, you can easily create your adjacency lists for DRG
Finally you have to create the inverse mapping (i.e. species -> reactions), which should be fairly simple once you have the first mapping

You can then compare reactions in the CTI file to the reaction you want to remove using the reactionString()

Nick

Lasaro Camargos

unread,
Jun 17, 2014, 9:19:39 AM6/17/14
to canter...@googlegroups.com
Nick,
have you had a chance to publish your add-on? I would like to give it a try. My mechanism will change very often and therefore the IO based solution wouldn't be a good fit for me.

Cheers
Lásaro
Message has been deleted

Pierre BOIVIN

unread,
Jul 15, 2014, 6:31:43 AM7/15/14
to canter...@googlegroups.com
I have implemented a simple routine to set manually the reaction rates in cantera. It works with matlab, python and c++ (but I see no reason why it shouldnt work with fortran).

I am not sure this would help for very large reaction mechanisms.
Reply all
Reply to author
Forward
0 new messages