def pltatheight(filename, component, zindex): data = readzeus.z2d(filename) titlestring = component + ' at t = ' + str(data['time']) + ' sec.' labelstring = 'z = ' + str(data['z'][zindex]) plot(data['r'], data[component][:,zindex], label=labelstring) title(titlestring) xlabel("r [cm]") legend()
def pltvthetacontour(filename): clf() data = readzeus.z2d(filename) titlestring = 'Azimuthal velocity [cm/sec] at t = ' + str(data['time']) + ' sec.' contourf(data['r'], data['z'], data['vtheta'].T, 75) colorbar() title(titlestring) xlabel("r [cm]") ylabel("z [cm]")
def pltstreamcontour(filename): clf() data = readzeus.z2d(filename) stream = generatestream(filename) titlestring = 'Stream function at t = ' + str(data['time']) + ' sec.' contour(data['r'], data['z'], stream.T, 50, colors='k') title(titlestring) xlabel("r [cm]") ylabel("z [cm]")
def generatestream(filename): data = readzeus.z2d(filename) # Generates stream function array of correct size stream = data['vr'] dz = data['z'][10]-data['z'][9] for i in range(stream.shape[0]): for j in range(stream.shape[1]): stream[i,j]=-dz*data['r'][i]*data['vr'][i,j] if j != 0: stream[i,j]=stream[i,j]+stream[i,j-1] return stream
def pltheightavgprofile(file, omegain, omegaout): data = readzeus.z2d(file) avgprofile = numpy.mean(data['vtheta'],1) stdprofile = numpy.std(data['vtheta'],1) couette = gencouette(data['r'], omegain, omegaout, protorin, protorout) titlestring = 'Z-averaged V_theta' plot(couette['r'], couette['vtheta'], label='Ideal Couette') errorbar(data['r'], avgprofile, yerr=stdprofile, label='Avg. Profile') title(titlestring) xlabel("r [cm]") ylabel("V_theta [cm/sec]") legend()
def avgr(minfile, maxfile, zindex, component): allfiles = glob.glob('*.h5') files=[] for file in allfiles: if (file >= minfile) and (file <= maxfile): files.append(file) numfiles=len(files) data=readzeus.z2d(files[0]) valuearray = numpy.zeros((numfiles,data[component].shape[0]), dtype=float32) i=0 for file in files: data=readzeus.z2d(file) valuearray[i,]=data[component][:,zindex] print "Now reading " + file i=i+1 valuemean=numpy.mean(valuearray,0) valuestd=numpy.std(valuearray,0) valuereturn = {'r': data['r'], 'z': data['z'][zindex], 'mean': valuemean, 'std': valuestd} return valuereturn