Problem with Reaction Path Diagram

516 views
Skip to first unread message

M. Mahdi Salehi

unread,
Apr 17, 2017, 2:30:40 PM4/17/17
to Cantera Users' Group
Hello Everyone,

I am running the following script to show different NOx generation routes on a reaction path diagram. I made a slight modification to one of the python scrips of the Cantera tutorials. The problem is that for one of the paths, i.e. N2 -> NNH, the sum of reverse reactions contributions does not add up to 100%. Here is the python script (also attached). I also attached the final reaction path diagram image. 


Regards,
Mahdi

"""

Viewing a reaction path diagram.


This script uses Graphviz to generate an image. You must have Graphviz installed

and the program 'dot' must be on your path for this example to work.

Graphviz can be obtained from http://www.graphviz.org/ or (possibly) installed

using your operating system's package manager.

"""


import os

import sys


import cantera as ct


# these lines can be replaced by any commands that generate

# an object of a class derived from class Kinetics in some state.

gas = ct.Solution('gri30.xml')

gas.TPX = 1000.0, ct.one_atm, 'CH4:0.4, O2:1, N2:3.76'

r = ct.IdealGasReactor(gas)

net = ct.ReactorNet([r])

T = r.T

while T < 2400:

    net.step(1.0)

    T = r.T

    print T


element = 'N'


diagram = ct.ReactionPathDiagram(gas, element)

#diagram.title = 'Reaction path diagram following {0}'.format(element)

#diagram.label_threshold = 0.1

#diagram.show_details = True

#diagram.arrow_width = 1

#diagram.dashed_color = "green"

#diagram.scale = -1

diagram.threshold = 1e-7

diagram.scale = 1

diagram.show_details = True


dot_file = 'rxnpath.dot'

img_file = 'rxnpath.png'

img_path = os.path.join(os.getcwd(), img_file)


diagram.write_dot(dot_file)

print(diagram.get_data())


print("Wrote graphviz input file to '{0}'.".format(os.path.join(os.getcwd(), dot_file)))


os.system('dot {0} -Tpng -o{1} -Gdpi=200'.format(dot_file, img_file))

print("Wrote graphviz output file to '{0}'.".format(img_path))


if "-view" in sys.argv:

    import webbrowser

    webbrowser.open('file:///' + img_path)

rxnpath.png
reaction_path.py

Ray Speth

unread,
Apr 20, 2017, 10:34:00 PM4/20/17
to Cantera Users' Group
Mahdi,

I recently fixed an issue with the flux calculations in reaction path diagrams (see https://github.com/Cantera/cantera/issues/377). You can try compiling the current development version to see if it resolves the problem you are encountering as well.

Regards,
Ray

csgold...@gmail.com

unread,
Nov 23, 2022, 9:59:19 AM11/23/22
to Cantera Users' Group
Hi Ray,

Have these fixes been implemented into recent versions of Cantera? I see these posts are from 2017.

Also, is there a good link which explains how to interpret the fluxes displayed in the diagrams?

Thanks

Reply all
Reply to author
Forward
0 new messages