Example #1
0
tau_approx = Lx * np.pi * m**2 / (2. * Lz * eps * N1 * k)
tau_exact = tau_approx + eps * (Lx / Lz) * (2. * (m * np.pi)**2 -
                                            3.) / (12. * N1 * k * np.pi)
tau_off = Lx * (6 + np.pi**2 * m**2 *
                (1. + 3. * eps**2)) / (6. * eps * N1 * k * np.pi * Lz)

energ_normed = vars['tropenergy'][:, 0, 0] / np.max(vars['tropenergy'][:, 0,
                                                                       0])
energ_theory = np.exp(-(dims['t'] - pulse_len) / tau_exact)
energ_approx = np.exp(-(dims['t'] - pulse_len) / tau_approx)
energ_off = np.exp(-(dims['t'] - pulse_len) / tau_off)
energ_normed_2D = vars['te'][:, 0, :].T / np.max(vars['te'][:, 0, :].T)

dp.make_1D_plot(sim_name + '/energytest.pdf',
                dims['t'],
                simulation=energ_normed,
                theory=energ_theory,
                offmode=energ_off)

dp.make_2D_plot(sim_name + '/tetest.pdf', (dims['t'], dims['z'] / 1000.),
                energ_normed_2D,
                title='Total Energy',
                xlabel='time (s)',
                ylabel='height (km)')
