Exemplo n.º 1
0
# Set to False to view plots interactively on-screen.
saveplot = False
savefile = 'az_average.png'

# Once the data has been time-averaged, the result may be read in
#  without re-averaging by setting timeavg to False
timeavg = True

########################################################################
# Read in the data

# If time-averaging needs to be performed, we read in
# the indicated files from AZ_Avgs and a time-averaget to avg_file
avg_file = 'time_averaged_azavg'
if (timeavg):
    files = build_file_list(3000000, 3300000, path='AZ_Avgs')
    TimeAvg_AZAverages(files, avg_file)

az = AzAverage(filename=avg_file, path='')

# time index to grab (this file only has one time since it is an average)
ind = 0

#Find the indices associated with the quantities we want to plot
vphi_index = az.lut[3]
entropy_index = az.lut[64]
rhovr_index = az.lut[61]
rhovt_index = az.lut[62]

#Grab quantities of interest from az.vals
Exemplo n.º 2
0
#    self.vals[0:niter-1,0:nq-1] : Globally averaged diagnostics as function of time and quantity index
#    self.iters[0:niter-1]       : The time step numbers stored in this output file
#    self.time[0:niter-1]        : The simulation time corresponding to each time step
#    self.lut                    : Lookup table for the different diagnostics output

from diagnostic_reading import GlobalAverage, build_file_list
import matplotlib.pyplot as plt
import numpy

# Set saveplot to True to save to a .png file.
# Set to False to view plots interactively on-screen.
saveplot = False
savefile = 'energy_trace.pdf'  #Change .pdf to .png if pdf conversion gives issues

# Build a list of all files ranging from iteration 2.7 million to 4 million
files = build_file_list(2700000, 4000000, path='G_Avgs')
#The indices associated with our various outputs are stored in a lookup table
#as part of the GlobalAverage data structure.  We define several variables to
#hold those indices here:
a = GlobalAverage(filename=files[0],
                  path='')  # read a file to get the lookup table
ke_index = a.lut[125]  # Kinetic Energy (KE)
rke_index = a.lut[126]  # KE associated with radial motion
tke_index = a.lut[127]  # KE associated with theta motion
pke_index = a.lut[128]  # KE associated with azimuthal motion

#We also grab some energies associated with the mean (m=0) motions
mrke_index = a.lut[130]  # KE associated with mean radial motion
mtke_index = a.lut[131]  # KE associated with mean theta motion
mpke_index = a.lut[132]  # KE associated with mean azimuthal motion
Exemplo n.º 3
0
#    self.version                       : The version code for this particular output (internal use)
#    self.lut                           : Lookup table for the different diagnostics output
#   -------------------------------------

from diagnostic_reading import ShellAverage, build_file_list
import matplotlib.pyplot as plt
import numpy
# Set saveplot to True to save to a file.
# Set to False to view plots interactively on-screen.
saveplot = False
savefile = 'energy_flux.pdf'  #If pdf gives issues, try .png instead.

#Time-average the data generated between timesteps 3 million and 3.5 million
# Note that this averaging scheme assumes taht the radial grid didn't
# change during the course of the run.
files = build_file_list(3000000, 3300000, path='Shell_Avgs')
icount = 0.0
for i, f in enumerate(files):
    a = ShellAverage(f, path='')
    if (i == 0):
        data = numpy.zeros((a.nr, 4, a.nq), dtype='float64')
    for j in range(a.niter):
        data[:, :, :] = data[:, :, :] + a.vals[:, :, :, j]
        icount = icount + 1.0

data = data / icount  # The average is now stored in data
radius = a.radius
fpr = 4.0 * numpy.pi * radius * radius  # four pi r^2
rnorm = radius / radius[0]  # normalize radius so that upper boundary is r=1

#Next, we identify and grab the various fluxes we would like to plot