11{
22 "cells" : [
3+ {
4+ "cell_type" : " markdown" ,
5+ "source" : [
6+ " ## 0. Package Loading"
7+ ],
8+ "metadata" : {}
9+ },
310 {
411 "cell_type" : " code" ,
512 "execution_count" : null ,
6- "metadata" : {},
7- "outputs" : [],
813 "source" : [
914 " from diffeqpy import de\n " ,
1015 " from pyrms import rms\n " ,
1116 " from matplotlib import pyplot as plt\n " ,
1217 " %matplotlib inline"
13- ]
18+ ],
19+ "outputs" : [],
20+ "metadata" : {}
21+ },
22+ {
23+ "cell_type" : " markdown" ,
24+ "source" : [
25+ " ## 1. Read input file\n " ,
26+ " \n " ,
27+ " An example of H2 combustion is included."
28+ ],
29+ "metadata" : {}
1430 },
1531 {
1632 "cell_type" : " code" ,
1733 "execution_count" : null ,
18- "metadata" : {},
19- "outputs" : [],
2034 "source" : [
2135 " phaseDict = rms.readinput(\" ../pyrms/testing/superminimal.rms\" )"
22- ]
36+ ],
37+ "outputs" : [],
38+ "metadata" : {}
2339 },
2440 {
2541 "cell_type" : " code" ,
2642 "execution_count" : null ,
27- "metadata" : {},
28- "outputs" : [],
2943 "source" : [
30- " spcs = phaseDict[\" gas\" ][\" Species\" ]\n " ,
31- " rxns = phaseDict[\" gas\" ][\" Reactions\" ]"
32- ]
44+ " spcs = phaseDict[\" phase\" ][\" Species\" ]\n " ,
45+ " rxns = phaseDict[\" phase\" ][\" Reactions\" ]"
46+ ],
47+ "outputs" : [],
48+ "metadata" : {}
3349 },
3450 {
3551 "cell_type" : " code" ,
3652 "execution_count" : null ,
37- "metadata" : {},
53+ "source" : [
54+ " ig = rms.IdealGas(spcs, rxns, name=\" phase\" )"
55+ ],
3856 "outputs" : [],
57+ "metadata" : {}
58+ },
59+ {
60+ "cell_type" : " markdown" ,
3961 "source" : [
40- " ig = rms.IdealGas(spcs,rxns,name=\" gas\" )"
41- ]
62+ " ## 2. Define initial condition and domain\n " ,
63+ " An example of constant TP domain is shown, where initial T, p, and composition is required."
64+ ],
65+ "metadata" : {}
4266 },
4367 {
4468 "cell_type" : " code" ,
4569 "execution_count" : null ,
46- "metadata" : {},
47- "outputs" : [],
4870 "source" : [
49- " initialconds = {\" T\" :1000.0,\" P\" :10.0e5,\" H2\" :2.0,\" O2\" :1.0}"
50- ]
71+ " initialconds = {\" T\" : 1000.0, \" P\" : 10.0e5, \" H2\" : 2.0, \" O2\" : 1.0}"
72+ ],
73+ "outputs" : [],
74+ "metadata" : {}
5175 },
5276 {
5377 "cell_type" : " code" ,
5478 "execution_count" : null ,
55- "metadata" : {},
79+ "source" : [
80+ " domain, y0, p = rms.ConstantTPDomain(phase=ig, initialconds=initialconds)"
81+ ],
5682 "outputs" : [],
83+ "metadata" : {}
84+ },
85+ {
86+ "cell_type" : " markdown" ,
5787 "source" : [
58- " domain,y0 = rms.ConstantTPDomain(phase=ig,initialconds=initialconds)"
59- ]
88+ " ## 3. Construct the reactor instance and simulate the system\n " ,
89+ " input"
90+ ],
91+ "metadata" : {}
6092 },
6193 {
6294 "cell_type" : " code" ,
6395 "execution_count" : null ,
64- "metadata" : {},
65- "outputs" : [],
6696 "source" : [
67- " react = rms.Reactor(domain,y0,(0.0,10.001))"
68- ]
97+ " tf = 10.001\n " ,
98+ " solver = de.CVODE_BDF()\n " ,
99+ " abstol=1e-20\n " ,
100+ " reltol=1e-8"
101+ ],
102+ "outputs" : [],
103+ "metadata" : {}
69104 },
70105 {
71106 "cell_type" : " code" ,
72107 "execution_count" : null ,
73- "metadata" : {},
108+ "source" : [
109+ " react = rms.Reactor(domain, y0, (0.0, tf))"
110+ ],
74111 "outputs" : [],
112+ "metadata" : {}
113+ },
114+ {
115+ "cell_type" : " code" ,
116+ "execution_count" : null ,
75117 "source" : [
76- " sol = de.solve(react.ode,de.CVODE_BDF(),abstol=1e-20,reltol=1e-8)"
77- ]
118+ " sol = de.solve(react.ode, solver, abstol=abstol, reltol=reltol)"
119+ ],
120+ "outputs" : [],
121+ "metadata" : {}
78122 },
79123 {
80124 "cell_type" : " code" ,
81125 "execution_count" : null ,
82- "metadata" : {},
126+ "source" : [
127+ " sim = rms.Simulation(sol, domain)"
128+ ],
83129 "outputs" : [],
130+ "metadata" : {}
131+ },
132+ {
133+ "cell_type" : " markdown" ,
84134 "source" : [
85- " sim = rms.Simulation(sol,domain)"
86- ]
135+ " ## 4. Results"
136+ ],
137+ "metadata" : {}
138+ },
139+ {
140+ "cell_type" : " markdown" ,
141+ "source" : [
142+ " Mole fraction"
143+ ],
144+ "metadata" : {}
87145 },
88146 {
89147 "cell_type" : " code" ,
90148 "execution_count" : null ,
91- "metadata" : {},
149+ "source" : [
150+ " rms.plotmolefractions(sim, 10.0)"
151+ ],
92152 "outputs" : [],
153+ "metadata" : {}
154+ },
155+ {
156+ "cell_type" : " markdown" ,
93157 "source" : [
94- " rms.plotmolefractions(sim,10.0)"
95- ]
158+ " ROP"
159+ ],
160+ "metadata" : {}
96161 },
97162 {
98163 "cell_type" : " code" ,
99164 "execution_count" : null ,
100- "metadata" : {},
165+ "source" : [
166+ " rms.plotrops(sim, \" OH(D)\" , 1.0, N=10)"
167+ ],
101168 "outputs" : [],
169+ "metadata" : {}
170+ },
171+ {
172+ "cell_type" : " markdown" ,
102173 "source" : [
103- " rms.plotrops(sim,\" OH(D)\" ,1.0,N=10)"
104- ]
174+ " Flux Diagram"
175+ ],
176+ "metadata" : {}
105177 },
106178 {
107179 "cell_type" : " code" ,
108180 "execution_count" : null ,
109- "metadata" : {},
110- "outputs" : [],
111181 "source" : [
112- " rms.getfluxdiagram(sim,1.0)"
113- ]
182+ " rms.getfluxdiagram(sim, 1.0)"
183+ ],
184+ "outputs" : [],
185+ "metadata" : {}
114186 },
115187 {
116188 "cell_type" : " code" ,
117189 "execution_count" : null ,
118- "metadata " : {} ,
190+ "source " : [] ,
119191 "outputs" : [],
120- "source " : []
192+ "metadata " : {}
121193 }
122194 ],
123195 "metadata" : {
141213 },
142214 "nbformat" : 4 ,
143215 "nbformat_minor" : 2
144- }
216+ }
0 commit comments