-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemperature_plot_script
76 lines (74 loc) · 3.33 KB
/
Temperature_plot_script
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
#!/usr/bin/python
#
# To-do list: add label to colorbar, increase font size of axes numbers, make resulting figure fit on a page with text in the pdf document
#
import matplotlib.pyplot as plt
import numpy as np
#
dpiRatio = 300.0/80.0
DishRadius = 0.03
WaterHeight = 0.0035368
GapDistance = 0.0064632
NeedleRadius = .00062
arrowShrinkSize = 0.1
figureFontSize = 12
arrowWidth = 1
#
TempData = np.loadtxt('Temperature_gridded.txt')
i = 0
a,b = TempData.shape
ainitial = a
while i < a:
if np.isnan(TempData[i,2]):
TempData = np.delete(TempData, (i), axis = 0)
a,b = TempData.shape
else:
i = i + 1
#
afinal = a
#
Nx1, idx1 = np.unique(TempData[:,0], return_inverse=True)
Nx2, idx2 = np.unique(TempData[:,1], return_inverse=True)
#
Temp = np.empty((Nx1.shape[0],Nx2.shape[0]))
Temp[idx1,idx2] = TempData[:,2]
#
r, z = np.meshgrid(Nx1, Nx2)
#
Temp_min, Temp_max = np.min(Temp), np.max(Temp)
#
#fig = plt.figure(figsize=(6.5,5.0), dpi = 80)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_aspect((z.max()-z.min())/(r.max()-r.min()))
#
cax = plt.pcolor(r, z, Temp.transpose(), cmap = 'jet', vmin= 290.64223, vmax = Temp_max, rasterized = True)
plt.axis([r.min(),r.max()+0.001,z.min(),z.max()])
#cbar = plt.colorbar(ticks = [291, 292, 293, 294, 295, 296, 297, 298, 299, 300])
cbar = plt.colorbar()
cbar.set_label('Temperature (K)')
#cbar.ax.set_yticklabels(['291 K', '292 K', '293 K', '294 K', '295 K', '296 K', '297 K', '298 K', '299 K', '300 K'])
plt.xlabel('r (m)',fontsize = figureFontSize)
plt.ylabel('z (m)', fontsize = figureFontSize)
#
plt.annotate('Gas-liquid interface', xy=(0.017,0), xytext=(0.010,0.004),arrowprops=dict(facecolor='black',shrink=arrowShrinkSize, width = arrowWidth), fontsize = figureFontSize)
plt.annotate('Dish wall', xy=(DishRadius,0), xytext=(DishRadius-0.01, 0.01),arrowprops=dict(facecolor='black',shrink=arrowShrinkSize, width=arrowWidth), fontsize = figureFontSize)
#plt.annotate('Needle/jet outer wall',xy=(NeedleRadius+2.5e-4,0.02), xytext=(0.01,0.022), arrowprops=dict(facecolor='black',shrink=arrowShrinkSize, width = arrowWidth), fontsize = figureFontSize)
plt.annotate('Needle tip/jet outlet', xy = (NeedleRadius+2e-4,GapDistance), xytext = (0.005,0.015),arrowprops=dict(facecolor='black',shrink=arrowShrinkSize,width=arrowWidth), fontsize = figureFontSize)
plt.annotate('Symmetry axis', xy = (0,0.022), xytext = (35,0), textcoords = 'offset points', ha = 'left', va = 'center', arrowprops=dict(facecolor='black',shrink=arrowShrinkSize,width=arrowWidth), fontsize = figureFontSize)
#
plt.plot([DishRadius, DishRadius],[-WaterHeight,GapDistance], color='k', linestyle = '-', linewidth = 2)
plt.plot([NeedleRadius,NeedleRadius],[GapDistance,DishRadius-WaterHeight], color='k', linestyle = '-', linewidth = 2)
plt.plot([NeedleRadius+1e-4,NeedleRadius+1e-4],[GapDistance,DishRadius-WaterHeight], color='k', linestyle = '-', linewidth = 2)
plt.plot([NeedleRadius+2e-4,NeedleRadius+2e-4],[GapDistance,DishRadius-WaterHeight], color='k', linestyle = '-', linewidth = 2)
plt.plot([0,DishRadius],[0,0], color='k', linestyle = '-', linewidth = 2)
#
ax.text(0.020, 0.023, 'Gas phase', fontsize = figureFontSize)
ax.text(0.020, -0.003, 'Liquid phase', fontsize = figureFontSize)
#
#fig.savefig('test.png',dpi=300)
#fig.savefig('test2.png',dpi=50)
fig.savefig('Temperature2D.eps',format='eps')
#fig.savefig('test2.eps',format='eps',dpi=80)
#
plt.show()