hkmoffat / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

Enhance reactionString to account for three-body reactions and reaction direction #110

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The reactionString() functions currently only give limited control over the 
output formatting. It would be desirable to include a '+M' for three-body or 
falloff reactions, or to make it possible to indicate the reaction direction.
I attached a patch which adds this functionality for the Python interface. It 
might be nice to have this function as well on the C++-level for other uses. 
Besides, the solution regarding three-body reactions is not that great, because 
the reaction types are hard-coded. Hope you still find it useful!

Original issue reported on code.google.com by thetruet...@googlemail.com on 28 Aug 2012 at 2:42

Attachments:

GoogleCodeExporter commented 9 years ago
The C++ function Kinetics.reactionString actually does include "+M" for 
three-body and "(+M)" for falloff reactions, but the Python interface 
reimplements this function (inaccurately), presumably because translating C++ 
strings to Python strings is kind of tricky.

I'm currently working on a new Python module written in Cython that makes use 
of the underlying C++ functions directly, so the inclusion of the third-body 
will be taken care of automatically once that's done.

I like the idea of being able to specify the string used for the reaction 
arrows, though that really should be implemented at the C++ level so it's 
present in all the interfaces. It might be interesting to combine the "latex" 
style with a formatter that made the element quantities into subscripts as well.

I'm not sure I understand the use case for specifying the direction of the 
arrow besides what's indicated by the reaction's reversibility.

Original comment by yarmond on 28 Aug 2012 at 4:34

GoogleCodeExporter commented 9 years ago
The direction of the arrow was actually the reason for me to start this issue. 
I was plotting forward and reverse reaction rates and needed an identifier to 
distinguish between those two. I agree with you that only few people are going 
to use this feature, though.

Original comment by thetruet...@googlemail.com on 28 Aug 2012 at 4:54

GoogleCodeExporter commented 9 years ago
In that case, would be better to just provide 'reactantString' and 
'productString' functions, and you can join them with whatever delimiter you 
like?

Original comment by yarmond on 29 Aug 2012 at 6:35

GoogleCodeExporter commented 9 years ago
You're right, this is probably more intuitive and more general as well.

Original comment by thetruet...@googlemail.com on 30 Aug 2012 at 7:46

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r3018.

Original comment by yarmond on 20 Jun 2014 at 6:45