aspect = reader.read_aspect_ratio(ssh_flag=True) X, Y = reader.set_XY_axis() K0, L0 = reader.set_axis() K, L = np.meshgrid(K0, L0) c_level = 64 var_dict = {'E': 'Energy spectrum', 'P': 'Stream function', 'Q': 'Vorticity'} var = 'P' # print(X, Y) ip = 1 str_ip = '{0:04d}'.format(ip) Q0 = reader.read_real(0, ip, 'Q') mu = np.pi**2 * (K[:, :]**2 / aspect[0] + L[:, :]**2 * aspect[0]) P = np.zeros((reader.NK, reader.NL)) P[:reader.NK_truncate - 1, :reader.NK_truncate - 1] = Q0[:, :] / mu[:, :] P_real = fftpack.dstn(P, type=1, norm='ortho') max_P = P_real.max() min_P = P_real.min() for time in range(0, 11): it = time * reader.interval_write_variable str_it = '{0:04d}'.format(it) Q0 = reader.read_real(it, ip, 'Q') mu = np.pi**2 * (K[:, :]**2 / aspect[it] + L[:, :]**2 * aspect[it]) P = np.zeros((reader.NK, reader.NL)) P[:reader.NK_truncate - 1, :reader.NK_truncate - 1] = Q0[:, :] / mu[:, :]
setting_name = "setting" beta = -19.56 reader = ReadClass() remote_data = reader.data_PID(setting_name) reader.set_ssh(remote_data=remote_data) reader.read_setting(setting_name) reader.read_file_number(ssh_flag=True) aspect = reader.read_aspect_ratio(ssh_flag=True) N = (reader.NL_truncate-1) * (reader.NK_truncate-1) energy = np.zeros(aspect.size) Q2 = np.zeros([reader.NL_truncate, reader.NK_truncate, reader.N_process]) for j in range(reader.N_process): Q2[:, :, j] = reader.read_real(it=0, ip=j, var_name="Q")**2 print('j =', j) # t = 0 mu = reader.set_mu(aspect=aspect[0]) E0 = np.zeros([reader.NL_truncate-1, reader.NK_truncate-1, reader.N_process]) for j in range(reader.N_process): E0[:, :, j] = Q2[:-1, :-1, j] / mu[:, :] E = np.zeros([reader.NL_truncate-1, reader.NK_truncate-1]) work = np.zeros(reader.N_process) free_energy = np.zeros(aspect.size) exp_E = np.zeros(aspect.size) for i in range(aspect.size): free_energy[i] = reader.set_free_energy(aspect=aspect[i], beta=beta) mu = reader.set_mu(aspect=aspect[i])
reader.read_file_number(ssh_flag=True) K_axis, L_axis = reader.set_axis() c_level = 64 var_dict = { 'E': 'Energy spectrum', 'P': 'Enstrophy spectrum', 'Q': 'Vorticity' } var = 'Q' for time in range(0, 100): it = time * reader.interval_write_variable str_it = '{0:04d}'.format(it) spec = reader.read_real(it, 0, var) if var == 'Q': spec = spec**2 / 2 energy_all = np.sum(spec) spec[spec <= 0.0] = np.nan spec_log10 = np.log10(spec / energy_all) max_spec = np.nanmax(spec_log10) min_spec = np.nanmin(spec_log10) # print(it, max_spec, min_spec, energy_all) # print(spec_XY_Z_log10) # spec_range = np.linspace(min_spec, max_spec, c_level) spec_range = np.linspace(-9.0, 0.0, c_level) fig = plt.figure(figsize=[4, 3])