Esempio n. 1
0
from numpy import *
from matplotlib import pyplot
import scripts.skewtools as st
import sys


X,Y,t,Pe = st.importDatasets(sys.argv[1],'X','Y','Time','Peclet')


figscale = 5.
fig,ax = pyplot.subplots(1,1,figsize=(4*figscale,figscale))

uwall = 2./3.
xmax = X.max() + uwall*Pe*t[-1]

for i in range(len(t)):
#for i in [52]:

     ax.cla()
#     ax.hold(True)
     ax.plot([0,xmax],[1,1],linewidth=0.5,color='k')
     ax.plot([0,xmax],[-1,-1],linewidth=0.5,color='k')
     subset1 = ((Y[:,i]<1.)*(Y[:,i] > -1.))
     subset2 = ~subset1


     ax.scatter(X[subset1,i],Y[subset1,i],facecolor=[0,0,0.9],edgecolor=[0,0,0,0],s=1,alpha=0.2)
     ax.scatter(X[subset2,i],Y[subset2,i],facecolor=[0.9,0,0],edgecolor=[0,0,0,0],s=1,alpha=0.2)
#     ax.hist2d(X[subset,i] + uwall*Pe*t[i],Y[subset,i],cmap=pyplot.cm.inferno,)
#     ax.hold(False)
     
Esempio n. 2
0
from numpy import *
from matplotlib import pyplot
import scripts.skewtools as st
import sys

#X,Y,t,avvar,avmean = st.importDatasets(sys.argv[1],'X','Y','Time','Avgd_Variance','Avgd_Mean')
histcx, histcy, hists, t, avvar, avmean = st.importDatasets(
    sys.argv[1], 'hist2dcx', 'hist2dcy', 'hist2d', 'Time', 'Avgd_Variance',
    'Avgd_Mean')

figscale = 5.
fig, ax = pyplot.subplots(1, 1, figsize=(5 * figscale, figscale))

#xmin = X.min()
#xmax = X.max()

mycm = pyplot.cm.viridis

for i in range(len(t)):

    ax.cla()

    #     ax.scatter(X[:,i],Y[:,i],edgecolor=None,s=1.,alpha=0.1)
    Xg, Yg = meshgrid(histcx[:, i], histcy[:, i])
    #     ax.pcolor(Xg,Yg,hists[:,:,i],cmap=mycm)
    if (i < 5):
        mmax = 0.
        for j in range(i - 4, i + 1):
            mmax += 1. / 5. * hists[:, :, j].max()
        #
    else:
Esempio n. 3
0
     for i in range(nmax):
          out += (t*bzs[i]**-8 + 18*bzs[i]**-10 - 240*bzs[i]**-12)*exp(-bzs[i]**2*t)
     # end for
     
     out *= 128*Pe**3
     out += 1./480*Pe**3*(t-17./112)

     return out
# end def

# --------------------------------------------- 
#
# Keep in mind these are for the flow u=2(1-r**2).
#

t,var,sk = st.importDatasets(sys.argv[1],'Time','Avgd_Variance','Avgd_Skewness')

fig,ax = pyplot.subplots(2,1)

tv = t[1:]
skv = sk[1:]

exact = m3(tv)/m2(tv)**1.5

ax[0].plot(tv,exact,label='Exact')
ax[0].scatter(tv,skv,facecolor=[0,0,0,0],edgecolor=[0,0,0,1],s=40,label='Monte Carlo')

ax[1].plot(tv,abs(exact-skv),color='red',label='Absolute error')
ax[1].plot(tv,abs(exact-skv)/abs(exact),color=[0.4,0,0.4],label='Relative error')

ax[0].set_xscale('log')
Esempio n. 4
0
# Visualize side view cloud animation
# via internally calculated hist2d instead of saving
# particle histories and doing the calculation with
# python's hist2d.
#

from numpy import *
from matplotlib import pyplot
import scripts.skewtools as st
import sys

mf = sys.argv[1]

t, hcx, hcy, hh = st.importDatasets(mf, 'Time', 'hist2dcx', 'hist2dcy',
                                    'hist2d')

nhb = shape(hcx)[0]
nby = shape(hcy)[0]

fig, ax = pyplot.subplots(1, 1)

#for i in [61]:
for i in range(len(t)):
    ax.cla()

    Xc, Yc = meshgrid(hcx[:, i], hcy[:, i])
    ax.pcolor(Xc, Yc, hh[:, :, i], cmap=pyplot.cm.inferno)

    ax.set_xlim(Xc.min(), Xc.max())
    ax.set_ylim(Yc.min(), Yc.max())
Esempio n. 5
0
from numpy import *
from matplotlib import pyplot
import scripts.skewtools as st
import sys

Y, Z, t, l, q = st.importDatasets(sys.argv[1], 'Y', 'Z', 'Time', 'aratio', 'q')

i = 0

figscale = 5.
fig, ax = pyplot.subplots(1, 1, figsize=(figscale / l, figscale))

ax.cla()

ax.scatter(Y[:, i], Z[:, i], edgecolor=None)

winscale = 1.5
ax.set_xlim([-winscale / l, winscale / l])
ax.set_ylim([-winscale, winscale])

pyplot.savefig('cloudframe_' + str(i).zfill(4) + '.png', dpi=80)
Esempio n. 6
0
from numpy import *
import scripts.skewtools as st
from matplotlib import pyplot
import sys

aratio,uv,y,z = st.importDatasets(sys.argv[1],'aratio','Flow_values','y_mesh','z_mesh')

print aratio

z = z/aratio

fig,ax = pyplot.subplots(1,1, figsize=(6/aratio,6))

yv,zv = meshgrid(y,z)

mycm = pyplot.cm.viridis

uell = 1.-yv**2-aratio**2*zv**2

ax.contourf(zv,yv,uv,cmap=mycm,levels=linspace(uv.min(),uv.max(),9))
ax.contour(zv,yv,uell,colors='white',levels=linspace(0,uell.max(),9),lw=1.5)

ax.set_xticks([])
ax.set_yticks([])

ax.set_aspect('equal')

pyplot.tight_layout()

pyplot.show(block=False)
pyplot.savefig('compare_contours.png',dpi=120,bbox_inches='tight')