# HG changeset patch # User paugier <pierre.augier@univ-grenoble-alpes.fr> # Date 1600813849 -7200 # Wed Sep 23 00:30:49 2020 +0200 # Node ID 3e754979171e53eb1c643bbef1ce72c341f822d2 # Parent b34a3a116d34988b5ec4e43709c6ab91f8e6aa45 black, version 20.8b1 diff --git a/fluidsim/base/basilisk/operators.py b/fluidsim/base/basilisk/operators.py --- a/fluidsim/base/basilisk/operators.py +++ b/fluidsim/base/basilisk/operators.py @@ -15,14 +15,11 @@ class OperatorsBasilisk2D: - """2D operators. - - """ + """2D operators.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = {"nx": 48, "ny": 48, "Lx": 8, "Ly": 8} params._set_child("oper", attribs=attribs) diff --git a/fluidsim/base/basilisk/time_stepping.py b/fluidsim/base/basilisk/time_stepping.py --- a/fluidsim/base/basilisk/time_stepping.py +++ b/fluidsim/base/basilisk/time_stepping.py @@ -17,14 +17,11 @@ class TimeSteppingBasilisk: - """Time stepping class to handle Basilisk's event loop and FluidSim output. - - """ + """Time stepping class to handle Basilisk's event loop and FluidSim output.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = {"USE_T_END": True, "t_end": 10.0, "it_end": 10, "deltat0": 0.5} params._set_child("time_stepping", attribs=attribs) diff --git a/fluidsim/base/dedalus/operators.py b/fluidsim/base/dedalus/operators.py --- a/fluidsim/base/dedalus/operators.py +++ b/fluidsim/base/dedalus/operators.py @@ -15,14 +15,11 @@ class OperatorsDedalus2D: - """2D operators. - - """ + """2D operators.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = {"nx": 128, "nz": 64, "Lx": 4, "Lz": 1} params._set_child("oper", attribs=attribs) diff --git a/fluidsim/base/dedalus/time_stepping.py b/fluidsim/base/dedalus/time_stepping.py --- a/fluidsim/base/dedalus/time_stepping.py +++ b/fluidsim/base/dedalus/time_stepping.py @@ -15,14 +15,11 @@ class TimeSteppingDedalus(TimeSteppingBase0): - """Time stepping class to handle Dedalus's event loop and FluidSim output. - - """ + """Time stepping class to handle Dedalus's event loop and FluidSim output.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" TimeSteppingBase0._complete_params_with_default(params) def __init__(self, sim): diff --git a/fluidsim/base/forcing/anisotropic.py b/fluidsim/base/forcing/anisotropic.py --- a/fluidsim/base/forcing/anisotropic.py +++ b/fluidsim/base/forcing/anisotropic.py @@ -30,8 +30,7 @@ @classmethod def _complete_params_with_default(cls, params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" super( TimeCorrelatedRandomPseudoSpectral, cls )._complete_params_with_default(params) @@ -47,8 +46,7 @@ raise NotImplementedError def _compute_cond_no_forcing(self): - """Computes condition no forcing of the anisotropic case. - """ + """Computes condition no forcing of the anisotropic case.""" angle = self.angle self.kxmin_forcing = np.sin(angle) * self.kmin_forcing diff --git a/fluidsim/base/forcing/base.py b/fluidsim/base/forcing/base.py --- a/fluidsim/base/forcing/base.py +++ b/fluidsim/base/forcing/base.py @@ -48,8 +48,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" params._set_child( "forcing", attribs={ @@ -189,8 +188,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" ForcingBase._complete_params_with_default(params, info_solver) params.forcing._set_attribs({"nkmax_forcing": 5, "nkmin_forcing": 4}) diff --git a/fluidsim/base/forcing/specific.py b/fluidsim/base/forcing/specific.py --- a/fluidsim/base/forcing/specific.py +++ b/fluidsim/base/forcing/specific.py @@ -468,8 +468,7 @@ @classmethod def _complete_params_with_default(cls, params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" super()._complete_params_with_default(params) try: params.forcing.normalized @@ -790,8 +789,7 @@ @classmethod def _complete_params_with_default(cls, params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" super()._complete_params_with_default(params) try: @@ -835,8 +833,7 @@ @classmethod def _complete_params_with_default(cls, params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" super()._complete_params_with_default(params) try: @@ -882,9 +879,7 @@ return f_fft def forcingc_from_f0f1(self): - """Return a coarse forcing as a linear combination of 2 random arrays - - """ + """Return a coarse forcing as a linear combination of 2 random arrays""" tsim = self.sim.time_stepping.t deltat = self.period_change_f0f1 omega = np.pi / deltat diff --git a/fluidsim/base/init_fields.py b/fluidsim/base/init_fields.py --- a/fluidsim/base/init_fields.py +++ b/fluidsim/base/init_fields.py @@ -66,8 +66,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" params._set_child( "init_fields", attribs={ diff --git a/fluidsim/base/output/base.py b/fluidsim/base/output/base.py --- a/fluidsim/base/output/base.py +++ b/fluidsim/base/output/base.py @@ -153,8 +153,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = { "ONLINE_PLOT_OK": True, "period_refresh_plots": 1, diff --git a/fluidsim/base/output/movies.py b/fluidsim/base/output/movies.py --- a/fluidsim/base/output/movies.py +++ b/fluidsim/base/output/movies.py @@ -43,8 +43,7 @@ def init_animation( self, key_field, numfig, dt_equations, tmin, tmax, fig_kw, **kwargs ): - """Initializes animated fig. and list of times of save files to load. - """ + """Initializes animated fig. and list of times of save files to load.""" self._set_key_field(key_field) self._init_ani_times(tmin, tmax, dt_equations) self.fig, self.ax = plt.subplots(num=numfig, **fig_kw) diff --git a/fluidsim/base/output/phys_fields.py b/fluidsim/base/output/phys_fields.py --- a/fluidsim/base/output/phys_fields.py +++ b/fluidsim/base/output/phys_fields.py @@ -395,9 +395,7 @@ class SetOfPhysFieldFiles: - """A set of physical field files. - - """ + """A set of physical field files.""" def __init__(self, path_dir=os.curdir, output=None): self.output = output diff --git a/fluidsim/base/output/phys_fields2d.py b/fluidsim/base/output/phys_fields2d.py --- a/fluidsim/base/output/phys_fields2d.py +++ b/fluidsim/base/output/phys_fields2d.py @@ -38,8 +38,7 @@ def init_animation( self, key_field, numfig, dt_equations, tmin, tmax, fig_kw, **kwargs ): - """Initialize list of files and times, pcolor plot, quiver and colorbar. - """ + """Initialize list of files and times, pcolor plot, quiver and colorbar.""" self.phys_fields.set_of_phys_files.update_times() self.time_files = self.phys_fields.set_of_phys_files.times diff --git a/fluidsim/base/params.py b/fluidsim/base/params.py --- a/fluidsim/base/params.py +++ b/fluidsim/base/params.py @@ -223,9 +223,7 @@ def load_info_solver(path_dir=None): - """Load the solver information, return an InfoSolverBase instance. - - """ + """Load the solver information, return an InfoSolverBase instance.""" if path_dir is None: path_dir = os.getcwd() diff --git a/fluidsim/base/preprocess/base.py b/fluidsim/base/preprocess/base.py --- a/fluidsim/base/preprocess/base.py +++ b/fluidsim/base/preprocess/base.py @@ -30,8 +30,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = { "enable": False, "init_field_scale": "unity", diff --git a/fluidsim/base/preprocess/pseudo_spect.py b/fluidsim/base/preprocess/pseudo_spect.py --- a/fluidsim/base/preprocess/pseudo_spect.py +++ b/fluidsim/base/preprocess/pseudo_spect.py @@ -161,7 +161,7 @@ self.sim.time_stepping.__init__(self.sim) def set_forcing_rate(self): - r""" Based on C, a non-dimensional ratio of forcing rate to one of the + r"""Based on C, a non-dimensional ratio of forcing rate to one of the following forcing scales - the initial total energy, math:: E_0 diff --git a/fluidsim/base/time_stepping/base.py b/fluidsim/base/time_stepping/base.py --- a/fluidsim/base/time_stepping/base.py +++ b/fluidsim/base/time_stepping/base.py @@ -27,15 +27,11 @@ class TimeSteppingBase0: - """Universal time stepping class used for all solvers. - - - """ + """Universal time stepping class used for all solvers.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = { "USE_T_END": True, "t_end": 10.0, diff --git a/fluidsim/base/time_stepping/finite_diff.py b/fluidsim/base/time_stepping/finite_diff.py --- a/fluidsim/base/time_stepping/finite_diff.py +++ b/fluidsim/base/time_stepping/finite_diff.py @@ -21,13 +21,11 @@ class TimeSteppingFiniteDiffCrankNicolson(TimeSteppingBase): - """Time stepping class for finite-difference solvers. - """ + """Time stepping class for finite-difference solvers.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" TimeSteppingBase._complete_params_with_default(params) params.time_stepping.type_time_scheme = "RK2" diff --git a/fluidsim/base/time_stepping/pseudo_spect.py b/fluidsim/base/time_stepping/pseudo_spect.py --- a/fluidsim/base/time_stepping/pseudo_spect.py +++ b/fluidsim/base/time_stepping/pseudo_spect.py @@ -152,14 +152,11 @@ class TimeSteppingPseudoSpectral(TimeSteppingBase): - """Time stepping class for pseudo-spectral solvers. - - """ + """Time stepping class for pseudo-spectral solvers.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" TimeSteppingBase._complete_params_with_default(params) params.time_stepping.USE_CFL = True @@ -907,7 +904,11 @@ state_spect, dt / 6, tendencies_0, diss, output=self._state_spect_tmp ) state_spect_12_approx1 = step_Euler( - state_spect, dt / 2, tendencies_0, diss2, output=state_spect_tmp1, + state_spect, + dt / 2, + tendencies_0, + diss2, + output=state_spect_tmp1, ) tendencies_1 = compute_tendencies( diff --git a/fluidsim/base/time_stepping/simple.py b/fluidsim/base/time_stepping/simple.py --- a/fluidsim/base/time_stepping/simple.py +++ b/fluidsim/base/time_stepping/simple.py @@ -53,9 +53,7 @@ class TimeSteppingSimple(TimeSteppingBase): - """Time stepping class for pseudo-spectral solvers. - - """ + """Time stepping class for pseudo-spectral solvers.""" def __init__(self, sim): super().__init__(sim) diff --git a/fluidsim/operators/base.py b/fluidsim/operators/base.py --- a/fluidsim/operators/base.py +++ b/fluidsim/operators/base.py @@ -73,8 +73,7 @@ class OperatorsBase1D(OperatorBase): @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = {"nx": 48, "Lx": 8.0} params._set_child("oper", attribs=attribs) return params diff --git a/fluidsim/operators/op_finitediff2d.py b/fluidsim/operators/op_finitediff2d.py --- a/fluidsim/operators/op_finitediff2d.py +++ b/fluidsim/operators/op_finitediff2d.py @@ -15,8 +15,7 @@ class OperatorFiniteDiff2DPeriodic(OperatorFiniteDiff1DPeriodic): @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = {"nx": 48, "ny": 48, "Lx": 8, "Ly": 8} params._set_child("oper", attribs=attribs) diff --git a/fluidsim/operators/operators0d.py b/fluidsim/operators/operators0d.py --- a/fluidsim/operators/operators0d.py +++ b/fluidsim/operators/operators0d.py @@ -13,14 +13,11 @@ class Operators0D: - """0D operators. - - """ + """0D operators.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" params._set_child("oper") def __init__(self, params=None, SEQUENTIAL=None): diff --git a/fluidsim/operators/operators1d.py b/fluidsim/operators/operators1d.py --- a/fluidsim/operators/operators1d.py +++ b/fluidsim/operators/operators1d.py @@ -16,14 +16,11 @@ class OperatorsPseudoSpectral1D(OperatorsBase1D): - """1D operators for pseudospectral solvers. - - """ + """1D operators for pseudospectral solvers.""" @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" params = OperatorsBase1D._complete_params_with_default(params) params.oper._set_attribs( {"type_fft": "sequential", "coef_dealiasing": 2.0 / 3} diff --git a/fluidsim/operators/operators2d.py b/fluidsim/operators/operators2d.py --- a/fluidsim/operators/operators2d.py +++ b/fluidsim/operators/operators2d.py @@ -93,8 +93,7 @@ @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = { "type_fft": "default", "coef_dealiasing": 2.0 / 3, diff --git a/fluidsim/operators/operators3d.py b/fluidsim/operators/operators3d.py --- a/fluidsim/operators/operators3d.py +++ b/fluidsim/operators/operators3d.py @@ -97,7 +97,9 @@ @boost def compute_energy_from_3fields( - vx: Ac, vy: Ac, vz: Ac, + vx: Ac, + vy: Ac, + vz: Ac, ): return 0.5 * (np.abs(vx) ** 2 + np.abs(vy) ** 2 + np.abs(vz) ** 2) @@ -153,8 +155,7 @@ @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" attribs = { "type_fft": "default", "type_fft2d": "sequential", diff --git a/fluidsim/solvers/ad1d/output/__init__.py b/fluidsim/solvers/ad1d/output/__init__.py --- a/fluidsim/solvers/ad1d/output/__init__.py +++ b/fluidsim/solvers/ad1d/output/__init__.py @@ -32,8 +32,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" OutputBase._complete_params_with_default(params, info_solver) params.output.phys_fields.field_to_plot = "s" diff --git a/fluidsim/solvers/ad1d/solver.py b/fluidsim/solvers/ad1d/solver.py --- a/fluidsim/solvers/ad1d/solver.py +++ b/fluidsim/solvers/ad1d/solver.py @@ -61,8 +61,7 @@ @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" SimulBase._complete_params_with_default(params) attribs = {"U": 1.0} params._set_attribs(attribs) diff --git a/fluidsim/solvers/burgers1d/solver.py b/fluidsim/solvers/burgers1d/solver.py --- a/fluidsim/solvers/burgers1d/solver.py +++ b/fluidsim/solvers/burgers1d/solver.py @@ -25,8 +25,7 @@ @staticmethod def _complete_info_solver(info_solver): - """Complete the ParamContainer info_solver. - """ + """Complete the ParamContainer info_solver.""" info_solver.classes.State._set_attribs( { "keys_state_spect": ["u_fft"], diff --git a/fluidsim/solvers/models0d/lorenz/solver.py b/fluidsim/solvers/models0d/lorenz/solver.py --- a/fluidsim/solvers/models0d/lorenz/solver.py +++ b/fluidsim/solvers/models0d/lorenz/solver.py @@ -61,9 +61,7 @@ class Simul(SimulBase): - """Solve the Lorenz equations. - - """ + """Solve the Lorenz equations.""" InfoSolver = InfoSolverLorenz diff --git a/fluidsim/solvers/models0d/predaprey/solver.py b/fluidsim/solvers/models0d/predaprey/solver.py --- a/fluidsim/solvers/models0d/predaprey/solver.py +++ b/fluidsim/solvers/models0d/predaprey/solver.py @@ -58,9 +58,7 @@ class Simul(SimulBase): - """Solve the Lotka-Volterra equations. - - """ + """Solve the Lotka-Volterra equations.""" InfoSolver = InfoSolverPredaPrey diff --git a/fluidsim/solvers/ns2d/bouss/solver.py b/fluidsim/solvers/ns2d/bouss/solver.py --- a/fluidsim/solvers/ns2d/bouss/solver.py +++ b/fluidsim/solvers/ns2d/bouss/solver.py @@ -58,9 +58,7 @@ class Simul(SimulNS2D): - """Pseudo-spectral solver 2D incompressible Navier-Stokes equations. - - """ + """Pseudo-spectral solver 2D incompressible Navier-Stokes equations.""" InfoSolver = InfoSolverNS2DBouss @@ -105,7 +103,7 @@ N(\zeta) = - \mathbf{u}\cdot \mathbf{\nabla} \zeta + \mathbf{\nabla}\wedge b\mathbf{e_z} = - \mathbf{u}\cdot \mathbf{\nabla} \zeta + \p_x b` and :math:`\hat N(b) = - \mathbf{u}\cdot - \mathbf{\nabla} b`. """ + \mathbf{\nabla} b`.""" oper = self.oper fft_as_arg = oper.fft_as_arg ifft_as_arg = oper.ifft_as_arg diff --git a/fluidsim/solvers/ns2d/strat/solver.py b/fluidsim/solvers/ns2d/strat/solver.py --- a/fluidsim/solvers/ns2d/strat/solver.py +++ b/fluidsim/solvers/ns2d/strat/solver.py @@ -58,16 +58,13 @@ class Simul(SimulNS2D): - """Pseudo-spectral solver 2D incompressible Navier-Stokes equations. - - """ + """Pseudo-spectral solver 2D incompressible Navier-Stokes equations.""" InfoSolver = InfoSolverNS2DStrat @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" SimulNS2D._complete_params_with_default(params) attribs = {"N": 1.0} params._set_attribs(attribs) @@ -113,7 +110,7 @@ :math:`N(\zeta) = - \mathbf{u}\cdot \mathbf{\nabla} \zeta + \mathbf{\nabla}\wedge b\mathbf{e_z} = - \mathbf{u}\cdot \mathbf{\nabla} \zeta + \p_x b` and :math:`N(b) = - \mathbf{u}\cdot \mathbf{\nabla} b + - N^2u_y`. """ + N^2u_y`.""" oper = self.oper fft_as_arg = oper.fft_as_arg ifft_as_arg = oper.ifft_as_arg diff --git a/fluidsim/solvers/ns3d/forcing.py b/fluidsim/solvers/ns3d/forcing.py --- a/fluidsim/solvers/ns3d/forcing.py +++ b/fluidsim/solvers/ns3d/forcing.py @@ -185,7 +185,12 @@ vx = sim.state.state_phys.get_var("vx") tmp = self._tmp_forcing fx = compute_watu_coriolis_forcing_component( - self.sigma, self.maskx, coef_forcing_time_x, self.vxtarget, vx, tmp, + self.sigma, + self.maskx, + coef_forcing_time_x, + self.vxtarget, + vx, + tmp, ) fx_fft = sim.oper.fft(fx) if self.nb_wave_makers == 1: @@ -193,7 +198,12 @@ coef_forcing_time_y = float(self.interpolents[1](time)) vy = sim.state.state_phys.get_var("vy") fy = compute_watu_coriolis_forcing_component( - self.sigma, self.masky, coef_forcing_time_y, self.vytarget, vy, tmp, + self.sigma, + self.masky, + coef_forcing_time_y, + self.vytarget, + vy, + tmp, ) return {"vx_fft": fx_fft, "vy_fft": sim.oper.fft(fy)} diff --git a/fluidsim/solvers/ns3d/init_fields.py b/fluidsim/solvers/ns3d/init_fields.py --- a/fluidsim/solvers/ns3d/init_fields.py +++ b/fluidsim/solvers/ns3d/init_fields.py @@ -141,7 +141,9 @@ def compute_vv_fft(self): params_noise = self.sim.params.init_fields.noise return compute_solenoidal_noise_fft( - self.sim.oper, params_noise.length, params_noise.velo_max, + self.sim.oper, + params_noise.length, + params_noise.velo_max, ) diff --git a/fluidsim/solvers/ns3d/output/__init__.py b/fluidsim/solvers/ns3d/output/__init__.py --- a/fluidsim/solvers/ns3d/output/__init__.py +++ b/fluidsim/solvers/ns3d/output/__init__.py @@ -68,8 +68,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" OutputBasePseudoSpectral._complete_params_with_default( params, info_solver ) diff --git a/fluidsim/solvers/ns3d/output/spatial_means.py b/fluidsim/solvers/ns3d/output/spatial_means.py --- a/fluidsim/solvers/ns3d/output/spatial_means.py +++ b/fluidsim/solvers/ns3d/output/spatial_means.py @@ -251,7 +251,12 @@ def _plot(x, y, fmt, label=None, linewidth=1, zorder=10): ax.plot( - x, y, fmt, label=label, linewidth=linewidth, zorder=zorder, + x, + y, + fmt, + label=label, + linewidth=linewidth, + zorder=zorder, ) _plot(t, epsK, "r", r"$\epsilon$", linewidth=2) @@ -263,14 +268,20 @@ epsK4 = dict_results["epsK4"] if not np.allclose(epsK, epsK4): _plot( - t, epsK4, "r:", r"$\epsilon_4$", + t, + epsK4, + "r:", + r"$\epsilon_4$", ) if "epsK8" in dict_results and plot_hyper: epsK8 = dict_results["epsK8"] if not np.allclose(epsK, epsK8): _plot( - t, epsK8, "r:", r"$\epsilon_8$", + t, + epsK8, + "r:", + r"$\epsilon_8$", ) if "PK_tot" in dict_results and plot_injection: diff --git a/fluidsim/solvers/ns3d/solver.py b/fluidsim/solvers/ns3d/solver.py --- a/fluidsim/solvers/ns3d/solver.py +++ b/fluidsim/solvers/ns3d/solver.py @@ -119,8 +119,7 @@ @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" SimulBasePseudoSpectral._complete_params_with_default(params) params._set_attrib("f", None) params._set_doc( diff --git a/fluidsim/solvers/ns3d/strat/output/spatial_means.py b/fluidsim/solvers/ns3d/strat/output/spatial_means.py --- a/fluidsim/solvers/ns3d/strat/output/spatial_means.py +++ b/fluidsim/solvers/ns3d/strat/output/spatial_means.py @@ -322,7 +322,12 @@ def _plot(x, y, fmt, label=None, linewidth=1, zorder=10): ax.plot( - x, y, fmt, label=label, linewidth=linewidth, zorder=zorder, + x, + y, + fmt, + label=label, + linewidth=linewidth, + zorder=zorder, ) _plot(t, epsK, "r", r"$\epsilon_K$") @@ -338,10 +343,16 @@ epsA4 = dict_results["epsA4"] if not np.allclose(epsK, epsK4): _plot( - t, epsK4, "r:", r"$\epsilon_{K4}$", + t, + epsK4, + "r:", + r"$\epsilon_{K4}$", ) _plot( - t, epsA4, "b:", r"$\epsilon_{A4}$", + t, + epsA4, + "b:", + r"$\epsilon_{A4}$", ) if "epsK8" in dict_results and plot_hyper: @@ -349,10 +360,16 @@ epsA8 = dict_results["epsA8"] if not np.allclose(epsK, epsK8): _plot( - t, epsK8, "r:", r"$\epsilon_{K8}$", + t, + epsK8, + "r:", + r"$\epsilon_{K8}$", ) _plot( - t, epsA8, "b:", r"$\epsilon_{A8}$", + t, + epsA8, + "b:", + r"$\epsilon_{A8}$", ) if "PK_tot" in dict_results and plot_injection: diff --git a/fluidsim/solvers/ns3d/strat/output/spect_energy_budget.py b/fluidsim/solvers/ns3d/strat/output/spect_energy_budget.py --- a/fluidsim/solvers/ns3d/strat/output/spect_energy_budget.py +++ b/fluidsim/solvers/ns3d/strat/output/spect_energy_budget.py @@ -151,7 +151,11 @@ def _plot(x, y, code, label, linewidth=None): ax.semilogx( - x, y / eps, code, label=label, linewidth=linewidth, + x, + y / eps, + code, + label=label, + linewidth=linewidth, ) _plot(k_plot, flux_tot, "k", r"$\Pi/\epsilon$", linewidth=2) diff --git a/fluidsim/solvers/ns3d/strat/solver.py b/fluidsim/solvers/ns3d/strat/solver.py --- a/fluidsim/solvers/ns3d/strat/solver.py +++ b/fluidsim/solvers/ns3d/strat/solver.py @@ -125,8 +125,7 @@ @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" SimulNS3D._complete_params_with_default(params) attribs = {"N": 1.0} params._set_attribs(attribs) diff --git a/fluidsim/solvers/ns3d/test_solver.py b/fluidsim/solvers/ns3d/test_solver.py --- a/fluidsim/solvers/ns3d/test_solver.py +++ b/fluidsim/solvers/ns3d/test_solver.py @@ -151,7 +151,10 @@ sim2.output.spectra.load1d_mean() sim2.output.spectra.load3d_mean() sim2.output.spectra.plot1d( - coef_plot_k3=1.0, coef_plot_k53=1.0, xlim=(0.1, 1), ylim=(0.1, 1), + coef_plot_k3=1.0, + coef_plot_k53=1.0, + xlim=(0.1, 1), + ylim=(0.1, 1), ) sim2.output.spectra.plot1d_times( tmin=0.1, diff --git a/fluidsim/solvers/plate2d/init_fields.py b/fluidsim/solvers/plate2d/init_fields.py --- a/fluidsim/solvers/plate2d/init_fields.py +++ b/fluidsim/solvers/plate2d/init_fields.py @@ -84,7 +84,8 @@ super(cls, cls)._complete_params_with_default(params) params.init_fields._set_child( - cls.tag, attribs={"i0": 20, "i1": 25}, + cls.tag, + attribs={"i0": 20, "i1": 25}, ) def __call__(self): diff --git a/fluidsim/solvers/plate2d/operators.py b/fluidsim/solvers/plate2d/operators.py --- a/fluidsim/solvers/plate2d/operators.py +++ b/fluidsim/solvers/plate2d/operators.py @@ -38,9 +38,7 @@ class OperatorsPseudoSpectralPlate2D(OperatorsPseudoSpectral2D): - """Operators for the plate2d model. - - """ + """Operators for the plate2d model.""" def __init__(self, params): super().__init__(params) diff --git a/fluidsim/solvers/plate2d/output/__init__.py b/fluidsim/solvers/plate2d/output/__init__.py --- a/fluidsim/solvers/plate2d/output/__init__.py +++ b/fluidsim/solvers/plate2d/output/__init__.py @@ -74,8 +74,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" OutputBasePseudoSpectral._complete_params_with_default( params, info_solver ) diff --git a/fluidsim/solvers/plate2d/output/correlations_freq.py b/fluidsim/solvers/plate2d/output/correlations_freq.py --- a/fluidsim/solvers/plate2d/output/correlations_freq.py +++ b/fluidsim/solvers/plate2d/output/correlations_freq.py @@ -148,9 +148,7 @@ class CorrelationsFreq(SpecificOutput): - """Compute, save, load and plot correlations of frequencies. - - """ + """Compute, save, load and plot correlations of frequencies.""" _tag = "correl_freq" _name_file = _tag + ".h5" diff --git a/fluidsim/solvers/plate2d/output/spatial_means.py b/fluidsim/solvers/plate2d/output/spatial_means.py --- a/fluidsim/solvers/plate2d/output/spatial_means.py +++ b/fluidsim/solvers/plate2d/output/spatial_means.py @@ -52,8 +52,7 @@ .. math:: D_w = 2 \nu_\alpha \sum_{\mathbf{k}} k^{2\alpha} E_w(k). - -""" + """ def _save_one_time(self): tsim = self.sim.time_stepping.t diff --git a/fluidsim/solvers/sphere/ns2d/solver.py b/fluidsim/solvers/sphere/ns2d/solver.py --- a/fluidsim/solvers/sphere/ns2d/solver.py +++ b/fluidsim/solvers/sphere/ns2d/solver.py @@ -23,8 +23,7 @@ """Contain the information on a base pseudo-spectral solver.""" def _init_root(self): - """Init. `self` by writting the information on the solver. - """ + """Init. `self` by writting the information on the solver.""" super()._init_root() diff --git a/fluidsim/solvers/sphere/sw1l/solver.py b/fluidsim/solvers/sphere/sw1l/solver.py --- a/fluidsim/solvers/sphere/sw1l/solver.py +++ b/fluidsim/solvers/sphere/sw1l/solver.py @@ -36,8 +36,7 @@ """Contain the information on the ``sphere.sw1l`` solver.""" def _init_root(self): - """Init. `self` by writting the information on the solver. - """ + """Init. `self` by writting the information on the solver.""" super()._init_root() @@ -61,9 +60,7 @@ @staticmethod def _complete_params_with_default(params): - """Complete the `params` container (static method). - - """ + """Complete the `params` container (static method).""" SimulSphericalHarmo._complete_params_with_default(params) attribs = {"c2": 20} diff --git a/fluidsim/solvers/sw1l/output/__init__.py b/fluidsim/solvers/sw1l/output/__init__.py --- a/fluidsim/solvers/sw1l/output/__init__.py +++ b/fluidsim/solvers/sw1l/output/__init__.py @@ -112,8 +112,7 @@ @staticmethod def _complete_params_with_default(params, info_solver): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" OutputBasePseudoSpectral._complete_params_with_default( params, info_solver ) diff --git a/fluidsim/solvers/sw1l/output/normal_mode.py b/fluidsim/solvers/sw1l/output/normal_mode.py --- a/fluidsim/solvers/sw1l/output/normal_mode.py +++ b/fluidsim/solvers/sw1l/output/normal_mode.py @@ -62,8 +62,8 @@ return self.bvec_fft def bvecfft_from_qapamfft(self, q_fft, ap_fft, am_fft): - r""" Compute normal mode vector :math:`\mathbf{B}` - with dimensions of velocity from diagonalized linear modes. """ + r"""Compute normal mode vector :math:`\mathbf{B}` + with dimensions of velocity from diagonalized linear modes.""" c = self.params.c2 ** 0.5 c2 = self.params.c2 K = self.oper.K_not0 @@ -79,8 +79,8 @@ return bvec_fft def bvecfft_from_uxuyetafft(self, ux_fft, uy_fft, eta_fft): - r""" Compute normal mode vector, :math:`\mathbf{B}` - with dimensions of velocity from primitive variables. """ + r"""Compute normal mode vector, :math:`\mathbf{B}` + with dimensions of velocity from primitive variables.""" q_fft, ap_fft, am_fft = self.oper.qapamfft_from_uxuyetafft( ux_fft, uy_fft, eta_fft ) @@ -131,21 +131,24 @@ K_not0 = oper.K_not0 ck = c * K_not0 - qmat = np.array( - [ - [ - -1j * 2.0 ** 0.5 * ck * KY, - +1j * f * KY + KX * sigma, - +1j * f * KY - KX * sigma, - ], + qmat = ( + np.array( [ - +1j * 2.0 ** 0.5 * ck * KX, - -1j * f * KX + KY * sigma, - -1j * f * KX - KY * sigma, - ], - [2.0 ** 0.5 * f * K, c * K2, c * K2], - ] - ) / (2.0 ** 0.5 * sigma * K_not0) + [ + -1j * 2.0 ** 0.5 * ck * KY, + +1j * f * KY + KX * sigma, + +1j * f * KY - KX * sigma, + ], + [ + +1j * 2.0 ** 0.5 * ck * KX, + -1j * f * KX + KY * sigma, + -1j * f * KX - KY * sigma, + ], + [2.0 ** 0.5 * f * K, c * K2, c * K2], + ] + ) + / (2.0 ** 0.5 * sigma * K_not0) + ) if mpi.rank == 0 or oper.is_sequential: qmat[:, :, 0, 0] = 0.0 diff --git a/fluidsim/solvers/sw1l/output/spatial_means.py b/fluidsim/solvers/sw1l/output/spatial_means.py --- a/fluidsim/solvers/sw1l/output/spatial_means.py +++ b/fluidsim/solvers/sw1l/output/spatial_means.py @@ -11,9 +11,9 @@ class SpatialMeansMSW1L(SpatialMeansJSON): """Handle the saving of spatial mean quantities. - Viz. total energy, K.E., A.P.E. and Charney potential enstrophy. It also - handles the computation of forcing and dissipation rates for - sw1l.modified solver + Viz. total energy, K.E., A.P.E. and Charney potential enstrophy. It also + handles the computation of forcing and dissipation rates for + sw1l.modified solver """ diff --git a/fluidsim/solvers/waves2d/solver.py b/fluidsim/solvers/waves2d/solver.py --- a/fluidsim/solvers/waves2d/solver.py +++ b/fluidsim/solvers/waves2d/solver.py @@ -104,8 +104,7 @@ @staticmethod def _complete_params_with_default(params): - """This static method is used to complete the *params* container. - """ + """This static method is used to complete the *params* container.""" SimulBasePseudoSpectral._complete_params_with_default(params) attribs = {"c2": 1.0, "f": 0} params._set_attribs(attribs) diff --git a/fluidsim/util/console/bench_analysis.py b/fluidsim/util/console/bench_analysis.py --- a/fluidsim/util/console/bench_analysis.py +++ b/fluidsim/util/console/bench_analysis.py @@ -120,8 +120,7 @@ raise ConsoleError("Unknown plot type.") def group_df(df): - """Group and take median dataframe results with same number of processes. - """ + """Group and take median dataframe results with same number of processes.""" # for "scaling" (mpi) df = df[df.nb_proc > 1] exit_if_empty(df, input_params) diff --git a/fluidsim/util/util.py b/fluidsim/util/util.py --- a/fluidsim/util/util.py +++ b/fluidsim/util/util.py @@ -115,9 +115,7 @@ def get_dim_from_solver_key(key, package=None): - """Try to guess the dimension from the solver key (via the operator name). - - """ + """Try to guess the dimension from the solver key (via the operator name).""" cls = import_simul_class_from_key(key, package) info = cls.InfoSolver() class_name = info.classes.Operators.class_name @@ -469,9 +467,7 @@ def times_start_end_from_path(path): - """Return the start and end times from a result directory path. - - """ + """Return the start and end times from a result directory path.""" path_file = path + "/stdout.txt" if not os.path.exists(path_file):