-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcourant.py
More file actions
43 lines (34 loc) · 833 Bytes
/
Copy pathcourant.py
File metadata and controls
43 lines (34 loc) · 833 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
38
39
40
41
42
43
import matplotlib.pyplot as plt
a=[]
c=[]
t=[]
plt.rcParams.update({
"text.usetex": True,
"font.family": "serif",
"font.serif": ["Computer Modern Roman"],
})
with open("log.foamRun", "r") as file:
for line in file:
if line.startswith("Courant Number mean: "):
b=line.split(" ")
#print(b)
a.append(float(b[3]))
c.append(float(b[5]))
if line.startswith("Time = "):
b=line.split("s")
d=float(b[0].split(" ")[2])
#print(c)
t.append(d)
a = a[:-1]
c = c[:-1]
plt.subplot(1, 2, 1)
plt.plot(t,a,"k--")
plt.ylim(0, 0.06)
plt.xlabel("Time in s")
plt.ylabel("Interface Courant Number mean")
plt.subplot(1, 2, 2)
plt.plot(t,c,"k--")
plt.ylim(0, 1)
plt.xlabel("Time in s")
plt.ylabel("Max Courant Number")
plt.show()