def modif_resolution_from_dir(name_dir=None, t_approx=None, coef_modif_resol=2, PLOT=True): """Save a file with a modified resolution.""" path_dir = pathdir_from_namedir(name_dir) solver = _import_solver_from_path(path_dir) sim = load_state_phys_file(name_dir, t_approx) params2 = _deepcopy(sim.params) params2.oper.nx = int(sim.params.oper.nx * coef_modif_resol) params2.oper.ny = int(sim.params.oper.ny * coef_modif_resol) params2.init_fields.type = "from_simul" sim2 = solver.Simul(params2) sim2.init_fields.get_state_from_simul(sim) print(sim2.params.path_run) sim2.output.path_run = str(path_dir) + "/State_phys_{}x{}".format( sim2.params.oper.nx, sim2.params.oper.ny) print("Save file in directory\n" + sim2.output.path_run) sim2.output.phys_fields.save(particular_attr="modif_resolution") print("The new file is saved.") if PLOT: sim.output.phys_fields.plot(numfig=0) sim2.output.phys_fields.plot(numfig=1) fld.show()
def test_simul(self): """Should be able to run a base experiment.""" self.sim.time_stepping.start() load_params_simul(self.sim.output.path_run + "/params_simul.xml", only_mpi_rank0=False) fld.show() if mpi.nb_proc > 1: return modif_resolution_from_dir(self.sim.output.path_run, coef_modif_resol=3.0 / 2, PLOT=True) times_start_end_from_path(self.sim.output.path_run) path_new = os.path.join(self.sim.output.path_run, "State_phys_12x12") os.chdir(path_new) load_params_simul() path = glob("state_*")[0] load_params_simul(path) load_info_solver()
params.output.periods_save.spectra = 0.05 params.output.periods_save.spatial_means = 10 * deltat params.output.periods_save.correl_freq = 1 params.output.ONLINE_PLOT_OK = False params.output.period_refresh_plots = 0.05 params.output.periods_plot.phys_fields = 0.1 params.output.phys_fields.field_to_plot = "w" params.output.spectra.HAS_TO_PLOT_SAVED = True params.output.spatial_means.HAS_TO_PLOT_SAVED = True params.output.correl_freq.HAS_TO_PLOT_SAVED = False nb_times_compute = 200 params.output.correl_freq.nb_times_compute = nb_times_compute params.output.correl_freq.coef_decimate = 1 params.output.correl_freq.iomegas1 = np.linspace( 1, nb_times_compute / 2 - 1, 6 ).astype(int) sim = Simul(params) # sim.output.phys_fields.plot() sim.time_stepping.start() # sim.output.phys_fields.plot() fld.show()
def test_simul(self): """Should be able to run a base experiment.""" self.sim.time_stepping.start() fld.show()