Figure 8.11:

Residence-time distribution p(\theta ) versus \theta for plug flow with dispersion number D, \tau =2.

Figure 8.11

Code for Figure 8.11

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
# Converted from dispersionpdens.m - dispersion model RTD density p(t)
import numpy as np
from scipy.special import erf
from misc import save_ascii

small = 1e-3
x     = np.linspace(small, 5., 501)
tau   = 2.
Ds    = [0.002, 0.01, 0.05, 0.2]
p_arr = np.zeros((len(x), len(Ds)))

for i, D in enumerate(Ds):
    arg       = (1. - x/tau) / np.sqrt(x/tau) / np.sqrt(4.*D)
    p_arr[:,i] = (1./(2.*tau*np.sqrt(np.pi*4.*D))
                  * np.exp(-arg**2) * (tau/x + 1.) / np.sqrt(x/tau))

ptable = np.column_stack([x, p_arr])
save_ascii('dispersionpdens.dat', ptable)