u_wnd = vars['uu'][-1, :, :].T
b_init = vars['b3d'][2, :, :].T
dp.make_2D_plot(sim_name + '/b_snap.pdf',
                (dims['x'] / 1000., dims['z'] / 1000.),
                b_init,
                title='buoyancy at the beginning',
                xlabel='x (km)',
Example #2
0
    dims = dp.read_dims(data) 
    data.close() 
    
    energ_normed = vars['tropenergy'][:,0,0]/np.max(vars['tropenergy'][:,0,0])
    taufit.taufit(energ_normed,dims, m, k, eps, Lx, Lz, archive_list) 

    #tau_approx = Lx*np.pi*m**2/(2.*Lz*eps*N1*k*2.)
    #tau_exact = tau_approx + eps * (Lx/Lz) * (2. * (m*np.pi)**2 - 3.)/(12. * N1 * k * np.pi * 2.)
    #tau_off = Lx*(6 + np.pi**2*m**2*(1.+3.*eps**2))/(6.*eps*N1*k*np.p

    energ_normed = vars['tropenergy'][:,0,0]/np.max(vars['tropenergy'][:,0,0])
    energ_theory = np.exp(-(dims['t'] - pulse_len )/tau_exact)
    energ_approx  = np.exp(-(dims['t'] - pulse_len )/tau_approx)
    #energ_off  = np.exp(-(dims['t'] - pulse_len)/tau_off)

    dp.make_1D_plot(sim_name+'/energytest.pdf', dims['t'], simulation = energ_normed, 
        theory = energ_theory, approx = energ_approx)
    dp.make_2D_plot(sim_name+'/binit.pdf', (dims['x']/1000., dims['z']/1000.),vars['b3d'][1,:,:].T , title='b initial', xlabel = 'x (km)', ylabel = 'z (km)')
    plt.clf()   
    plt.plot(dims['t'], np.log(energ_normed))
    plt.plot(dims['t'], -1./tau_exact*dims['t'], label = 'theory')
    plt.legend()
    plt.savefig(sim_name + '/regresstest.pdf') 
    plt.clf() 

taufit.plot_taus(archive_list) 

import pickle 
outfile = open( "eps02_m2.p", "wb" )
pickle.dump(archive_list, outfile) 
    #dp.make_1D_plot(sim_name+'/energytest.pdf', dims['t'], simulation = energ_normed, 
    #    theory = energ_theory, offmode = energ_off)
Example #3
0
data = h5py.File(filepath, "r")
dict_vars = {'te':'total e profile','b3d':'buoyancy', 'tropenergy':'tropo energy'}

vars = dp.read_vars(data, dict_vars)
dims = dp.read_dims(data)
data.close()

#parameters 
pulse_len = 300 
m = 1.5 
k = 10. 
N1 = 0.01 
eps = 1
Lx, Lz = (2000000, 10000)


tau_approx = Lx*np.pi*m**2/(2.*Lz*eps*N1*k)
tau_exact = tau_approx + eps * (Lx/Lz) * (2. * (m*np.pi)**2 - 3.)/(12. * N1 * k * np.pi)

tau_off = Lx*(6 + np.pi**2*m**2*(1.+3.*eps**2))/(6.*eps*N1*k*np.pi*Lz)


energ_normed = vars['tropenergy'][:,0,0]/np.max(vars['tropenergy'][:,0,0]) 
energ_theory = np.exp(-(dims['t'] - pulse_len)/tau_exact)
energ_approx  = np.exp(-(dims['t'] - pulse_len)/tau_approx)
energ_off  = np.exp(-(dims['t'] - pulse_len)/tau_off)
energ_normed_2D = vars['te'][:,0,:].T/np.max(vars['te'][:,0,:].T)  
dp.make_1D_plot('energytest.pdf', dims['t'], simulation = energ_normed, theory = energ_theory, off = energ_off)  
dp.make_2D_plot('tetest.pdf', (dims['t'], dims['z']/1000.), energ_normed_2D, title = 'Total Energy', xlabel = 'time (s)', ylabel = 'height (km)')  

Example #4
0
pulse_len = 300
m = 1.5
k = 10.
N1 = 0.01
eps = 1
Lx, Lz = (2000000, 10000)

tau_approx = Lx * np.pi * m**2 / (2. * Lz * eps * N1 * k)
tau_exact = tau_approx + eps * (Lx / Lz) * (2. * (m * np.pi)**2 -
                                            3.) / (12. * N1 * k * np.pi)

tau_off = Lx * (6 + np.pi**2 * m**2 *
                (1. + 3. * eps**2)) / (6. * eps * N1 * k * np.pi * Lz)

energ_normed = vars['tropenergy'][:, 0, 0] / np.max(vars['tropenergy'][:, 0,
                                                                       0])
energ_theory = np.exp(-(dims['t'] - pulse_len) / tau_exact)
energ_approx = np.exp(-(dims['t'] - pulse_len) / tau_approx)
energ_off = np.exp(-(dims['t'] - pulse_len) / tau_off)
energ_normed_2D = vars['te'][:, 0, :].T / np.max(vars['te'][:, 0, :].T)
dp.make_1D_plot('energytest.pdf',
                dims['t'],
                simulation=energ_normed,
                theory=energ_theory,
                off=energ_off)
dp.make_2D_plot('tetest.pdf', (dims['t'], dims['z'] / 1000.),
                energ_normed_2D,
                title='Total Energy',
                xlabel='time (s)',
                ylabel='height (km)')

# for pulse, base decay timescale based on domain size
if PULSE == True: 
    k = 4. 
tau_approx = Lx*np.pi*m**2/(2.*Lz*eps*N1*k) 
tau_exact = tau_approx + eps * (Lx/Lz) * (2. * (m*np.pi)**2 - 3.)/(12. * N1 * k * np.pi) 
tau_off = Lx*(6 + np.pi**2*m**2*(1.+3.*eps**2))/(6.*eps*N1*k*np.pi*Lz)

energ_normed = vars['tropenergy'][:,0,0]/np.max(vars['tropenergy'][:,0,0])
energ_theory = np.exp(-(dims['t'] - pulse_len)/tau_exact)
energ_approx  = np.exp(-(dims['t'] - pulse_len)/tau_approx)
energ_off  = np.exp(-(dims['t'] - pulse_len)/tau_off)
energ_normed_2D = vars['te'][:,0,:].T/np.max(vars['te'][:,0,:].T)

dp.make_1D_plot(sim_name+'/energytest.pdf', dims['t'], simulation = energ_normed, 
        theory = energ_theory, offmode = energ_off)

dp.make_2D_plot(sim_name+'/tetest.pdf', (dims['t'], dims['z']/1000.), energ_normed_2D, 
        title = 'Total Energy', xlabel = 'time (s)', ylabel = 'height (km)')
u_wnd = vars['uu'][-1,:,:].T
b_init = vars['b3d'][2,:,:].T
dp.make_2D_plot(sim_name + '/b_snap.pdf', (dims['x']/1000., dims['z']/1000.) , b_init, title='buoyancy at the beginning', xlabel = 'x (km)', ylabel = 'z (km)' )


#
#plt.pcolormesh(t,z, te[:,0,:].T)
#plt.colorbar()
#plt.title('total energy' )
#figpath = sim_name + "/tetest.pdf"
#plt.savefig(figpath) 
#plt.clf()