-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
61 lines (48 loc) · 1.52 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""Module to run chemical kintetics library."""
from flamespeed import chemkin
# =====================
# Elementary reactions
# =====================
# Specie concentrations
x = [0.5, 0, 0, 2, 0, 1]
# Import reaction data
a = chemkin.ReactionRate()
a.read_XML('./flamespeed/data/rxns_units.xml', verify_integrity=False, convert_units=True)
print(a)
# Set temperature
a.set_temp(900)
# Progress rate
r = a.get_reaction_rate(x)
print("\nReaction rate:")
print(r)
# Set temperature
a.set_temp(2500)
# Progress rate
r = a.get_reaction_rate(x)
print("\n\nReaction rate:")
print(r)
# ==============================
# Parse non-elementary reactions
# ==============================
# Import reaction data
a = chemkin.ReactionRate()
print ("\n\n[Tree Body Parsed]")
a.read_XML('./flamespeed/data/rxn_ThreeBody.xml', verify_integrity=True, convert_units=True)
for idx, item in enumerate(a.k_params_nonelementary):
print ("Reaction {}".format(str(idx)))
for rxn in item:
print (rxn)
print ("\n[Troe Tree Body Parsed]")
a = chemkin.ReactionRate()
a.read_XML('./flamespeed/data/rxn_TroeFalloffThreeBody.xml', verify_integrity=True, convert_units=True)
for idx, item in enumerate(a.k_params_nonelementary):
print ("Reaction {}".format(str(idx)))
for rxn in item:
print (rxn)
print ("\n[Duplicate Parsed]")
a = chemkin.ReactionRate()
a.read_XML('./flamespeed/data/rxn_Duplicate.xml', verify_integrity=True, convert_units=True)
for idx, item in enumerate(a.k_params_nonelementary):
print ("Reaction {}".format(str(idx)))
for rxn in item:
print (rxn)