def plot_set1(tsteps, tvec, path):
    reader = mgdr.MovingGridDataReader(path)
    print("Domain Size: {} ".format(reader._domain_size))
    print("Variables available: {}".format(reader._var_names))
    Nx, Ny, Nz = reader._domain_size

    middle_selection = 0.20 #select middle 25% of domain in x
    middle_offset = 0.016
    x1 = int(Nx/2 - middle_selection/2*Nx + middle_offset*Nx)
    x2 = int(Nx/2 + middle_selection/2*Nx + middle_offset*Nx)
    reader.setSubDomain(((x1,0,0),(x2,Ny-1,Nz-1)))

    # Get coordinates based on subdomain
    x,y,z = reader.readCoordinates()
    x_center = np.mean(x[:,0,0])
    nx, ny, nz = reader._subdomain_hi-reader._subdomain_lo+1

    W        = np.zeros(len(tsteps))
    t_legend = []
    
    for tind, step in enumerate(tsteps):

        #Reading in
        reader.setStep(step)
        print("reading in Mass Fraction at step {}.".format(step))
        YHeavy       = np.squeeze(np.array(reader.readData('mass fraction 0')))

        plt.figure()
        plt.title("t = {} ms".format(step*1e-2)) 
        plt.pcolor(1000*x[:,:,int(Nz/2)],1000*y[:,:,int(Nz/2)],YHeavy[:,:,int(Nz/2)])
        plt.xlabel('x [mm]')
        plt.ylabel('y [mm]')
        ax = plt.gca()
        ax.set_aspect('equal')
        plt.colorbar()
        plt.clim([0,1])

    #Format plots
    print("Formatting Plots")
    for ind in plt.get_fignums():
        plt.figure(ind)
        plt.tight_layout()


    return None
