You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+80-2Lines changed: 80 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Dynamic Simulation of CSTR
2
2
This app allows you to control different operating parameters (e.g., feed temperature and volume flow rate) and study the dynamic behavior of a CSTR. Furthermore, you are able to define your own power-law reactions and scripts to change input parameters.
The change of reactor temperature and concentrations of components with time is obtained by solving a system of ordinary differential equations:
@@ -18,7 +18,7 @@ These equations are solved using explicit Runge-Kutta method of order 5(4). The
18
18
19
19
The steady-state heat generation/removal rate ($Q_{gen},\ Q_{rem}$) as a function of reactor temperature is obtained by solving steady-state material balance equations when $dc_j/dt=0$.
20
20
21
-
## $T_{reactor}/T_{coolant}$ Behavior Changes as a Function of Space Velocity ($v/V_R$)
21
+
## $T_{reactor}/T_{coolant}$ Behavior changes as a function of space velocity ($v/V_R$)
22
22
23
23
The steady-state heat balance equation ($dT/dt=0$) is
24
24
@@ -39,6 +39,8 @@ The contour plot below demonstrates the relationship between $T_{reactor}$ (y va
39
39
If we draw a straight line at a certain space velocity, like the yellow one, we find 5 intersections at $T_{coolant}$=300 K, which correspond to 5 possible steady-states. Similarly, the red line has 3 intersections at $T_{coolant}$=400 K. As we decrease $v/V_R$, we moves from multiple steady-state to monotonic behavior.
40
40
## Define custom reactions
41
41
42
+
Reactions can be defined by a `.json` file under `reactions` directory. An example file for the first-order reaction $A\longrightarrow P$ is shown below.
43
+
42
44
```
43
45
[
44
46
{
@@ -63,3 +65,79 @@ If we draw a straight line at a certain space velocity, like the yellow one, we
63
65
}
64
66
]
65
67
```
68
+
69
+
We can define multiple reactions in one file, so that we can simulate a complex system composed of many simple power-law reactions. Take the van der Vusse reaction for example:
70
+
71
+
$$A\stackrel{k_1}{\longrightarrow} B \stackrel{k_2}{\longrightarrow} C$$
72
+
73
+
$$2A\stackrel{k_3}{\longrightarrow} D$$
74
+
75
+
The `.json` file for the van der Vusse reaction looks like this:
76
+
77
+
```
78
+
[
79
+
{
80
+
"A": [-1, 1],
81
+
"B": [1, 0],
82
+
"k0": 3.575e8,
83
+
"Ea": 81.1305,
84
+
"dH": 4.2e6
85
+
},
86
+
{
87
+
"B": [-1, 1],
88
+
"C": [1, 0],
89
+
"k0": 3.575e8,
90
+
"Ea": 81.1305,
91
+
"dH": -11e6
92
+
},
93
+
{
94
+
"A": [-2, 2],
95
+
"D": [1, 0],
96
+
"k0": 2.512e6,
97
+
"Ea": 71.16784,
98
+
"dH": -41.85e6
99
+
},
100
+
{
101
+
"C0": {
102
+
"A": 5.1,
103
+
"B": 0,
104
+
"C": 0,
105
+
"D": 0
106
+
},
107
+
"VR": 0.01,
108
+
"v": 1.667e-3,
109
+
"T0": 387.05,
110
+
"rho": 934.2,
111
+
"Cp": 3010,
112
+
"Tc": 350,
113
+
"UA": 240.8,
114
+
"initial": {
115
+
"C": [2.2291, 1.0417, 0.9140, 0.9152],
116
+
"T": 352.741
117
+
}
118
+
}
119
+
]
120
+
```
121
+
122
+
We use 3 `{}` to define those reactions and then use the last `{}` to specify other necessary operating parameters. Be aware that enthalpy of reaction ( `"dH"` ) and reaction rate is calculated based on the first component written in each `{}`. In this case, we also set initial values for concentrations and reactor temperature by specifying `"initial"` (optional). If specified, values in `initial["C"]` are assigned to each component in `"C0"` at t=0.
123
+
124
+
## Define custom scripts
125
+
126
+
The control over operating variables ($T_0,\ T_c,\ v,\ UA$) can be automated via user-defined scripts in `scripts/scripts.json`. Each entry contains the script name and a piece of python code.
127
+
128
+
```
129
+
{
130
+
"T0 increases linearly": ["T0", "T0 + 0.5"],
131
+
"T0 decreases linearly": ["T0", "T0 - 0.5"],
132
+
"T0 fluctuates in a sine wave": ["T0", "350 + 20 * sin( 0.02 * pi * t)"],
133
+
"Tc increases linearly": ["Tc", "Tc + 0.5"],
134
+
"Tc decreases linearly": ["Tc", "Tc - 0.5"],
135
+
"Tc fluctuates in a sine wave": ["Tc", "320 + 20 * sin( 0.02 * pi * t)"],
136
+
"v increases linearly": ["v", "v + 0.0005"],
137
+
"v decreases linearly": ["v", "v - 0.0005"],
138
+
"UA increases linearly": ["UA", "UA + 20"],
139
+
"UA decreases linearly": ["UA", "UA - 20"]
140
+
}
141
+
```
142
+
143
+
Once a script is created or modified, save the file and click the Reset button, and it will automatically appear on this window:
0 commit comments