-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_inventories.py
More file actions
60 lines (46 loc) · 1.27 KB
/
plot_inventories.py
File metadata and controls
60 lines (46 loc) · 1.27 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import numpy as np
import matplotlib.pyplot as plt
import matplotx
mb_thickness = 12e-3 # m
mb_width = 28e-3
data_1d = np.genfromtxt(
"src/model_1d/results/derived_quantities.csv", delimiter=",", names=True
)
t_1d = data_1d["ts"]
inventory_1d = (
sum([data_1d["Total_retention_volume_{}".format(mat_id)] for mat_id in [1, 2, 3]])
* mb_thickness
* mb_width
)
data_2d = np.genfromtxt(
"src/model_2d/results/derived_quantities.csv", delimiter=",", names=True
)
t_2d = data_2d["ts"]
inventory_2d = (
sum([data_2d["Total_retention_volume_{}".format(mat_id)] for mat_id in [8, 7, 6]])
* mb_thickness
* 2
)
data_3d = np.genfromtxt(
"src/model_3d/results/derived_quantities.csv", delimiter=",", names=True
)
t_3d = data_3d["ts"]
inventory_3d = (
sum([data_3d["Total_retention_volume_{}".format(mat_id)] for mat_id in [6, 7, 8]])
* 4
)
plt.figure(figsize=(6.4, 3))
plt.plot(t_1d, inventory_1d, label="1D")
plt.plot(t_2d, inventory_2d, label="2D")
plt.plot(t_3d, inventory_3d, label="3D")
plt.xlim(left=1e3)
plt.xscale("log")
plt.yscale("log")
# plt.ylim(bottom=0)
plt.xlabel("Time (s)")
plt.ylabel("Inventory (H)")
plt.gca().spines.right.set_visible(False)
plt.gca().spines.top.set_visible(False)
matplotx.line_labels()
plt.tight_layout()
plt.show()