def plot_set1(tsteps, tvec, path):
    reader = mgdr.MovingGridDataReader(path)
    print("Domain Size: {} ".format(reader._domain_size))
    print("Variables available: {}".format(reader._var_names))
    Nx, Ny, Nz = reader._domain_size

    middle_selection = 0.12 #select middle 25% of domain in x
    middle_offset = 0.016
    x1 = int(Nx/2 - middle_selection/2*Nx + middle_offset*Nx)
    x2 = int(Nx/2 + middle_selection/2*Nx + middle_offset*Nx)
    reader.setSubDomain(((x1,0,0),(x2,Ny-1,Nz-1)))

    # Get coordinates based on subdomain
    x,y,z = reader.readCoordinates()
    x_center = np.mean(x[:,0,0])
    nx, ny, nz = reader._subdomain_hi-reader._subdomain_lo+1

    W        = np.zeros(len(tsteps))
    t_legend = []
    
    for tind, step in enumerate(tsteps):

        #Reading in
        reader.setStep(step)
        print("reading in Mass Fraction at step {}.".format(step))
        YHeavy       = np.squeeze(np.array(reader.readData('mass fraction 0')))
        print("reading in density at step {}.".format(step))
        density    = np.squeeze(np.array(reader.readData('density')))
        print("reading in pressure at step {}.".format(step))
        pressure   = np.squeeze(np.array(reader.readData('pressure')))
        
        #Calculating Stats
	print("Computing Diffusion Properties")
        rho_bar = np.mean(np.mean(density,axis=2),axis=1)

        Cp = YHeavy*Cp_Heavy + (1-YHeavy)*Cp_air
        Cv = YHeavy*Cv_Heavy + (1-YHeavy)*Cv_air
        gamma = Cp/Cv
	del Cp, Cv
 
        c = (gamma*pressure/density)**0.5

        del gamma

        M = (YHeavy/M_Heavy+(1-YHeavy)/M_air)**(-1)
        T = M*pressure/(density*Ru)

        #Find inner mixing zone (IMZ)
        IMZ_thresh = 0.9
        XHeavy = M/M_Heavy*YHeavy
        XHeavy_bar = np.mean(np.mean(XHeavy,axis=2),axis=1)
        IMZ_crit = 4*XHeavy_bar*(1-XHeavy_bar) - IMZ_thresh

        for ind in range(len(IMZ_crit)):
            if IMZ_crit[ind] >= 0:
                IMZ_lo = ind
                break

        for ind in range(len(IMZ_crit)):
            ind2 = nx-ind-1
            if IMZ_crit[ind2] >= 0:
                IMZ_hi = ind2
                break

        IMZ_mid = np.argmax(IMZ_crit)
        
        del XHeavy

        #Density Spectra
        t_legend.append("t = {} ms".format(step*1e-2))

        k_rad, rho_spec_rad = fh.radial_spectra(x[:,0,0],y[0,:,0],z[0,0,:],density[IMZ_lo:IMZ_hi+1,:,:])

        plt.figure(2)
        plt.loglog(k_rad, rho_spec_rad)
        plt.xlabel('Radial Wavenumber [m-1]')
        plt.ylabel("Density spectra")


        #Energy Spectra
        velocity   = np.squeeze(np.array(reader.readData('velocity')))
        u_tilde = np.mean(np.mean(velocity[0,:,:,:]*density,axis=2),axis=1)/np.mean(np.mean(density,axis=2),axis=1)
        u_doubleprime = velocity[0,:,:,:]-u_tilde.reshape((nx,1,1))
        energy_for_spectra = density*u_doubleprime/(np.reshape(rho_bar,(nx,1,1)))**0.5
        k_rad, rhoU_spec_rad = fh.radial_spectra(x[:,0,0],y[0,:,0],z[0,0,:],energy_for_spectra[IMZ_lo:IMZ_hi+1,:,:])

        plt.figure(3)
        plt.loglog(k_rad, rhoU_spec_rad)
        plt.xlabel('Radial Wavenumber [m-1]')
        plt.ylabel("Energy Spectra") 


    #Format plots
    print("Formatting Plots")
    t_legend.append("-3/2 slope")
    for ind in plt.get_fignums():
        plt.figure(ind)
        plt.loglog(k_rad, 1e2*k_rad**(-1.5),'k--')
        plt.legend(t_legend)
        plt.tight_layout()


    return None
Beispiel #3
0
    A = 1.06036
    B = -0.1561
    C = 0.19300
    D = -0.47635
    E = 1.03587
    F = -1.52996
    G = 1.76474
    H = -3.89411

    #calculate some constants
    eps_ij = (eps_on_k_air * eps_on_k_Heavy)**0.5
    sigma_ij = 0.5 * (sigma_air + sigma_Heavy)
    M_ij = 2.0 / (1 / M_air + 1 / M_Heavy)

    #Read in a file and plot something
    reader = mgdr.MovingGridDataReader(
        "/home/jrwest/Research/FloATPy_moving_grid/data/Wong/grid_B")
    print("Domain Size: {} ".format(reader._domain_size))
    Nx, Ny, Nz = reader._domain_size

    middle_selection = 0.12  #select middle 25% of domain in x
    middle_offset = 0.016
    x1 = int(Nx / 2 - middle_selection / 2 * Nx + middle_offset * Nx)
    x2 = int(Nx / 2 + middle_selection / 2 * Nx + middle_offset * Nx)
    reader.setSubDomain(((x1, 0, 0), (x2, Ny - 1, Nz - 1)))

    #Choose the time steps to use
    #tsteps = (0,10,45,80,115,125,135,145,155,165,180) #all steps
    #tsteps = (125,145,165,180) #for spectra
    #tsteps = (10,45,80,115,125,145,165,180) #use for density reconstruction and anisotropy
    #tsteps = (10,125) #for covariances
    tsteps = (10, 165)
