Figure 6.12:

Rates of heat generation and removal for \tau =30.9~min.

Figure 6.12

Code for Figure 6.12

Text of the GNU GPL.

main.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
# Converted from vanheerden.m - Van Heerden diagram: heat generation/removal for 3 theta values
import numpy as np
from misc import octave_save

p = dict(
    k_m      = 0.001,
    T_m      = 298.,
    E        = 8000.,
    c_Af     = 2.,
    C_p      = 4.,
    rho      = 1000.,
    T_f      = 298.,
    T_a      = 298.,
    U        = 0.,
    DeltaH_R = -3e5,
)
p['C_ps'] = p['rho'] * p['C_p']

thetavec = [30.9, 15., 1.79]
nTs   = 50
T_vec = np.linspace(275., 500., nTs)
k     = p['k_m'] * np.exp(-p['E'] * (1./T_vec - 1./p['T_m']))

tables = []
for theta in thetavec:
    Qremoval   = p['C_ps'] / theta * (T_vec - p['T_f'])
    Qgenerated = k / (1 + k*theta) * p['c_Af'] * (-p['DeltaH_R'])
    tables.append(np.column_stack([T_vec, Qremoval, Qgenerated]))

# Save as Octave cell array equivalent
octave_save('vanheerden.dat',
            ('table0', tables[0]),
            ('table1', tables[1]),
            ('table2', tables[2]))