-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_RTIN_DROP.py
90 lines (71 loc) · 2.61 KB
/
plot_RTIN_DROP.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
77
78
79
80
81
82
83
84
85
86
87
88
89
#plot
from __future__ import division
import matplotlib
import matplotlib.pyplot as plt
import numpy
import sys
def densitycontour(ns, scheme):
outputs_dir = ns.outputs_dir+'PLOT/'
nbseg_x = str(ns.nbseg_x)
nbseg_y = str(ns.nbseg_y)
caso = ns.case
density_ratio = ns.RHO_MAX
re = str(ns.Re)
#mesh = Mesh()
if (caso == 5):
time = [0.75, 2.0, 2.75, 3.0, 3.25, 3.5, 3.75]
#[1.0, 1.5, 2.0, 2.5, 3.0, 3.25, 3.5, 3.75, 4.0]
#[1.0, 25.0, 50.0, 75.0, 100.0, 125.0, 150.0, 175.0, 200.0]#
x1 = -0.5
x2 = 0.5
y1 = -2
y2 = 2
caso = 'RTIN'+str(density_ratio)+'_'
elif(caso == 4):
time = [0.25, 0.5, 1.0, 1.5, 2.0, 2.5]#[0.2, 0.5, 1.125, 1.25] #, 1.3612]
x1 = 0.0
x2 = 1.0
y1 = 0.0
y2 = 2.0
caso = 'DROP_'
else:
print('Error: plot not implemented for benchmark ', caso)
return
#endif
versione = str(int(nbseg_x)*int(nbseg_y)*2)
x,y = numpy.linspace( x1, x2, int(nbseg_x)+1), numpy.linspace( x1, x2, int(nbseg_y)+1)
x,y = numpy.meshgrid(x,y)
density_ratio = int(density_ratio)
if (density_ratio == 3):
levels = [1.40, 1.45, 1.50, 1.55, 1.60]
elif (density_ratio == 7):
levels = [2.0, 2.20, 2.60, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0]
elif (density_ratio == 19):
levels = [8.0, 8.5, 9.0, 9.5, 10.0, 10.5, 11.0, 11.5, 12.0]
else:
levels = [(density_ratio/2-0.1*density_ratio), (density_ratio/2-0.05*density_ratio), (density_ratio/2), (density_ratio/2+0.05*density_ratio), (density_ratio/2+0.1*density_ratio)]
cartella = outputs_dir
f, axarr = plt.subplots(1, len(time), sharey = True, sharex = True)
if (ns.iterLU == 1) and (scheme == 'proj2'):
metodo = '_italu'+str(ns.iters)
else:
if (ns.iterLU == 0) and (scheme == 'proj2'):
metodo = '_prec'+str(ns.prec)
else:
metodo = ''
#endif
#endif
plt.rcParams.update({'font.size': 8})
for i,t in enumerate(time):
rho = numpy.load(cartella+caso+'rho'+str(t)+'_'+versione+'_Re'+re+metodo+'_'+scheme+'.npy')
rho = rho.reshape(int(nbseg_y)+1, int(nbseg_x)+1)
axarr[i].contourf(x,y, rho, levels)
axarr[i].set_title('T = '+str(t))
#plt.setp(axarr[i].tick_params(labelsize = 8))
#endfor
plt.setp(axarr, xticks = [x1, x2])
f.tight_layout(w_pad = 0.2)
file = ns.outputs_dir+caso+'Re'+re+'_'+nbseg_x+'x'+nbseg_y+metodo+'_'+scheme+'.png'
print('saving '+file)
plt.savefig(file, format='png')
return