def plot_set1(tsteps, tvec, path, plot_reshock):
    reader = mgdr.MovingGridDataReader(path)
    print("Domain Size: {} ".format(reader._domain_size))
    print("Variables available: {}".format(reader._var_names))
    Nx, Ny, Nz = reader._domain_size

    middle_selection = 0.12  #select middle 25% of domain in x
    middle_offset = 0.016
    x1 = int(Nx / 2 - middle_selection / 2 * Nx + middle_offset * Nx)
    x2 = int(Nx / 2 + middle_selection / 2 * Nx + middle_offset * Nx)
    reader.setSubDomain(((x1, 0, 0), (x2, Ny - 1, Nz - 1)))

    # Get coordinates based on subdomain
    x, y, z = reader.readCoordinates()
    x_center = np.mean(x[:, 0, 0])
    nx, ny, nz = reader._subdomain_hi - reader._subdomain_lo + 1

    Ma_t_IMZ = np.zeros(len(tsteps))
    At_e_IMZ = np.zeros(len(tsteps))
    At_e_centerplane = np.zeros(len(tsteps))
    W = np.zeros(len(tsteps))
    Theta = np.zeros(len(tsteps))
    TKE_int = np.zeros(len(tsteps))
    Diss_int = np.zeros(len(tsteps))
    Enstrophy_int = np.zeros(len(tsteps))
    b11_IMZ = np.zeros(len(tsteps))

    for tind, step in enumerate(tsteps):

        #Reading in
        reader.setStep(step)
        print("reading in Mass Fraction at step {}.".format(step))
        YHeavy = np.squeeze(np.array(reader.readData('mass fraction 0')))
        print("reading in density at step {}.".format(step))
        density = np.squeeze(np.array(reader.readData('density')))
        print("reading in pressure at step {}.".format(step))
        pressure = np.squeeze(np.array(reader.readData('pressure')))

        #Calculating Stats
        print("Computing Diffusion Properties")
        rho_bar = np.mean(np.mean(density, axis=2), axis=1)

        Cp = YHeavy * Cp_Heavy + (1 - YHeavy) * Cp_air
        Cv = YHeavy * Cv_Heavy + (1 - YHeavy) * Cv_air
        gamma = Cp / Cv
        del Cp, Cv

        c = (gamma * pressure / density)**0.5

        del gamma

        M = (YHeavy / M_Heavy + (1 - YHeavy) / M_air)**(-1)
        T = M * pressure / (density * Ru)
        Tij = T / eps_ij
        Omega_D = A * Tij**B + C * np.exp(D * Tij) + E * np.exp(
            F * Tij) + G * np.exp(H * Tij)
        D_binary = (0.0266 / Omega_D) * (T**1.5) / (sigma_ij**2 * pressure *
                                                    M_ij**0.5)

        del Tij, Omega_D, pressure, T

        # Compute Integrated Scalar Dissipation Rate
        print("Computing Dissipation")
        dx = x[1, 0, 0] - x[0, 0, 0]
        dy = y[0, 1, 0] - y[0, 0, 0]
        dz = z[0, 0, 1] - z[0, 0, 0]
        dYdx = first_der.differentiateSixthOrderFiniteDifference(
            YHeavy, dx, 0, None, True, 3, 'C')
        dYdy = first_der.differentiateSixthOrderFiniteDifference(
            YHeavy, dy, 1, None, True, 3, 'C')
        dYdz = first_der.differentiateSixthOrderFiniteDifference(
            YHeavy, dz, 2, None, True, 3, 'C')

        Diss = D_binary * (dYdx**2 + dYdy**2 + dYdz**2)
        Diss_int[tind] = integrate.simps(integrate.simps(integrate.simps(
            Diss, z[0, 0, :], axis=2),
                                                         y[0, :, 0],
                                                         axis=1),
                                         x[:, 0, 0],
                                         axis=0)

        del dYdx, dYdy, dYdz, Diss, D_binary

        #Find inner mixing zone (IMZ)
        IMZ_thresh = 0.9
        XHeavy = M / M_Heavy * YHeavy
        XHeavy_bar = np.mean(np.mean(XHeavy, axis=2), axis=1)
        IMZ_crit = 4 * XHeavy_bar * (1 - XHeavy_bar) - IMZ_thresh

        del M

        for ind in range(len(IMZ_crit)):
            if IMZ_crit[ind] >= 0:
                IMZ_lo = ind
                break

        for ind in range(len(IMZ_crit)):
            ind2 = nx - ind - 1
            if IMZ_crit[ind2] >= 0:
                IMZ_hi = ind2
                break

        IMZ_mid = np.argmax(IMZ_crit)

        # Compute Mixing Width
        print("Computing Mixing Width and Mixedness")
        integrand = 4 * XHeavy_bar * (1 - XHeavy_bar)
        W[tind] = integrate.simps(integrand, x[:, 0, 0])

        # Compute Mixedness
        integrand = XHeavy * (1 - XHeavy)
        integrand = np.mean(np.mean(integrand, axis=2), axis=1)
        numer = integrate.simps(integrand, x[:, 0, 0])

        denom = W[tind] / 4.0
        Theta[tind] = numer / denom

        xstar = (x[:, 0, 0] - x[IMZ_mid, 0, 0]) / W[tind]

        del XHeavy

        #Compute Turbulent Mach Number
        print("reading in velocity at step {}.".format(step))
        print("Computing Turbulent Mach Number")
        velocity = np.squeeze(np.array(reader.readData('velocity')))
        u_tilde = np.mean(np.mean(velocity[0, :, :, :] * density, axis=2),
                          axis=1) / np.mean(np.mean(density, axis=2), axis=1)
        v_tilde = np.mean(np.mean(velocity[1, :, :, :] * density, axis=2),
                          axis=1) / np.mean(np.mean(density, axis=2), axis=1)
        w_tilde = np.mean(np.mean(velocity[2, :, :, :] * density, axis=2),
                          axis=1) / np.mean(np.mean(density, axis=2), axis=1)

        u_doubleprime = velocity[0, :, :, :] - u_tilde.reshape((nx, 1, 1))
        v_doubleprime = velocity[1, :, :, :] - v_tilde.reshape((nx, 1, 1))
        w_doubleprime = velocity[2, :, :, :] - w_tilde.reshape((nx, 1, 1))

        del u_tilde, v_tilde, w_tilde

        TKE = 0.5 * density * (u_doubleprime**2 + v_doubleprime**2 +
                               w_doubleprime**2)

        # Compute Integrated TKE
        TKE_int[tind] = integrate.simps(integrate.simps(integrate.simps(
            TKE, z[0, 0, :], axis=2),
                                                        y[0, :, 0],
                                                        axis=1),
                                        x[:, 0, 0],
                                        axis=0)

        #Anisotropy (23 and 24)
        R11 = np.mean(np.mean(density * u_doubleprime**2, axis=2),
                      axis=1) / np.mean(np.mean(density, axis=2), axis=1)
        Rkk = np.mean(np.mean(2 * TKE, axis=2), axis=1) / np.mean(
            np.mean(density, axis=2), axis=1)
        b11 = R11 / Rkk - 1.0 / 3.0
        b11_IMZ[tind] = np.mean(b11[IMZ_lo:IMZ_hi + 1])

        Ma_t = (((np.mean(np.mean(2 * TKE / density, axis=2), axis=1))**0.5) /
                np.mean(np.mean(c, axis=2), axis=1))

        Ma_t_IMZ[tind] = np.mean(Ma_t[IMZ_lo:IMZ_hi + 1])

        del u_doubleprime, v_doubleprime, w_doubleprime, TKE

        #Compute Effective Atwood Number
        rho_prime = density - rho_bar.reshape((nx, 1, 1))

        At_e = (
            (np.mean(np.mean(rho_prime**2, axis=2), axis=1))**0.5) / rho_bar
        At_e_IMZ[tind] = np.mean(At_e[IMZ_lo:IMZ_hi + 1])
        At_e_centerplane[tind] = At_e[IMZ_mid]

        del rho_prime

        # Compute Integrated Enstrophy
        print("Computing Enstrophy")
        Enstrophy = 0
        dwdy = first_der.differentiateSixthOrderFiniteDifference(
            velocity[2, :, :, :], dy, 1, None, True, 3, 'C')
        dvdx = first_der.differentiateSixthOrderFiniteDifference(
            velocity[1, :, :, :], dx, 0, None, True, 3, 'C')
        Enstrophy += density * (dwdy - dvdx)**2
        del dwdy, dvdx

        dudz = first_der.differentiateSixthOrderFiniteDifference(
            velocity[0, :, :, :], dz, 2, None, True, 3, 'C')
        dwdx = first_der.differentiateSixthOrderFiniteDifference(
            velocity[2, :, :, :], dx, 0, None, True, 3, 'C')
        Enstrophy += density * (dudz - dwdx)**2
        del dudz, dwdx

        dvdx = first_der.differentiateSixthOrderFiniteDifference(
            velocity[1, :, :, :], dx, 0, None, True, 3, 'C')
        dudy = first_der.differentiateSixthOrderFiniteDifference(
            velocity[0, :, :, :], dy, 1, None, True, 3, 'C')
        Enstrophy += density * (dvdx - dudy)**2

        del dvdx, dudy, velocity

        Enstrophy_int[tind] = integrate.simps(integrate.simps(integrate.simps(
            Enstrophy, z[0, 0, :], axis=2),
                                                              y[0, :, 0],
                                                              axis=1),
                                              x[:, 0, 0],
                                              axis=0)

        del Enstrophy, density, YHeavy

    print("Plotting")
    #Plots
    xline = np.array([1.15, 1.15])

    plt.figure(1)
    plt.plot(tvec * 1000, W * 1000, '-o')
    plt.ylabel('W [mm]')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = W * 1000
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    plt.figure(2)
    plt.plot(tvec * 1000, Theta, '-o')
    plt.ylabel('Mixedness [-]')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = Theta
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    plt.figure(3)
    plt.semilogy(tvec * 1000, TKE_int, '-o')
    plt.ylabel('Int. TKE [kg m2 s-2]')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = TKE_int
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    plt.figure(4)
    plt.semilogy(tvec * 1000, Diss_int, '-o')
    plt.ylabel('Int. Dissipation Rate [m3 s-1]')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = Diss_int
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    plt.figure(5)
    plt.semilogy(tvec * 1000, Enstrophy_int, '-o')
    plt.ylabel(r'Int. Enstrophy [kg s-2]')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = Enstrophy_int
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    plt.figure(6)
    plt.plot(tvec * 1000, Ma_t_IMZ, '-o')
    plt.ylabel('Turbulent Ma')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = Ma_t_IMZ
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    plt.figure(7)
    plt.plot(tvec * 1000, At_e_IMZ, '-o')
    plt.ylabel('Effective At')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = At_e_IMZ
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    plt.figure(8)
    plt.plot(tvec * 1000, b11_IMZ, '-o')
    plt.ylabel('b11')
    plt.xlabel('time [ms]')
    if plot_reshock:
        var = b11_IMZ
        yline = np.array([np.min(var), np.max(var)])
        plt.plot(xline, yline, 'k--')

    return None
