mld_10 = np.zeros(len(range(dayi,dayf,days)))

for t in range(len(time)):
 print 'time:', time[t]
 tlabel = str(time[t])
 while len(tlabel) < 3: tlabel = '0'+tlabel
 #Velocity_CG_m_50_6e_9.csv
 file0_50 = path+'Velocity_CG_0_'+label_50+'_'+str(time[t])+'.csv'
 file0_25 = path+'Velocity_CG_0_'+label_25+'_'+str(time[t])+'.csv'
 file0_10 = path+'Velocity_CG_0_'+label_10+'_'+str(time[t])+'.csv'
 file1 = 'drate_'+label+'_'+str(time[t])
 file1_50 = 'drate_'+label_50
 file1_25 = 'drate_'+label_25
 file1_10 = 'drate_'+label_10

 W_50 = lagrangian_stats.read_Scalar(file0_50,zn,yn_50,xn_50)
 W_25 = lagrangian_stats.read_Scalar(file0_25,zn,yn_25,xn_25)
 W_10 = lagrangian_stats.read_Scalar(file0_10,zn,yn_10,xn_10)

 for i in range(len(Xlist_50)):
  for j in range(len(Ylist_50)):
   FW_50[j,i,:,t] = (np.gradient(W_50[:,j,i])/dz_50)**2
 for i in range(len(Xlist_25)):
  for j in range(len(Ylist_25)):
   FW_25[j,i,:,t] = (np.gradient(W_25[:,j,i])/dz_25)**2
 for i in range(len(Xlist_10)):
  for j in range(len(Ylist_10)):
   FW_10[j,i,:,t] = (np.gradient(W_10[:,j,i])/dz_10)**2

 plt.figure(figsize=(4,8))
v = np.zeros((len(Zlist),2))

#for time in range(dayi,dayf,days):
for file in files:
 time = int(file)
 tlabel = str(time)
 while len(tlabel) < 3: tlabel = '0'+tlabel
 #
 file0 = basename + '_' + str(time) + '.pvtu'
 filepath = path+file0
 file1 = label+'_' + tlabel
 fileout  = path + file1
 #
 print 'opening: ', filepath
 #
 Rho = lagrangian_stats.read_Scalar('/nethome/jmensa/scripts_fluidity/2D/RST/Density_CG/Density_CG_'+label+'_'+str(time),zn,xn,yn,[time])
 #
 #
 for d in range(9,len(Zlist),100):
  if file == files[0]:
   v[d,:] = np.nanmin(Rho[d,:,:,0]), np.nanmax(Rho[d,:,:,0])
  fig = plt.figure(figsize=(7, 6))
  plt.contourf(Xlist/1000.0,Ylist/1000.0,Rho[d,:,:,0],np.linspace(v[d,0],v[d,1],50,endpoint=True),extend='both',cmap=plt.cm.PiYG)
  plt.colorbar(ticks=np.linspace(v[d,0],v[d,1],5,endpoint=True))
  plt.axis('equal')
  plt.xlabel('X (Km)',fontsize=16)
  plt.ylabel('Y (Km)',fontsize=16)
  plt.title('day '+str(time/4.0),fontsize=16)
  plt.savefig('./plot/'+label+'/R_'+file1+'_'+str(Zlist[d])+'_h_snap.eps')
  print       './plot/'+label+'/R_'+file1+'_'+str(Zlist[d])+'_h_snap.eps'
  plt.close()
예제 #3
0
zn = len(Zlist)

dx = np.diff(Xlist) 

for time in range(dayi,dayf,days):
 print 'time:', time
 tlabel = str(time)
 while len(tlabel) < 3: tlabel = '0'+tlabel
 #Velocity_CG_m_6e_9.csv
 file0_B = path+'Velocity_CG_2_'+label_B+'_'+str(time)+'.csv'
 file0_BW = path+'Velocity_CG_2_'+label_BW+'_'+str(time)+'.csv'
 file1 = 'Velocity_CG_2_'+label+'_'+str(time)
 file1 = 'Velocity_CG_2_'+label+'_'+str(time)
 #

 T_B = lagrangian_stats.read_Scalar(file0_B,zn,xn,yn)
 T_BW = lagrangian_stats.read_Scalar(file0_BW,zn,xn,yn)

 FT_B = np.zeros((xn/1,yn))
 FT_BW = np.zeros((xn/1,yn))

 #

 for k in range(1):
  for j in range(0,len(Ylist),100):
   print j
   plt.plot(T_B[k,j,:]-np.mean(T_B[k,j,:]))
   plt.savefig('./plot/'+label+'/'+file1+'_'+str(Zlist[k])+'_'+str(j)+'_sec.eps',bbox_inches='tight')
   plt.close()
   print       './plot/'+label+'/'+file1+'_'+str(Zlist[k])+'_'+str(j)+'_sec.eps' 
