diff --git a/fluidsim/base/output/__init__.py b/fluidsim/base/output/__init__.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvX19pbml0X18ucHk=..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvX19pbml0X18ucHk= 100644 --- a/fluidsim/base/output/__init__.py +++ b/fluidsim/base/output/__init__.py @@ -25,6 +25,9 @@ :members: :private-members: +.. autoclass:: OutputBasePseudoSpectral + :members: + :private-members: """ @@ -28,6 +31,8 @@ """ +import fluiddyn.output + from .base import OutputBase, OutputBasePseudoSpectral import os diff --git a/fluidsim/base/output/base.py b/fluidsim/base/output/base.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvYmFzZS5weQ==..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvYmFzZS5weQ== 100644 --- a/fluidsim/base/output/base.py +++ b/fluidsim/base/output/base.py @@ -296,6 +296,6 @@ if (not self.path_run.startswith(FLUIDSIM_PATH) and mpi.rank == 0): new_path_run = os.path.join(FLUIDSIM_PATH, self.sim.name_run) - print('move result directory in directory:\n'+new_path_run) + print('move result directory in directory:\n' + new_path_run) shutil.move(self.path_run, FLUIDSIM_PATH) self.path_run = new_path_run @@ -300,6 +300,12 @@ shutil.move(self.path_run, FLUIDSIM_PATH) self.path_run = new_path_run - + for spec_output in self.__dict__.values(): + if isinstance(spec_output, SpecificOutput): + try: + spec_output.init_path_files() + except AttributeError: + pass + def compute_energy(self): return 0. @@ -377,7 +383,8 @@ self.init_files(dico_arrays_1time) def init_path_files(self): - pass + if hasattr(self, '_name_file'): + self.path_file = os.path.join(self.output.path_run, self._name_file) def init_files(self, dico_arrays_1time=None): if dico_arrays_1time is None: diff --git a/fluidsim/base/output/increments.py b/fluidsim/base/output/increments.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvaW5jcmVtZW50cy5weQ==..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvaW5jcmVtZW50cy5weQ== 100644 --- a/fluidsim/base/output/increments.py +++ b/fluidsim/base/output/increments.py @@ -17,6 +17,7 @@ """ _tag = 'increments' + _name_file = _tag + '.h5' @staticmethod def _complete_params_with_default(params): @@ -44,8 +45,8 @@ self.nbins = 400 - name_file = 'increments.h5' - self.path_file = output.path_run+'/'+name_file + self.output = output + self.init_path_files() if os.path.exists(self.path_file): if mpi.rank == 0: @@ -65,7 +66,6 @@ super(Increments, self).__init__( output, - name_file=name_file, period_save=params.output.periods_save.increments, has_to_plot_saved=params.output.increments.HAS_TO_PLOT_SAVED, dico_arrays_1time=dico_arrays_1time) @@ -867,43 +867,3 @@ ax2.set_ylim([2, 5]) - - - - - -if __name__=="__main__": - - from solveq2d import solveq2d - - import glob - - c = 20 - resol = 240*2**2 # 4 - - str_resol = repr(resol) - str_to_find_path = ( - '/scratch/augier/Results_SW1Lw' - '/Pure_standing_waves_'+ - str_resol+'*/SE2D*c='+repr(c))+'_*' - print(str_to_find_path) - - paths_dir = glob.glob(str_to_find_path) - - sim = solveq2d.create_sim_plot_from_dir(paths_dir[0]) - - tmin = sim.output.spatial_means.first_saved_time() - tstatio = tmin + 4. - - - # sim.output.increments.plot(tmin=tmin, tmax=None, delta_t=0., - # order=4, yscale='log') - - - # sim.output.increments.plot_pdf(tmin=tmin, tmax=160.25, key_var='ux', - # order=4) - - sim.output.increments.plot_Kolmo(tmin=tmin) - - - solveq2d.show() diff --git a/fluidsim/base/output/spatial_means.py b/fluidsim/base/output/spatial_means.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvc3BhdGlhbF9tZWFucy5weQ==..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvc3BhdGlhbF9tZWFucy5weQ== 100644 --- a/fluidsim/base/output/spatial_means.py +++ b/fluidsim/base/output/spatial_means.py @@ -24,6 +24,7 @@ """ _tag = 'spatial_means' + _name_file = _tag + '.txt' @staticmethod def _complete_params_with_default(params): @@ -48,9 +49,6 @@ if self.period_save != 0: self.save_one_time() - def init_path_files(self): - self.path_file = self.output.path_run + '/spatial_means.txt' - def init_files(self, dico_arrays_1time=None): if mpi.rank == 0: diff --git a/fluidsim/base/output/spect_energy_budget.py b/fluidsim/base/output/spect_energy_budget.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvc3BlY3RfZW5lcmd5X2J1ZGdldC5weQ==..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvc3BlY3RfZW5lcmd5X2J1ZGdldC5weQ== 100644 --- a/fluidsim/base/output/spect_energy_budget.py +++ b/fluidsim/base/output/spect_energy_budget.py @@ -24,6 +24,7 @@ """ _tag = 'spect_energy_budg' + _name_file = _tag + '.h5' @staticmethod def _complete_params_with_default(params): @@ -43,7 +44,6 @@ HAS_TO_PLOT_SAVED = params.output.spect_energy_budg.HAS_TO_PLOT_SAVED super(SpectralEnergyBudgetBase, self).__init__( output, - name_file='spectral_energy_budget.h5', period_save=params.output.periods_save.spect_energy_budg, has_to_plot_saved=HAS_TO_PLOT_SAVED, dico_arrays_1time={'khE': output.sim.oper.khE}) diff --git a/fluidsim/base/output/time_signalsK.py b/fluidsim/base/output/time_signalsK.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvdGltZV9zaWduYWxzSy5weQ==..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vYmFzZS9vdXRwdXQvdGltZV9zaWduYWxzSy5weQ== 100644 --- a/fluidsim/base/output/time_signalsK.py +++ b/fluidsim/base/output/time_signalsK.py @@ -20,6 +20,7 @@ """ _tag = 'time_signals_fft' + _name_file = 'time_sigK.h5' @staticmethod def _complete_params_with_default(params): @@ -29,8 +30,8 @@ params.output.periods_plot._set_attrib(tag, 0) params.output._set_child(tag, - attribs={'nb_shells_time_sigK': 4, - 'nb_k_per_shell_time_sigK': 4}) + attribs={'nb_shells_time_sigK': 4, + 'nb_k_per_shell_time_sigK': 4}) def __init__(self, output): self.output = output @@ -160,9 +161,6 @@ if mpi.nb_proc > 1: self.period_save = mpi.comm.bcast(self.period_save) - def init_path_files(self): - self.path_file = self.output.path_run + '/time_sigK.h5' - def init_files(self, dico_arrays_1time=None): if (not os.path.exists(self.path_file)): dico_results = self.compute() @@ -463,12 +461,5 @@ pass -if __name__ == '__main__': - path_dir = '/scratch/augier/Results_for_article_SW1L/Waves_standing_256x256/SE2D_SW1Lexlin_forcing_L=50.x50._256x256_c2=900_f=0_2013-06-04_12-49-26' - - from solveq2d import solveq2d - - sim = solveq2d.create_sim_plot_from_dir(path_dir) - - sim.output.time_sigK.plot_spectra() - solveq2d.show() +# if __name__ == '__main__': +# pass diff --git a/fluidsim/solvers/ns2d/solver.py b/fluidsim/solvers/ns2d/solver.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vc29sdmVycy9uczJkL3NvbHZlci5weQ==..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vc29sdmVycy9uczJkL3NvbHZlci5weQ== 100644 --- a/fluidsim/solvers/ns2d/solver.py +++ b/fluidsim/solvers/ns2d/solver.py @@ -165,7 +165,7 @@ from math import pi - import fluiddyn as fld + # import fluiddyn as fld params = Simul.create_default_params() @@ -214,4 +214,4 @@ sim.time_stepping.start() # sim.output.phys_fields.plot() - fld.show() + # fld.show() diff --git a/fluidsim/solvers/plate2d/output/correlations_freq.py b/fluidsim/solvers/plate2d/output/correlations_freq.py index 2b4c5eb287bc7206735a419e1c48b3d60f8c2d72_Zmx1aWRzaW0vc29sdmVycy9wbGF0ZTJkL291dHB1dC9jb3JyZWxhdGlvbnNfZnJlcS5weQ==..455b70b5a581ffc87f5250e1f6948d81c535b7ea_Zmx1aWRzaW0vc29sdmVycy9wbGF0ZTJkL291dHB1dC9jb3JyZWxhdGlvbnNfZnJlcS5weQ== 100644 --- a/fluidsim/solvers/plate2d/output/correlations_freq.py +++ b/fluidsim/solvers/plate2d/output/correlations_freq.py @@ -32,6 +32,7 @@ """ _tag = 'correl_freq' + _name_file = _tag + '.h5' @staticmethod def _complete_params_with_default(params): @@ -116,10 +117,6 @@ if self.omega_dealiasing > self.omega_Nyquist: print('Warning: omega_dealiasing > omega_Nyquist') - def init_path_files(self): - path_run = self.output.path_run - self.path_file = path_run + '/correl4_freq.h5' - def init_files(self, dico_arrays_1time=None): # we can not do anything when this function is called. pass @@ -176,7 +173,7 @@ if not os.path.exists(self.path_file): self.init_files2(correlations) else: - # save the spectra in the file correlation_freq.h5 + # save the spectra in the file correl_freq.h5 self.add_dico_arrays_to_file(self.path_file, correlations) if self.has_to_plot: