def load_from_nh(set_of_dir, nh):

    set_of_dir_nh = set_of_dir.filter(nh=nh, f=0)
    path = set_of_dir_nh.path_larger_t_start()

    sim = solveq2d.create_sim_plot_from_dir(path)

    tmin, tmax, tstatio = baseSW1lw.tminmaxstatio_from_sim(sim, VERBOSE=True)

    (dico_time_means,
     dico_results) = sim.output.spatial_means.compute_time_means(tstatio)
    c2 = sim.param['c2']
    c = np.sqrt(c2)
    EK = dico_time_means['EK']
    Fr = np.sqrt(2 * EK / c2)
    EA = dico_time_means['EA']
    EKr = dico_time_means['EKr']
    EKd = EK - EKr
    E = EK + EA
    epsK = dico_time_means['epsK']
    epsA = dico_time_means['epsA']
    eps = epsK + epsA
    epsK_tot = dico_time_means['epsK_tot']
    epsA_tot = dico_time_means['epsA_tot']

    Enorm = np.sqrt(eps * Lf * c)

    print 'c = {0:8.1f}, Fr = {1:8.3f}, eps = {2:8.2f}'.format(c, Fr, eps)
    return locals()
def spectra_from_namedir(nh):

    set_of_dir_nh = set_of_dir.filter(nh=nh)

    path = set_of_dir_nh.path_larger_t_start()
    sim = solveq2d.create_sim_plot_from_dir(path)
    tmin, tmax, tstatio = baseSW1lw.tminmaxstatio_from_sim(sim, VERBOSE=True)

    dico_results = sim.output.spectra.load1D_mean(tmin=tstatio)
    kh = dico_results['kh']

    spectEK = (dico_results['spectrum1Dkx_EK'] +
               dico_results['spectrum1Dkx_EK']) / 2
    spectEA = (dico_results['spectrum1Dkx_EA'] +
               dico_results['spectrum1Dkx_EA']) / 2
    spectEKr = (dico_results['spectrum1Dkx_EKr'] +
                dico_results['spectrum1Dkx_EKr']) / 2

    spectEKd = spectEK - spectEKr
    spectE = spectEK + spectEA
    dico1, dico2 = sim.output.spatial_means.compute_time_means(tstatio=tstatio)
    epsK = dico1['epsK']
    epsA = dico1['epsA']
    eps = epsK + epsA
    EK = dico1['EK']
    U = np.sqrt(2 * EK)
    c = np.sqrt(sim.param['c2'])
    return locals()
Ejemplo n.º 3
0
def print1sim(set_of_dir, f):
    """Print informations on one simulation."""

    print('\n\n')

    set_of_dir = set_of_dir.filter(f=f)
    path = set_of_dir.path_larger_t_start()

    sim = solveq2d.create_sim_plot_from_dir(path)
    param = sim.param
    nx = param['nx']
    c = np.sqrt(sim.param['c2'])
    nu8 = param['nu_8']
    f = sim.param['f']

    tmin, tmax, tstatio = baseSW1lw.tminmaxstatio_from_sim(sim, VERBOSE=True)

    dico1, dico2 = sim.output.spatial_means.compute_time_means(tstatio=tstatio)
    epsK = dico1['epsK']
    epsA = dico1['epsA']
    eps = epsK + epsA
    Ff = eps**(1. / 3) * kf**(-1. / 3) / c

    n = 8
    kd8 = (eps / nu8**3)**(1. / (3 * n - 2))
    kmax = param['coef_dealiasing'] * np.pi * nx / param['Lx']

    minh, maxu = minhmaxu_from_sim(sim)

    ftable.write('\n')
    ftable.write('{0:4d} & {1:4.0f} & '.format(nx, c))

    ftable.write('{0:7.1e} & '.format(nu8))

    if f > 0:
        Ro = eps**(1. / 3) * kf**(2. / 3) / f
        Bu = (kf * c / f)**2
        print('Ro = {0:.2f};    Bu =  {1:.2f}'.format(Ro, Bu))

        ftable.write('{0:4.1f} & {1:6.2g} & {2:6.2g} & '.format(f, Ro, Bu))
    else:
        ftable.write(' 0   &  $\infty$ & $\infty$ & ')

    ftable.write('{0:4.2f} & '.format(eps))

    ftable.write('{0:.2f} & '.format(kmax / kd8))

    ftable.write('{0:3.0f} & '.format(kd8 / kf))

    ftable.write('{0:6.3f} & '.format(Ff))

    ftable.write('{0:4.2f} & {1:4.2f} '.format(minh, maxu / c))

    ftable.write('\\\\')
str_resol = repr(resol)
str_to_find_path = (dir_base + '/Pure_standing_waves_' + str_resol +
                    '*/SE2D*c=' + repr(c)) + '_*'
print(str_to_find_path)

paths = glob.glob(str_to_find_path)

print(paths)

set_of_dir = solveq2d.SetOfDirResults(paths)
path = set_of_dir.path_larger_t_start()

sim = solveq2d.create_sim_plot_from_dir(path)

tmin, tmax, tstatio = baseSW1lw.tminmaxstatio_from_sim(sim, VERBOSE=True)

dico_spectra, dico_results = sim.output.time_sigK.compute_spectra()

omega = dico_spectra['omega']
time_spectra_q = dico_spectra['time_spectra_q']
time_spectra_a = dico_spectra['time_spectra_a']
time_spectra_d = dico_spectra['time_spectra_d']
omega_shell = dico_results['omega_shell']
kh_shell = dico_results['kh_shell']

deltak = baseSW1lw.deltak

print('deltak/k = ', deltak / kh_shell)

print('k/deltak = ', kh_shell / deltak)