Newer
Older
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
import numpy as np
import matplotlib.pyplot as plt
def iterations(h5file, FINAL_TIME, interval = []):
# read time steps
tau = np.array(h5file['relativeTimeIncrement']) * FINAL_TIME
tau = np.delete(tau, 0)
# read fpi iterations
fpi_final = np.array(h5file['iterations/fixedPoint/final'])
fpi_final = np.delete(fpi_final, 0)
#fpi_total = np.array(h5file['iterations/fixedPoint/total'])
# read multigrid iterations
multigrid_final = np.array(h5file['iterations/multiGrid/final'])
multigrid_final = np.delete(multigrid_final, 0)
#multigrid_total = np.array(h5file['iterations/multiGrid/total'])
if len(interval) == 0:
interval = [0, len(tau)-1]
t = np.linspace(interval[0], interval[1], interval[1]-interval[0]+1, endpoint=True, dtype='int8')
# plot
fig = plt.figure()
ax_fpi = fig.add_subplot(3, 1, 1)
ax_fpi.plot(t, fpi_final[t], color='black', linestyle='-')
ax_fpi.set_ylabel('fpi')
#-------------------------
ax_mg = fig.add_subplot(3, 1, 2)
ax_mg.plot(t, multigrid_final[t], color='black', linestyle='-')
ax_mg.set_ylabel('multigrid')
#-------------------------
ax_tau = fig.add_subplot(3, 1, 3)
ax_tau.plot(t, tau[t], color='black', linestyle='-')
ax_tau.set_ylabel('tau')
#-------------------------
fig.canvas.draw()