-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassivetracer3d.py
76 lines (67 loc) · 2.17 KB
/
passivetracer3d.py
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import h5py
import numpy as np
import matplotlib.pyplot as plt
outputDir = "/run/user/1000/gvfs/sftp:host=lisa.surfsara.nl,user=alaik/home/alaik/uw_py3_3D/3dLo/"
# fH = open(outputDir + "/checkpoint.log", "r")
#
# with open(outputDir + "/checkpoint.log", "r") as infile, open(
# outputDir + "/tRcheckpoint.log", "w+"
# ) as outfile:
# temp = infile.read().replace(";", "")
# outfile.write(temp)
time = np.genfromtxt(outputDir + "/tcheckpoint.log", delimiter=",")
for i in time[:, 0]:
stStr = str(int(i)).zfill(5)
with h5py.File(outputDir + "tswarm-" + stStr + ".h5", "r") as f:
tcord = f["data"][()]
with h5py.File(outputDir + "tcoords-" + stStr + ".h5", "r") as f:
ic = f["data"][()]
crX = tcord[:, 0]
crZ = tcord[:, 2]
inX = ic[:, 0]
inZ = ic[:, 2]
width = 1/8.
hz = np.zeros_like(inX)
matC = np.zeros_like(inX)
matC[:] = 0
hz[:] = -1
gX = np.where(np.abs(np.cos(np.pi*5.001*inX)) > .99)
gZ = np.where(np.abs(np.cos(np.pi*5.001*inZ)) > .99)
mat = np.where((inZ < 2.0) & (inX > 0.05))
slabF = np.where((inZ <= 2.0) & (inX <= 2.0) & (inX >= 0.05))
overF = np.where((inZ <= 2.0) & (inX >= 2.0))
indeF = np.where((inZ <= 1.0) & (inZ >= 0.2)
& (inX <= 0.9) & (inX >= 0.05))
hz[gX] = 1
hz[gZ] = 1
matC[slabF] = 1
matC[overF] = 2
matC[indeF] = 3
hatch = (((np.round(inZ/width) % 2)-(np.round(inX/width) % 2)))
# plt.plot(hatch)
def plot_it():
plt.clf()
plt.xlim((0, 4))
plt.ylim((0, 4))
plt.scatter(crZ[mat], crX[mat], c=matC[mat], s=5, marker='o',cmap="Spectral")
plt.scatter(crZ[gX], crX[gX], c='black', s=7, marker='.')
plt.scatter(crZ[gZ], crX[gZ], c='black', s=7, marker='.')
plt.gcf().set_size_inches(12, 12)
plt.savefig('gd/pF'+stStr+".png", dpi=120)
plot_it()
#
# #
# # %matplotlib
# plt.plot(10*np.sin(np.pi*2*inX))
#
# def plot_it():
# plt.scatter(crX, crZ, c=hatch, s=5,marker="o")
# plt.gcf().set_size_inches(10, 10)
# plt.xlim((0, 12))
# plt.ylim((0, 12))
# plt.axis('equal')
# plt.tight_layout()
# plt.savefig('p'+stStr+".png", dpi=300)
#
#
# plot_it()