-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_cfl.py
More file actions
37 lines (31 loc) · 775 Bytes
/
plot_cfl.py
File metadata and controls
37 lines (31 loc) · 775 Bytes
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
import matplotlib.pyplot as plt
import numpy as np
_all__ = ["plot_cfl"]
# x = np.array(
# [
# [0.023775, 0.00375, 0.0021, 0.001275],
# [0.006625, 0.00185, 0.00105, 0.00065],
# [0.003075, 0.000925, 0.000525, 0.000325],
# ]
# )
ltype = [
"r-o",
"b-o",
"g-o",
"m-o",
]
def plot_cfl(x, title=None):
dxs = np.array([1 / 40, 1 / 80, 1 / 160])
fig, ax = plt.subplots()
for deg, result in enumerate(x.T):
print(result)
plt.plot(dxs, result, ltype[deg], label="degree " + str(deg + 1))
plt.xlabel("Mesh size")
plt.ylabel("Max. stable dt (s)")
plt.legend()
ax.set_yscale("log")
if title is not None:
plt.title(title)
plt.grid()
plt.show()
# plot_cfl(x, title="KMV-tria")