def plot_set1(tsteps, tvec, path):
    reader = mgdr.MovingGridDataReader(path)
    print("Domain Size: {} ".format(reader._domain_size))
    print("Variables available: {}".format(reader._var_names))
    Nx, Ny, Nz = reader._domain_size

    middle_selection = 0.12 #select middle 25% of domain in x
    middle_offset = 0.016
    x1 = int(Nx/2 - middle_selection/2*Nx + middle_offset*Nx)
    x2 = int(Nx/2 + middle_selection/2*Nx + middle_offset*Nx)
    reader.setSubDomain(((x1,0,0),(x2,Ny-1,Nz-1)))

    # Get coordinates based on subdomain
    x,y,z = reader.readCoordinates()
    x_center = np.mean(x[:,0,0])
    nx, ny, nz = reader._subdomain_hi-reader._subdomain_lo+1

    W        = np.zeros(len(tsteps))
    t_legend1 = []
    t_legend2 = []
    
    for tind, step in enumerate(tsteps):

        #Reading in
        reader.setStep(step)
        print("reading in Mass Fraction at step {}.".format(step))
        YHeavy       = np.squeeze(np.array(reader.readData('mass fraction 0')))
        print("reading in density at step {}.".format(step))
        density    = np.squeeze(np.array(reader.readData('density')))
        print("reading in pressure at step {}.".format(step))
        pressure   = np.squeeze(np.array(reader.readData('pressure')))
        
        #Calculating Stats
	print("Computing Diffusion Properties")
        rho_bar = np.mean(np.mean(density,axis=2),axis=1)

        Cp = YHeavy*Cp_Heavy + (1-YHeavy)*Cp_air
        Cv = YHeavy*Cv_Heavy + (1-YHeavy)*Cv_air
        gamma = Cp/Cv
	del Cp, Cv
 
        c = (gamma*pressure/density)**0.5

        del gamma

        M = (YHeavy/M_Heavy+(1-YHeavy)/M_air)**(-1)
        T = M*pressure/(density*Ru)

        #Find inner mixing zone (IMZ)
        IMZ_thresh = 0.9
        XHeavy = M/M_Heavy*YHeavy
        XHeavy_bar = np.mean(np.mean(XHeavy,axis=2),axis=1)
        IMZ_crit = 4*XHeavy_bar*(1-XHeavy_bar) - IMZ_thresh

        for ind in range(len(IMZ_crit)):
            if IMZ_crit[ind] >= 0:
                IMZ_lo = ind
                break

        for ind in range(len(IMZ_crit)):
            ind2 = nx-ind-1
            if IMZ_crit[ind2] >= 0:
                IMZ_hi = ind2
                break

        IMZ_mid = np.argmax(IMZ_crit)
        
        # Compute Mixing Width 
	print("Computing Mixing Width and Mixedness")
        integrand = 4*XHeavy_bar*(1-XHeavy_bar)
        W[tind] = integrate.simps(integrand,x[:,0,0])
        xstar= (x[:,0,0]-x[IMZ_mid,0,0])/W[tind]

        #Mole Fraction Variance
        XHeavy_prime = XHeavy-XHeavy_bar.reshape((nx,1,1))
        XHeavy_variance = np.mean(np.mean(XHeavy_prime**2,axis=2),axis=1)

        if step < 125:
            #before reshock
            plt.figure(1)
            t_legend1.append("t = {} ms".format(step*1e-2))
        else:
            #after reshock
            plt.figure(2)
            t_legend2.append("t = {} ms".format(step*1e-2))

        plt.plot(xstar,XHeavy_variance**0.5)
        plt.xlim([-2,2])
        plt.xlabel('x*')
        plt.ylabel("X'rms (SF6)")
        plt.ylim([0,0.3])

        del XHeavy

        #Compute Turbulent Mach Number
        print("reading in velocity at step {}.".format(step))
	print("Computing Turbulent Mach Number")
        velocity   = np.squeeze(np.array(reader.readData('velocity')))
        u_tilde = np.mean(np.mean(velocity[0,:,:,:]*density,axis=2),axis=1)/np.mean(np.mean(density,axis=2),axis=1)
        v_tilde = np.mean(np.mean(velocity[1,:,:,:]*density,axis=2),axis=1)/np.mean(np.mean(density,axis=2),axis=1)
        w_tilde = np.mean(np.mean(velocity[2,:,:,:]*density,axis=2),axis=1)/np.mean(np.mean(density,axis=2),axis=1)

        u_doubleprime = velocity[0,:,:,:]-u_tilde.reshape((nx,1,1))
        v_doubleprime = velocity[1,:,:,:]-v_tilde.reshape((nx,1,1))
        w_doubleprime = velocity[2,:,:,:]-w_tilde.reshape((nx,1,1))

        del u_tilde, v_tilde, w_tilde

        TKE = 0.5*density*(u_doubleprime**2+v_doubleprime**2+w_doubleprime**2)

        #Anisotropy (23 and 24)
        R11 = np.mean(np.mean(density*u_doubleprime**2,axis=2),axis=1)/np.mean(np.mean(density,axis=2),axis=1)
        Rkk = np.mean(np.mean(2*TKE,axis=2),axis=1)/np.mean(np.mean(density,axis=2),axis=1)
        b11 = R11/Rkk - 1.0/3.0

        Ma_t = (((np.mean(np.mean(2*TKE/density,axis=2),axis=1))**0.5)/
             np.mean(np.mean(c,axis=2),axis=1))

        del u_doubleprime,v_doubleprime,w_doubleprime, TKE

        if step < 125:
            #before reshock
            plt.figure(3)
        else:
            #after reshock
            plt.figure(4)

        plt.plot(xstar,b11)
        plt.xlabel('x*')
        plt.ylabel('b11')
        plt.xlim([-1.5,1.5])
        plt.ylim([-2.0/3.0,2.0/3.0])
    
        #Compute Effective Atwood Number
        rho_prime = density-rho_bar.reshape((nx,1,1))

        At_e = ((np.mean(np.mean(rho_prime**2,axis=2),axis=1))**0.5)/rho_bar

        # Compute Covariances of Density
        M_bar = np.mean(np.mean(M,axis=2),axis=1)
        M_prime = M-M_bar.reshape((nx,1,1))
        cov_rho_M = np.mean(np.mean(rho_prime*M_prime,axis=2),axis=1)/(rho_bar*M_bar)

        p_bar = np.mean(np.mean(pressure,axis=2),axis=1)
        p_prime = pressure-p_bar.reshape((nx,1,1))
        cov_rho_p = np.mean(np.mean(rho_prime*p_prime,axis=2),axis=1)/(rho_bar*p_bar)

        Tinv_bar = np.mean(np.mean(1.0/T,axis=2),axis=1)
        Tinv_prime = 1.0/T-Tinv_bar.reshape((nx,1,1))
        cov_rho_Tinv = np.mean(np.mean(rho_prime*Tinv_prime,axis=2),axis=1)/(rho_bar*Tinv_bar)

        del rho_prime, M, M_prime, T, Tinv_prime, p_prime

        if (step == 80) or (step == 135):
            plt.figure(step)
            plt.plot(xstar,cov_rho_p)
            plt.plot(xstar,cov_rho_M)
            plt.plot(xstar,cov_rho_Tinv)
            plt.xlabel('x*')
            plt.xlim([-2.0,2.0])
            plt.ylim([0,0.25])
            plt.legend(['rho-p','rho-M','rho-1/T'])
            plt.ylabel('Density Covariance')
            plt.title("t = {} ms".format(step*1e-2))

        #Density Reconstruction
        rho_Heavy = np.mean(density[0,:,:])
        rho_air = np.mean(density[-1,:,:])
        rho_recon_bar = (rho_Heavy-rho_air)*XHeavy_bar+rho_air
        
        if step < 125:
            #before reshock
            plt.figure(5)
        else:
            #after reshock
            plt.figure(6)

        plt.plot(xstar,rho_recon_bar/rho_bar)
        plt.xlim([-2.0,2.0])
        plt.xlabel('x*')
        plt.ylabel('rho / incompressible rho')
        
        del density, YHeavy

    #Format plots
    print("Formatting Plots")
    for ind in range(1,7):
        plt.figure(ind)
        if ind%2 == 1:
            plt.legend(t_legend1)
        else:
            plt.legend(t_legend2)

    for ind in plt.get_fignums():
        plt.figure(ind)
        plt.tight_layout()


    return None