예제 #4
0
for time in range(dayi,dayf,days):
 tlabel = str(time)
 while len(tlabel) < 3: tlabel = '0'+tlabel

 file0u = path+'Velocity_CG_0_'+label+'_'+str(time)+'.csv'
 file0v = path+'Velocity_CG_1_'+label+'_'+str(time)+'.csv'
 file1 = 'Velocity_CG_'+label+'_'+str(time)
 print file1
 #
# xn_50 = 101
# yn_50 = 101
# xn = 101
# yn = 101

 u = lagrangian_stats.read_Scalar(file0u,zn,xn,yn)
 v = lagrangian_stats.read_Scalar(file0v,zn,xn,yn)

 #
# u = np.squeeze(np.reshape(Vel[:,0],[len(Zlist),len(Xlist),len(Ylist)]))
# v = np.squeeze(np.reshape(Vel[:,1],[len(Zlist),len(Xlist),len(Ylist)]))

 for k in range(len(Zlist)):
 # u = np.mean(u,0)
 # v = np.mean(v,0)
  uk = u[k,:,:]
  vk = v[k,:,:]
  #
  dt = 3600  # s

  dx = np.mean(np.mean(uk,0),0)*dt
xn = len(Xlist)
yn = len(Ylist)
zn = len(Zlist)

dx = np.diff(Xlist) 

z = 1

for time in range(dayi,dayf,days):
 print 'time:', time
 tlabel = str(time)
 while len(tlabel) < 3: tlabel = '0'+tlabel
 #Velocity_CG_m_50_6e_9.csv
 file0 = path+'Tracer_'+str(z)+'_CG_'+label+'_'+str(time)+'.csv'
 #
 T = lagrangian_stats.read_Scalar(file0,zn,xn,yn)
 T = np.sum(T,0)/3.
 FT = np.zeros((xn/1,yn))
 #
 for j in range(len(Ylist)):
  tempfft = scipy.fftpack.fft(T[:,j]**2,xn) 
  FT[:,j] = abs(tempfft)**2
 w = scipy.fftpack.fftfreq(xn, dx[1])
#  w = scipy.fftpack.fftshift(w)
 FTp = np.mean(FT,1)/xn

 # ideal t=0
 Theory = T*0 + 3

 for j in range(len(Ylist)):
  tempfft = scipy.fftpack.fft(Theory[:,j]**2,xn)
예제 #6
0
Ylist = np.linspace(0,2000,yn)# y co-ordinates of the desired array shape
[X,Y] = np.meshgrid(Xlist,Ylist)
dl = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1]
Zlist = np.cumsum(dl)

time = range(dayi,dayf,days)

t = 0

for tt in time:
 tlabel = str(tt)
 while len(tlabel) < 3: tlabel = '0'+tlabel
 #
 file1 = basename+'_'+label+'_' + tlabel + '.csv'
 print file1

 f = open(file1,'wr')
 writer = csv.writer(f)

 #
 Temp = lagrangian_stats.read_Scalar('./RST/'+basename+'/'+basename+'_'+label+'_'+str(tt)+'.csv',zn,xn,yn)
 #
 for k in range(len(Zlist)):
  # determine speed direction
  #
  for i in range(len(Xlist)):
   for j in range(len(Ylist)):
    writer.writerow([Xlist[i],Ylist[j],Zlist[k],Temp[k,i,j]])

 f.close()
예제 #7
0
Zlist = -1*np.cumsum(depths)

Xlist = np.linspace(-150000,150000,301)
Ylist = np.linspace(-150000,150000,301)

[X,Y] = np.meshgrid(Xlist,Ylist)

time = range(dayi,dayf,days)

t = 0

for tt in time:
 tlabel = str(tt)
 while len(tlabel) < 3: tlabel = '0'+tlabel
 #
 file1 = label+'_' + tlabel
 #
 Rho = lagrangian_stats.read_Scalar('./Density_CG/Density_CG_'+label+'_'+str(tt),zn,xn,yn,[tt])
 #
 for z in range(5,zn,25):
  # determine speed direction
   #
  plt.figure()
  plt.contourf(Xlist,Ylist,Rho[z,:,:,0],50,extend='both',cmap=plt.cm.PiYG)
  plt.colorbar()
  plt.ylabel('Y [Km]',fontsize=18)
  plt.xlabel('X [Km]',fontsize=18)
  plt.savefig('./plot/'+label+'/T_'+str(z)+'_'+file1+'.eps')
  plt.close()
  print       './plot/'+label+'/T_'+str(z)+'_'+file1+'.eps'