def test_graphics_dict():
    """Test if No# of Reactions consistent with No# of Specie Lists"""
    xml_filename = os.path.join(DATA_DIRECTORY, "rxnset_long.xml")
    parser = Parser.ReactionParser(xml_filename)
    concentration = ({
        'H': 1,
        'H2': 1,
        'H2O': 0,
        'H2O2': 1,
        'HO2': 1,
        'O': 1,
        "O2": 1,
        "OH": 1
    })
    temperature = 1000
    rxnsys = ReactionSystems.ReactionSystem(parser.reaction_list,
                                            parser.NASA_poly_coefs,
                                            temperature, concentration)
    target = "final/results"
    graphics_dict = {
        'node_color': "hello",
        'rate': False,
        'arrow_size': False,
        'arrow_color': True,
        'init_con': True,
        'prod_con': True
    }
    obj = visualizer.ReactionPathDiagram(target,
                                         rxnsys,
                                         integrate=False,
                                         time=None,
                                         cluster=False)
    obj.fit()
    with pytest.raises(ValueError):
        obj.connect(graphics_dict, size=5, separate=False)
Exemple #2
0
concentration = ({'H':1, 'H2':1, 'H2O':0, 'H2O2':1, 'HO2':1, 'O':1, "O2":1, "OH":1})
temperature = 1000


# Set up reaction system
rxnsys = ReactionSystems.ReactionSystem(parser.reaction_list,
                        parser.NASA_poly_coefs,
                        temperature,
                        concentration)

target = "outputs/"
graph_dict = {'node_color':True,'rate':False,'arrow_size':True,'arrow_color':True,'init_con':True,'prod_con': True}
#compute the concentration change with timestep

for i in range(3):
    graph = visualizer.ReactionPathDiagram(target+str(i), rxnsys, integrate=True, time=1e-15, cluster=True)
    graph.fit()
    graph.connect(graph_dict, size=5, separate = True)
    graph.plot()

imgs = [target+str(i)+".gv.png" for i in range(3)]
graph.create_video(imgs, target+'output_video')

# Compute and sort reaction rates
rxnrates_dict = rxnsys.sort_reaction_rates()

# display reaction rates by species
for k, v in rxnrates_dict.items():
    print("d[{0}]/dt : \t {1:e}".format(k, v))