New: theta and flowrate dependency

This commit is contained in:
L-Nafaryus 2021-05-20 16:17:57 +05:00
parent 1d08deebe0
commit 2ae99854a4
2 changed files with 68 additions and 0 deletions

3
.gitignore vendored
View File

@ -1,6 +1,9 @@
__pycache__ __pycache__
build/ build/
logs/ logs/
storage/
*.gz
*.xz
*.fls *.fls
*.aux *.aux
*.bbl *.bbl

65
extra/theta-flowrate.py Normal file
View File

@ -0,0 +1,65 @@
import matplotlib.pyplot as plt
from math import sqrt
import sys, os
if __name__ == "__main__":
BUILD = "../build"
postProcessing = "postProcessing/flowRatePatch(name=outlet)/0/surfaceFieldValue.dat"
#structures = [
# "simple",
# #"bodyCentered",
# #"faceCentered"
#]
theta = [c * 0.01 for c in range(1, 28 + 1)]
directions = [
[1, 0, 0],
[0, 0, 1],
[1, 1, 1]
]
flowrate = [ [] for n in range(3) ]
for num, d in enumerate(directions):
for t in theta:
path = os.path.join(
BUILD,
"simple",
"direction-{}{}{}".format(*d),
"theta-{}".format(t),
postProcessing
)
with open(path, "r") as io:
lastLine = io.readlines()[-1]
value = lastLine.replace(" ", "").replace("\n", "").split("\t")[1]
flowrate[num].append(float(value))
plt.figure(1)
#plt.subplot(211)
line, = plt.plot(theta, flowrate[0], "o")
line.set_label("[1, 0, 0]")
#plt.grid(True)
#plt.legend()
#plt.xlabel("theta")
#plt.ylabel("flowRate")
#plt.subplot(212)
line, = plt.plot(theta, flowrate[1], "o")
line.set_label("[0, 0, 1]")
#plt.grid(True)
#plt.xlabel("theta")
#plt.ylabel("flowRate")
#plt.subplot(213)
line, = plt.plot(theta, flowrate[2], "o")
line.set_label("[1, 1, 1]")
plt.legend()
plt.grid(True)
plt.xlabel("theta")
plt.ylabel("flowRate")
plt.show()