From cc48054d9184d769e9963cd40239d910e3f22593 Mon Sep 17 00:00:00 2001 From: paugier Date: Mon, 29 Jan 2024 21:36:32 +0100 Subject: [PATCH] Black :-) --- bench/profiling/simul_profile2d_vmprof.py | 1 - bench/spectraldns/bench_2d.py | 3 ++- bench/spectraldns/bench_3d.py | 1 + bench/spectraldns/profile_2d.py | 3 ++- bench/spectraldns/profile_3d.py | 1 + .../simul_ns2dbouss_initfields_in_script.py | 1 + ...imul_ns2dstrat_forcing_const_energy_rate.py | 1 + .../simul_ns2dstrat_forcing_in_script.py | 1 + .../simul_ns2dstrat_initfields_in_script.py | 1 + .../simul_ns3dbouss_initfields_in_script.py | 1 + doc/examples/simul_ns3dstrat_waves.py | 1 + doc/examples/time_stepping/3d/run_profile.py | 1 + fluidsim/base/forcing/kolmogorov.py | 1 + fluidsim/base/output/base.py | 6 +++--- fluidsim/base/output/cross_corr3d.py | 1 - fluidsim/base/output/horiz_means.py | 1 + fluidsim/base/output/spatiotemporal_spectra.py | 8 ++------ fluidsim/base/output/spectra.py | 1 - fluidsim/base/output/spectra3d.py | 1 - fluidsim/base/output/time_signals_fft.py | 16 +++++++--------- fluidsim/base/params.py | 1 + fluidsim/base/preprocess/base.py | 1 + fluidsim/base/preprocess/pseudo_spect.py | 4 +--- fluidsim/base/solvers/base.py | 1 + fluidsim/base/solvers/info_base.py | 1 + fluidsim/base/time_stepping/pseudo_spect.py | 1 + fluidsim/base/turb_model/smagorinsky.py | 1 + fluidsim/base/turb_model/stress_tensor.py | 4 +--- fluidsim/magic.py | 1 + fluidsim/operators/sphericalharmo.py | 1 + fluidsim/solvers/__init__.py | 1 + fluidsim/solvers/ad1d/init_fields.py | 1 + fluidsim/solvers/ad1d/pseudo_spect/solver.py | 1 + fluidsim/solvers/ad1d/solver.py | 1 + fluidsim/solvers/burgers1d/skew_sym/solver.py | 1 + fluidsim/solvers/burgers1d/solver.py | 1 + fluidsim/solvers/nl1d/solver.py | 1 + fluidsim/solvers/ns2d/bouss/solver.py | 1 + fluidsim/solvers/ns2d/strat/forcing.py | 1 - .../output/_old_miguel_frequency_spectra.py | 12 ++++++------ .../_old_miguel_spatio_temporal_spectra.py | 18 +++++++++--------- .../ns2d/strat/output/spect_energy_budget.py | 4 +--- fluidsim/solvers/ns2d/test_solver.py | 6 +++--- fluidsim/solvers/ns3d/bouss/solver.py | 1 + fluidsim/solvers/ns3d/solver.py | 1 + fluidsim/solvers/ns3d/strat/solver.py | 4 ++-- fluidsim/solvers/ns3d/test_solver.py | 6 +++--- fluidsim/solvers/plate2d/test_solver.py | 4 +--- fluidsim/solvers/sphere/sw1l/solver.py | 1 + fluidsim/solvers/sphere/sw1l/state.py | 1 + fluidsim/solvers/waves2d/solver.py | 1 + fluidsim/util/console/__main__.py | 1 + fluidsim/util/console/bench_analysis.py | 1 + fluidsim/util/console/test_bench.py | 1 + fluidsim/util/console/util.py | 1 + fluidsim/util/testing.py | 8 +++++--- lib/fluidsim_core/__init__.py | 1 + lib/fluidsim_core/info.py | 1 + lib/fluidsim_core/loader.py | 1 + lib/fluidsim_core/magic.py | 1 + lib/fluidsim_core/output/base.py | 1 + .../output/phys_fields_snek5000.py | 1 + .../output/remaining_clock_time.py | 1 + lib/fluidsim_core/params.py | 1 + lib/fluidsim_core/scripts/__init__.py | 1 + lib/fluidsim_core/solver.py | 1 + scripts/bugs/memory_leak_sw1l.py | 1 + scripts/ns2d.strat/compute_anisotropy.py | 1 + scripts/ns2d.strat/compute_flow_features.py | 1 + scripts/ns2d.strat/make_table_parameters.py | 1 + scripts/ns2d.strat/make_video_spectrum_kykx.py | 1 + .../plot_buoyancy_reynolds_anisotropy.py | 1 + .../plot_buoyancy_reynolds_dissipation.py | 1 + .../plot_buoyancy_reynolds_froude.py | 1 + scripts/ns2d.strat/plot_froude_anisotropy.py | 1 + scripts/ns2d.strat/plot_froude_dissipation.py | 1 + scripts/ns2d.strat/plot_length_scales.py | 1 + scripts/ns2d.strat/simul_from_state.py | 1 - scripts/ns2d.strat/submit_simul_from_state.py | 1 + scripts/plot_results/plot_interm.py | 2 +- scripts/sphere.sw1l/galewsky2004.py | 1 + 81 files changed, 108 insertions(+), 65 deletions(-) diff --git a/bench/profiling/simul_profile2d_vmprof.py b/bench/profiling/simul_profile2d_vmprof.py index 16dfa7dd7..0b6ac3aa6 100644 --- a/bench/profiling/simul_profile2d_vmprof.py +++ b/bench/profiling/simul_profile2d_vmprof.py @@ -5,7 +5,6 @@ """ - from simul_profile2d import sim sim.time_stepping.start() diff --git a/bench/spectraldns/bench_2d.py b/bench/spectraldns/bench_2d.py index 674178ab4..8eedb15dd 100644 --- a/bench/spectraldns/bench_2d.py +++ b/bench/spectraldns/bench_2d.py @@ -19,6 +19,7 @@ mpirun -np 2 fluidsim-bench 1152 -d 2 -s ns2d -it 10 """ + import time import numpy as np from spectralDNS import config, get_solver, solve @@ -68,7 +69,7 @@ def update(context): "T": 1e-11, # Should run 10 iterations "write_result": 100, "L": [L, L], - "M": [10, 10] # Mesh size is pow(2, M[i]) in direction i + "M": [10, 10], # Mesh size is pow(2, M[i]) in direction i # 2**9 == 512 }, "doublyperiodic", diff --git a/bench/spectraldns/bench_3d.py b/bench/spectraldns/bench_3d.py index d7a692c78..2ac6cbfd1 100644 --- a/bench/spectraldns/bench_3d.py +++ b/bench/spectraldns/bench_3d.py @@ -16,6 +16,7 @@ mpirun -np 2 fluidsim-bench 128 -d 3 -s ns3d -it 10 """ + import time import numpy as np from numpy import zeros, sum, float64, sin, cos, prod, asscalar diff --git a/bench/spectraldns/profile_2d.py b/bench/spectraldns/profile_2d.py index cb1fc36bf..0c717ee21 100644 --- a/bench/spectraldns/profile_2d.py +++ b/bench/spectraldns/profile_2d.py @@ -16,6 +16,7 @@ """ + import time import numpy as np @@ -71,7 +72,7 @@ def update(context): "T": 11 * dt, # Should run 10 iterations "write_result": 100, "L": [L, L], - "M": [10, 10] # Mesh size is pow(2, M[i]) in direction i + "M": [10, 10], # Mesh size is pow(2, M[i]) in direction i # 2**9 == 512 }, "doublyperiodic", diff --git a/bench/spectraldns/profile_3d.py b/bench/spectraldns/profile_3d.py index c89473d18..982bbaa06 100644 --- a/bench/spectraldns/profile_3d.py +++ b/bench/spectraldns/profile_3d.py @@ -13,6 +13,7 @@ fluidsim-bench 128 -d 3 -s ns3d -it 10 """ + import time import numpy as np from numpy import zeros, sum, float64, sin, cos, prod, asscalar diff --git a/doc/examples/simul_ns2dbouss_initfields_in_script.py b/doc/examples/simul_ns2dbouss_initfields_in_script.py index 1de76118d..5e801719f 100644 --- a/doc/examples/simul_ns2dbouss_initfields_in_script.py +++ b/doc/examples/simul_ns2dbouss_initfields_in_script.py @@ -3,6 +3,7 @@ The field initialization is done in the script. """ + import os import numpy as np diff --git a/doc/examples/simul_ns2dstrat_forcing_const_energy_rate.py b/doc/examples/simul_ns2dstrat_forcing_const_energy_rate.py index 40562f987..504dac8c2 100644 --- a/doc/examples/simul_ns2dstrat_forcing_const_energy_rate.py +++ b/doc/examples/simul_ns2dstrat_forcing_const_energy_rate.py @@ -1,6 +1,7 @@ """Script for a short simulation with the solver ns2d.strat """ + import numpy as np from fluiddyn.util import mpi diff --git a/doc/examples/simul_ns2dstrat_forcing_in_script.py b/doc/examples/simul_ns2dstrat_forcing_in_script.py index c93a1d3a8..bbae52c52 100644 --- a/doc/examples/simul_ns2dstrat_forcing_in_script.py +++ b/doc/examples/simul_ns2dstrat_forcing_in_script.py @@ -3,6 +3,7 @@ Note how is used the user-defined forcing maker... """ + from math import pi import os diff --git a/doc/examples/simul_ns2dstrat_initfields_in_script.py b/doc/examples/simul_ns2dstrat_initfields_in_script.py index a10a16eba..a517e7e94 100644 --- a/doc/examples/simul_ns2dstrat_initfields_in_script.py +++ b/doc/examples/simul_ns2dstrat_initfields_in_script.py @@ -3,6 +3,7 @@ The field initialization is done in the script. """ + import os import numpy as np diff --git a/doc/examples/simul_ns3dbouss_initfields_in_script.py b/doc/examples/simul_ns3dbouss_initfields_in_script.py index cde2a54d1..340fd1474 100644 --- a/doc/examples/simul_ns3dbouss_initfields_in_script.py +++ b/doc/examples/simul_ns3dbouss_initfields_in_script.py @@ -7,6 +7,7 @@ mpirun -np 4 python simul_ns3dbouss_initfields_in_script.py """ + import os import numpy as np diff --git a/doc/examples/simul_ns3dstrat_waves.py b/doc/examples/simul_ns3dstrat_waves.py index eed7a81d2..9e8540792 100644 --- a/doc/examples/simul_ns3dstrat_waves.py +++ b/doc/examples/simul_ns3dstrat_waves.py @@ -6,6 +6,7 @@ mpirun -np 4 python simul_ns3dstrat_waves.py """ + import os from math import pi diff --git a/doc/examples/time_stepping/3d/run_profile.py b/doc/examples/time_stepping/3d/run_profile.py index e459eae8d..b8827fdd0 100644 --- a/doc/examples/time_stepping/3d/run_profile.py +++ b/doc/examples/time_stepping/3d/run_profile.py @@ -14,6 +14,7 @@ ``` """ + from pathlib import Path import sys diff --git a/fluidsim/base/forcing/kolmogorov.py b/fluidsim/base/forcing/kolmogorov.py index 3f1878cd1..724d71ad6 100644 --- a/fluidsim/base/forcing/kolmogorov.py +++ b/fluidsim/base/forcing/kolmogorov.py @@ -10,6 +10,7 @@ :private-members: """ + from warnings import warn import numpy as np diff --git a/fluidsim/base/output/base.py b/fluidsim/base/output/base.py index aeee94863..c33901148 100644 --- a/fluidsim/base/output/base.py +++ b/fluidsim/base/output/base.py @@ -492,9 +492,9 @@ def _compute_mean_values(self, tmin, tmax): lengths = self.spectra.compute_length_scales(data=data_spectra) result.update(lengths) - result[ - "I_dissipation" - ] = self.spect_energy_budg.compute_isotropy_dissipation(tmin) + result["I_dissipation"] = ( + self.spect_energy_budg.compute_isotropy_dissipation(tmin) + ) return result diff --git a/fluidsim/base/output/cross_corr3d.py b/fluidsim/base/output/cross_corr3d.py index 86de11713..9b1c8285f 100644 --- a/fluidsim/base/output/cross_corr3d.py +++ b/fluidsim/base/output/cross_corr3d.py @@ -11,7 +11,6 @@ """ - import itertools import numpy as np diff --git a/fluidsim/base/output/horiz_means.py b/fluidsim/base/output/horiz_means.py index e6e55d9e6..e7d14f7f1 100644 --- a/fluidsim/base/output/horiz_means.py +++ b/fluidsim/base/output/horiz_means.py @@ -10,6 +10,7 @@ :undoc-members: """ + import numpy as np import h5py import matplotlib.pyplot as plt diff --git a/fluidsim/base/output/spatiotemporal_spectra.py b/fluidsim/base/output/spatiotemporal_spectra.py index 182e4ae7d..d82d67e0c 100644 --- a/fluidsim/base/output/spatiotemporal_spectra.py +++ b/fluidsim/base/output/spatiotemporal_spectra.py @@ -1164,9 +1164,7 @@ def plot_kzkhomega( omega_disp = ikh / np.sqrt(ikh**2 + dkz_over_dkh**2 * xaxis**2) ax.plot(xaxis, omega_disp, "k-", linewidth=2) elif equation.startswith(r"$k_z"): - omega_disp = xaxis / np.sqrt( - xaxis**2 + dkz_over_dkh**2 * ikz**2 - ) + omega_disp = xaxis / np.sqrt(xaxis**2 + dkz_over_dkh**2 * ikz**2) ax.plot(xaxis, omega_disp, "k-", linewidth=2) else: raise ValueError("wrong equation for dispersion relation") @@ -1375,9 +1373,7 @@ def plot_temporal_spectra( aspect_ratio = self.sim.oper.Lx / self.sim.oper.Ly def modes(nx, nz): - return np.sqrt( - nx**2 / (nx**2 + aspect_ratio**2 * nz**2) - ) + return np.sqrt(nx**2 / (nx**2 + aspect_ratio**2 * nz**2)) nxs = np.arange(1, 11) modes_nz1 = modes(nxs, 1) diff --git a/fluidsim/base/output/spectra.py b/fluidsim/base/output/spectra.py index f70b43061..ab1bc9447 100644 --- a/fluidsim/base/output/spectra.py +++ b/fluidsim/base/output/spectra.py @@ -17,7 +17,6 @@ """ - import os import numpy as np diff --git a/fluidsim/base/output/spectra3d.py b/fluidsim/base/output/spectra3d.py index 4d2fa8418..842853404 100644 --- a/fluidsim/base/output/spectra3d.py +++ b/fluidsim/base/output/spectra3d.py @@ -23,7 +23,6 @@ """ - import os from textwrap import dedent from math import sqrt, tau diff --git a/fluidsim/base/output/time_signals_fft.py b/fluidsim/base/output/time_signals_fft.py index 0354ee315..2f0bcd1aa 100644 --- a/fluidsim/base/output/time_signals_fft.py +++ b/fluidsim/base/output/time_signals_fft.py @@ -108,12 +108,12 @@ def _init_save(self, sim): for ishell, kh_s in enumerate(self.kh_shell): angle = -np.pi / 2 for ikps in range(self.nb_k_per_shell): - kx_array_ik_approx[ - ishell * self.nb_shells + ikps - ] = kh_s * np.cos(angle) - ky_array_ik_approx[ - ishell * self.nb_shells + ikps - ] = kh_s * np.sin(angle) + kx_array_ik_approx[ishell * self.nb_shells + ikps] = ( + kh_s * np.cos(angle) + ) + ky_array_ik_approx[ishell * self.nb_shells + ikps] = ( + kh_s * np.sin(angle) + ) angle += delta_angle self.ik0_array_ik = np.empty([self.nb_k_tot], dtype=np.int32) @@ -161,9 +161,7 @@ def _init_save(self, sim): self.ky_array_ik[ik] = ky_1k if mpi.rank == 0: - self.kh_array_ik = np.sqrt( - self.kx_array_ik**2 + self.ky_array_ik**2 - ) + self.kh_array_ik = np.sqrt(self.kx_array_ik**2 + self.ky_array_ik**2) self.omega_array_ik = self.output.omega_from_wavenumber( self.kh_array_ik diff --git a/fluidsim/base/params.py b/fluidsim/base/params.py index 6739cf89b..959c38a70 100644 --- a/fluidsim/base/params.py +++ b/fluidsim/base/params.py @@ -10,6 +10,7 @@ """ + from fluidsim_core.params import Parameters from fluidsim.base.solvers.info_base import InfoSolverBase diff --git a/fluidsim/base/preprocess/base.py b/fluidsim/base/preprocess/base.py index 3d32c7427..45714e2c8 100644 --- a/fluidsim/base/preprocess/base.py +++ b/fluidsim/base/preprocess/base.py @@ -8,6 +8,7 @@ :private-members: """ + from fluidsim_core.params import iter_complete_params diff --git a/fluidsim/base/preprocess/pseudo_spect.py b/fluidsim/base/preprocess/pseudo_spect.py index 510bced4b..b20b269a5 100644 --- a/fluidsim/base/preprocess/pseudo_spect.py +++ b/fluidsim/base/preprocess/pseudo_spect.py @@ -348,9 +348,7 @@ def calcul_viscosity( nu = length_scale**order / time_scale v.append(nu) if verbose: - kolmo_len.append( - (nu**3 / epsilon) ** (1.0 / (3 * order - 2)) - ) + kolmo_len.append((nu**3 / epsilon) ** (1.0 / (3 * order - 2))) else: v.append(0.0) diff --git a/fluidsim/base/solvers/base.py b/fluidsim/base/solvers/base.py index 6b6441350..71593d2c1 100644 --- a/fluidsim/base/solvers/base.py +++ b/fluidsim/base/solvers/base.py @@ -12,6 +12,7 @@ :private-members: """ + from time import time import atexit from pathlib import Path diff --git a/fluidsim/base/solvers/info_base.py b/fluidsim/base/solvers/info_base.py index c4678e324..d1ed82700 100644 --- a/fluidsim/base/solvers/info_base.py +++ b/fluidsim/base/solvers/info_base.py @@ -6,6 +6,7 @@ :private-members: """ + from copy import deepcopy from fluidsim_core.info import InfoSolverCore, create_info_simul # noqa diff --git a/fluidsim/base/time_stepping/pseudo_spect.py b/fluidsim/base/time_stepping/pseudo_spect.py index b3db08dee..9c08cbadb 100644 --- a/fluidsim/base/time_stepping/pseudo_spect.py +++ b/fluidsim/base/time_stepping/pseudo_spect.py @@ -21,6 +21,7 @@ https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19810022965.pdf). """ + from random import randint import numpy as np diff --git a/fluidsim/base/turb_model/smagorinsky.py b/fluidsim/base/turb_model/smagorinsky.py index 5b47733ba..488d7efc9 100644 --- a/fluidsim/base/turb_model/smagorinsky.py +++ b/fluidsim/base/turb_model/smagorinsky.py @@ -36,6 +36,7 @@ class SmagorinskyModel(SpecificTurbModelSpectral): with :math:`C = 0.18` and :math:`\Delta = L_x / n_x`. """ + _module_name = "fluidsim.base.turb_model.smagorinsky" tag = "smagorinsky" diff --git a/fluidsim/base/turb_model/stress_tensor.py b/fluidsim/base/turb_model/stress_tensor.py index 5897ae54f..e61d7234a 100644 --- a/fluidsim/base/turb_model/stress_tensor.py +++ b/fluidsim/base/turb_model/stress_tensor.py @@ -40,6 +40,4 @@ def compute_stress_tensor(self, ux_fft, uy_fft, uz_fft): return Sxx, Syy, Szz, Syx, Szx, Szy def compute_norm(self, Sxx, Syy, Szz, Syx, Szx, Szy): - return np.sqrt( - Sxx**2 + Syy**2 + Szz**2 + 2 * (Syx**2 + Szx**2 + Szy**2) - ) + return np.sqrt(Sxx**2 + Syy**2 + Szz**2 + 2 * (Syx**2 + Szx**2 + Szy**2)) diff --git a/fluidsim/magic.py b/fluidsim/magic.py index 931e7acf5..d03633a14 100644 --- a/fluidsim/magic.py +++ b/fluidsim/magic.py @@ -6,6 +6,7 @@ :private-members: """ + from fluiddyn.io.query import query_yes_no from fluidsim_core.magic import MagicsCore from IPython.core.magic import line_magic, magics_class diff --git a/fluidsim/operators/sphericalharmo.py b/fluidsim/operators/sphericalharmo.py index 664943fb8..6ddcad99f 100644 --- a/fluidsim/operators/sphericalharmo.py +++ b/fluidsim/operators/sphericalharmo.py @@ -3,6 +3,7 @@ """ + import numpy as np from pyshtools.constants import Earth diff --git a/fluidsim/solvers/__init__.py b/fluidsim/solvers/__init__.py index e9d5dd320..eee7e63ae 100644 --- a/fluidsim/solvers/__init__.py +++ b/fluidsim/solvers/__init__.py @@ -28,6 +28,7 @@ pkgload """ + import numpy as _np from warnings import warn as _warn diff --git a/fluidsim/solvers/ad1d/init_fields.py b/fluidsim/solvers/ad1d/init_fields.py index 6d0a488e0..c3b7262d6 100644 --- a/fluidsim/solvers/ad1d/init_fields.py +++ b/fluidsim/solvers/ad1d/init_fields.py @@ -11,6 +11,7 @@ :members: """ + import numpy as np from fluidsim.base.init_fields import InitFieldsBase, SpecificInitFields diff --git a/fluidsim/solvers/ad1d/pseudo_spect/solver.py b/fluidsim/solvers/ad1d/pseudo_spect/solver.py index 8f506fe83..d004de584 100644 --- a/fluidsim/solvers/ad1d/pseudo_spect/solver.py +++ b/fluidsim/solvers/ad1d/pseudo_spect/solver.py @@ -10,6 +10,7 @@ """ + from fluidsim.base.setofvariables import SetOfVariables from fluidsim.base.solvers.pseudo_spect import ( SimulBasePseudoSpectral, diff --git a/fluidsim/solvers/ad1d/solver.py b/fluidsim/solvers/ad1d/solver.py index 2ba43d0e0..5f6fa3d93 100644 --- a/fluidsim/solvers/ad1d/solver.py +++ b/fluidsim/solvers/ad1d/solver.py @@ -52,6 +52,7 @@ class Simul(SimulBase): constant velocity. """ + InfoSolver = InfoSolverAD1D @staticmethod diff --git a/fluidsim/solvers/burgers1d/skew_sym/solver.py b/fluidsim/solvers/burgers1d/skew_sym/solver.py index 7edd835ec..a266517da 100644 --- a/fluidsim/solvers/burgers1d/skew_sym/solver.py +++ b/fluidsim/solvers/burgers1d/skew_sym/solver.py @@ -9,6 +9,7 @@ """ + from fluidsim.base.setofvariables import SetOfVariables from ..solver import Simul as SimulBurgers, InfoSolver as InfoSolverBurgers diff --git a/fluidsim/solvers/burgers1d/solver.py b/fluidsim/solvers/burgers1d/solver.py index 336522d3d..c9e1111c8 100644 --- a/fluidsim/solvers/burgers1d/solver.py +++ b/fluidsim/solvers/burgers1d/solver.py @@ -9,6 +9,7 @@ """ + from fluidsim.base.setofvariables import SetOfVariables from fluidsim.base.solvers.pseudo_spect import ( SimulBasePseudoSpectral, diff --git a/fluidsim/solvers/nl1d/solver.py b/fluidsim/solvers/nl1d/solver.py index a988988cd..6fa207163 100644 --- a/fluidsim/solvers/nl1d/solver.py +++ b/fluidsim/solvers/nl1d/solver.py @@ -8,6 +8,7 @@ :private-members: """ + import numpy as np from fluidsim.base.setofvariables import SetOfVariables diff --git a/fluidsim/solvers/ns2d/bouss/solver.py b/fluidsim/solvers/ns2d/bouss/solver.py index 1933faf5d..ad11003cb 100644 --- a/fluidsim/solvers/ns2d/bouss/solver.py +++ b/fluidsim/solvers/ns2d/bouss/solver.py @@ -6,6 +6,7 @@ :private-members: """ + import numpy as np from transonic import boost, Array diff --git a/fluidsim/solvers/ns2d/strat/forcing.py b/fluidsim/solvers/ns2d/strat/forcing.py index 2d6f9af94..ecf405fe9 100644 --- a/fluidsim/solvers/ns2d/strat/forcing.py +++ b/fluidsim/solvers/ns2d/strat/forcing.py @@ -10,7 +10,6 @@ class ForcingNS2DStrat(ForcingNS2D): - """Forcing class for the ns2d strat solver. .. inheritance-diagram:: ForcingNS2DStrat diff --git a/fluidsim/solvers/ns2d/strat/output/_old_miguel_frequency_spectra.py b/fluidsim/solvers/ns2d/strat/output/_old_miguel_frequency_spectra.py index 9ab918aff..49e1e078b 100644 --- a/fluidsim/solvers/ns2d/strat/output/_old_miguel_frequency_spectra.py +++ b/fluidsim/solvers/ns2d/strat/output/_old_miguel_frequency_spectra.py @@ -230,12 +230,12 @@ def _online_save(self): :: self.spatial_decimate, :: self.spatial_decimate ] - self.temp_array_new[ - 0, self.nb_times_in_temp_array, :, : - ] = field_ap_decimate - self.temp_array_new[ - 1, self.nb_times_in_temp_array, :, : - ] = field_am_decimate + self.temp_array_new[0, self.nb_times_in_temp_array, :, :] = ( + field_ap_decimate + ) + self.temp_array_new[1, self.nb_times_in_temp_array, :, :] = ( + field_am_decimate + ) # Save the time to self.times_arr self.times_arr[self.nb_times_in_temp_array] = ( diff --git a/fluidsim/solvers/ns2d/strat/output/_old_miguel_spatio_temporal_spectra.py b/fluidsim/solvers/ns2d/strat/output/_old_miguel_spatio_temporal_spectra.py index 79471ffa2..194a22d87 100644 --- a/fluidsim/solvers/ns2d/strat/output/_old_miguel_spatio_temporal_spectra.py +++ b/fluidsim/solvers/ns2d/strat/output/_old_miguel_spatio_temporal_spectra.py @@ -264,12 +264,12 @@ def _online_save(self): field_am_decimate = field_am_seq[ :: self.spatial_decimate, :: self.spatial_decimate ] - self.spatio_temp_new[ - 0, self.nb_times_in_spatio_temp, :, : - ] = field_ap_decimate - self.spatio_temp_new[ - 1, self.nb_times_in_spatio_temp, :, : - ] = field_am_decimate + self.spatio_temp_new[0, self.nb_times_in_spatio_temp, :, :] = ( + field_ap_decimate + ) + self.spatio_temp_new[1, self.nb_times_in_spatio_temp, :, :] = ( + field_am_decimate + ) # Save the time to self.times_arr if not self.sim.time_stepping.it: @@ -277,9 +277,9 @@ def _online_save(self): itsim * self.sim.params.time_stepping.deltat0 ) else: - self.times_arr[ - self.nb_times_in_spatio_temp - ] = self.sim.time_stepping.t + self.times_arr[self.nb_times_in_spatio_temp] = ( + self.sim.time_stepping.t + ) self.its_arr[self.nb_times_in_spatio_temp] = self.sim.time_stepping.it diff --git a/fluidsim/solvers/ns2d/strat/output/spect_energy_budget.py b/fluidsim/solvers/ns2d/strat/output/spect_energy_budget.py index 9b2b37703..d3ef5c787 100644 --- a/fluidsim/solvers/ns2d/strat/output/spect_energy_budget.py +++ b/fluidsim/solvers/ns2d/strat/output/spect_energy_budget.py @@ -447,9 +447,7 @@ def plot( ax2.axvspan(k_fymin / k_fy, k_fymax / k_fy, alpha=0.15, color="black") # Plot ozmidov scale - k_o = (self.params.N**3 / self.params.forcing.forcing_rate) ** ( - 1 / 2 - ) + k_o = (self.params.N**3 / self.params.forcing.forcing_rate) ** (1 / 2) ax1.axvline(x=k_o / k_fx, color="black", linestyle="--") ax2.axvline(x=k_o / k_fy, color="black", linestyle="--") ax1.text((k_o / k_fx) + 2, 1, r"$k_o$") diff --git a/fluidsim/solvers/ns2d/test_solver.py b/fluidsim/solvers/ns2d/test_solver.py index c9289b00b..d9c463d4c 100644 --- a/fluidsim/solvers/ns2d/test_solver.py +++ b/fluidsim/solvers/ns2d/test_solver.py @@ -23,9 +23,9 @@ def Simul(cls): @classmethod def init_params(cls): - params = ( - cls.params - ) = cls.Simul.create_default_params() # pylint: disable=maybe-no-member + params = cls.params = ( + cls.Simul.create_default_params() + ) # pylint: disable=maybe-no-member params.short_name_type_run = "test" params.output.sub_directory = "unittests" diff --git a/fluidsim/solvers/ns3d/bouss/solver.py b/fluidsim/solvers/ns3d/bouss/solver.py index 61d90ec50..06d0a5223 100644 --- a/fluidsim/solvers/ns3d/bouss/solver.py +++ b/fluidsim/solvers/ns3d/bouss/solver.py @@ -93,6 +93,7 @@ class Simul(SimulStrat): is taken into account with the operator :math:`P_\perp`. """ + InfoSolver = InfoSolverNS3DBouss def tendencies_nonlin(self, state_spect=None, old=None): diff --git a/fluidsim/solvers/ns3d/solver.py b/fluidsim/solvers/ns3d/solver.py index f6745fd71..0ffe69d83 100644 --- a/fluidsim/solvers/ns3d/solver.py +++ b/fluidsim/solvers/ns3d/solver.py @@ -117,6 +117,7 @@ class Simul(SimulBasePseudoSpectral): \hat N(\vv) = P_\perp \widehat{\vv \times \bomega}. """ + InfoSolver = InfoSolverNS3D @staticmethod diff --git a/fluidsim/solvers/ns3d/strat/solver.py b/fluidsim/solvers/ns3d/strat/solver.py index 5f51ea1e6..6365a9d55 100644 --- a/fluidsim/solvers/ns3d/strat/solver.py +++ b/fluidsim/solvers/ns3d/strat/solver.py @@ -121,6 +121,7 @@ class Simul(SimulNS3D): plane perpendicular to the wave number :math:`\kk`. """ + InfoSolver = InfoSolverNS3DStrat @staticmethod @@ -225,8 +226,7 @@ def compute_dispersion_relation(self): pulsation in rad. """ return self.params.N * np.sqrt( - (self.oper.Kx**2 + self.oper.Ky**2) - * self.oper.inv_K_square_nozero + (self.oper.Kx**2 + self.oper.Ky**2) * self.oper.inv_K_square_nozero ) diff --git a/fluidsim/solvers/ns3d/test_solver.py b/fluidsim/solvers/ns3d/test_solver.py index e26b0b565..2e480d612 100644 --- a/fluidsim/solvers/ns3d/test_solver.py +++ b/fluidsim/solvers/ns3d/test_solver.py @@ -488,9 +488,9 @@ def test_forcing(self): for key_forced in ("vt_fft", "rotz_fft", "divh_fft"): params.time_stepping.t_end += 0.2 - params.forcing.key_forced = ( - sim.forcing.forcing_maker.key_forced - ) = key_forced + params.forcing.key_forced = sim.forcing.forcing_maker.key_forced = ( + key_forced + ) sim.time_stepping.init_from_params() sim.time_stepping.main_loop() diff --git a/fluidsim/solvers/plate2d/test_solver.py b/fluidsim/solvers/plate2d/test_solver.py index 32d922124..5f9d178f9 100644 --- a/fluidsim/solvers/plate2d/test_solver.py +++ b/fluidsim/solvers/plate2d/test_solver.py @@ -84,9 +84,7 @@ def init_params(cls): params.forcing.nkmin_forcing = 2 params.forcing.tcrandom.time_correlation = 100 * deltat - params.nu_8 = ( - 2e1 * params.forcing.forcing_rate ** (1.0 / 3) * delta_x**8 - ) + params.nu_8 = 2e1 * params.forcing.forcing_rate ** (1.0 / 3) * delta_x**8 params.output.HAS_TO_SAVE = True params.output.periods_print.print_stdout = 2 * deltat diff --git a/fluidsim/solvers/sphere/sw1l/solver.py b/fluidsim/solvers/sphere/sw1l/solver.py index d07b2a116..fe3f90dd4 100644 --- a/fluidsim/solvers/sphere/sw1l/solver.py +++ b/fluidsim/solvers/sphere/sw1l/solver.py @@ -10,6 +10,7 @@ :private-members: """ + from transonic import boost from fluidsim.base.sphericalharmo.solver import ( InfoSolverSphericalHarmo, diff --git a/fluidsim/solvers/sphere/sw1l/state.py b/fluidsim/solvers/sphere/sw1l/state.py index c73106266..5e8a7ed79 100644 --- a/fluidsim/solvers/sphere/sw1l/state.py +++ b/fluidsim/solvers/sphere/sw1l/state.py @@ -8,6 +8,7 @@ :private-members: """ + from fluidsim.base.state import StatePseudoSpectral from fluidsim.base.setofvariables import SetOfVariables diff --git a/fluidsim/solvers/waves2d/solver.py b/fluidsim/solvers/waves2d/solver.py index be988aaf7..3475b8a38 100644 --- a/fluidsim/solvers/waves2d/solver.py +++ b/fluidsim/solvers/waves2d/solver.py @@ -90,6 +90,7 @@ class Simul(SimulBasePseudoSpectral): """ + InfoSolver = InfoSolverWaves2d @staticmethod diff --git a/fluidsim/util/console/__main__.py b/fluidsim/util/console/__main__.py index 7fce07fab..209354d81 100644 --- a/fluidsim/util/console/__main__.py +++ b/fluidsim/util/console/__main__.py @@ -2,6 +2,7 @@ =========================================================================== """ + import argparse from fluidsim import __version__, get_local_version from . import bench, bench_analysis, profile diff --git a/fluidsim/util/console/bench_analysis.py b/fluidsim/util/console/bench_analysis.py index 59c5b7f0a..cc09a80af 100644 --- a/fluidsim/util/console/bench_analysis.py +++ b/fluidsim/util/console/bench_analysis.py @@ -2,6 +2,7 @@ ========================================================================= """ + import os from glob import glob import json diff --git a/fluidsim/util/console/test_bench.py b/fluidsim/util/console/test_bench.py index 5cb836288..ae0eaf37c 100644 --- a/fluidsim/util/console/test_bench.py +++ b/fluidsim/util/console/test_bench.py @@ -2,6 +2,7 @@ ============================================================== """ + import unittest from shutil import rmtree import sys diff --git a/fluidsim/util/console/util.py b/fluidsim/util/console/util.py index c166186c9..03ca628d2 100644 --- a/fluidsim/util/console/util.py +++ b/fluidsim/util/console/util.py @@ -2,6 +2,7 @@ ============================================================================= """ + import os from time import time from pathlib import Path diff --git a/fluidsim/util/testing.py b/fluidsim/util/testing.py index 2a00afbeb..7aaef6731 100644 --- a/fluidsim/util/testing.py +++ b/fluidsim/util/testing.py @@ -8,6 +8,7 @@ for eg. when it is installed through `pip`. """ + import argparse import inspect import os @@ -118,9 +119,10 @@ class TestSimulConserve(TestSimul): @classmethod def setUpClass(cls): cls.init_params() - with stdout_redirected(cls.has_to_redirect_stdout), cls.Simul( - cls.params - ) as sim: + with ( + stdout_redirected(cls.has_to_redirect_stdout), + cls.Simul(cls.params) as sim, + ): cls.sim = sim sim.time_stepping.start() diff --git a/lib/fluidsim_core/__init__.py b/lib/fluidsim_core/__init__.py index 87d2265ac..e59f9725c 100644 --- a/lib/fluidsim_core/__init__.py +++ b/lib/fluidsim_core/__init__.py @@ -17,4 +17,5 @@ paths """ + from ._version import __version__ diff --git a/lib/fluidsim_core/info.py b/lib/fluidsim_core/info.py index 65a03bba4..930bc9083 100644 --- a/lib/fluidsim_core/info.py +++ b/lib/fluidsim_core/info.py @@ -10,6 +10,7 @@ :private-members: """ + from fluiddyn.util import import_class from fluiddyn.util.paramcontainer import ParamContainer diff --git a/lib/fluidsim_core/loader.py b/lib/fluidsim_core/loader.py index 516b37b8a..661848e0c 100644 --- a/lib/fluidsim_core/loader.py +++ b/lib/fluidsim_core/loader.py @@ -5,6 +5,7 @@ .. autofunction:: import_cls_simul """ + import sys if sys.version_info[:2] < (3, 10): diff --git a/lib/fluidsim_core/magic.py b/lib/fluidsim_core/magic.py index f97cdbba9..ecbfafefd 100644 --- a/lib/fluidsim_core/magic.py +++ b/lib/fluidsim_core/magic.py @@ -5,6 +5,7 @@ :private-members: """ + from pprint import pprint from fluiddyn.io.query import query_yes_no diff --git a/lib/fluidsim_core/output/base.py b/lib/fluidsim_core/output/base.py index 7b4f05c54..e087fc0ed 100644 --- a/lib/fluidsim_core/output/base.py +++ b/lib/fluidsim_core/output/base.py @@ -10,6 +10,7 @@ :special-members: __init__ """ + from abc import ABC, abstractmethod, abstractstaticmethod from pathlib import Path from time import sleep diff --git a/lib/fluidsim_core/output/phys_fields_snek5000.py b/lib/fluidsim_core/output/phys_fields_snek5000.py index 9cefb2e16..221086e54 100644 --- a/lib/fluidsim_core/output/phys_fields_snek5000.py +++ b/lib/fluidsim_core/output/phys_fields_snek5000.py @@ -7,6 +7,7 @@ :undoc-members: """ + from functools import lru_cache, partial from fluidsim_core.output.phys_fields import PhysFieldsABC diff --git a/lib/fluidsim_core/output/remaining_clock_time.py b/lib/fluidsim_core/output/remaining_clock_time.py index c60e38cbc..4d88e9e0e 100644 --- a/lib/fluidsim_core/output/remaining_clock_time.py +++ b/lib/fluidsim_core/output/remaining_clock_time.py @@ -8,6 +8,7 @@ :undoc-members: """ + from abc import ABCMeta, abstractmethod from datetime import timedelta diff --git a/lib/fluidsim_core/params.py b/lib/fluidsim_core/params.py index 4f322cee1..3f24011de 100644 --- a/lib/fluidsim_core/params.py +++ b/lib/fluidsim_core/params.py @@ -7,6 +7,7 @@ :private-members: """ + from pathlib import Path from typing import Iterable diff --git a/lib/fluidsim_core/scripts/__init__.py b/lib/fluidsim_core/scripts/__init__.py index 93cbe1de1..66c120a48 100644 --- a/lib/fluidsim_core/scripts/__init__.py +++ b/lib/fluidsim_core/scripts/__init__.py @@ -10,6 +10,7 @@ .. autofunction:: parse_args """ + import shlex from fluiddyn.util import mpi diff --git a/lib/fluidsim_core/solver.py b/lib/fluidsim_core/solver.py index e292de6d4..aea90e5d5 100644 --- a/lib/fluidsim_core/solver.py +++ b/lib/fluidsim_core/solver.py @@ -4,6 +4,7 @@ :members: _complete_params_with_default, create_default_params, __init__ """ + from abc import ABC, abstractclassmethod, abstractmethod, abstractstaticmethod from .info import InfoSolverCore, create_info_simul diff --git a/scripts/bugs/memory_leak_sw1l.py b/scripts/bugs/memory_leak_sw1l.py index 66954602a..86533e724 100644 --- a/scripts/bugs/memory_leak_sw1l.py +++ b/scripts/bugs/memory_leak_sw1l.py @@ -11,6 +11,7 @@ mpirun -np 2 python memory_leak_sw1l.py """ + from fluidsim.solvers.sw1l.onlywaves.solver import Simul params = Simul.create_default_params() diff --git a/scripts/ns2d.strat/compute_anisotropy.py b/scripts/ns2d.strat/compute_anisotropy.py index 384b4f4de..ae0c765c3 100644 --- a/scripts/ns2d.strat/compute_anisotropy.py +++ b/scripts/ns2d.strat/compute_anisotropy.py @@ -6,6 +6,7 @@ Function to compute the anisotropy of a simulation. """ + from glob import glob import h5py diff --git a/scripts/ns2d.strat/compute_flow_features.py b/scripts/ns2d.strat/compute_flow_features.py index 005807ce3..a6c3e7fb5 100644 --- a/scripts/ns2d.strat/compute_flow_features.py +++ b/scripts/ns2d.strat/compute_flow_features.py @@ -4,6 +4,7 @@ 28/09/2018 """ + import os import numpy as np import h5py diff --git a/scripts/ns2d.strat/make_table_parameters.py b/scripts/ns2d.strat/make_table_parameters.py index b025833d6..5e90ab429 100644 --- a/scripts/ns2d.strat/make_table_parameters.py +++ b/scripts/ns2d.strat/make_table_parameters.py @@ -4,6 +4,7 @@ 28/09/2018 """ + import os import h5py import numpy as np diff --git a/scripts/ns2d.strat/make_video_spectrum_kykx.py b/scripts/ns2d.strat/make_video_spectrum_kykx.py index 401874a12..7a28bd42a 100644 --- a/scripts/ns2d.strat/make_video_spectrum_kykx.py +++ b/scripts/ns2d.strat/make_video_spectrum_kykx.py @@ -7,6 +7,7 @@ The two keys plotted are ap_fft and am_fft """ + from pathlib import Path import h5py diff --git a/scripts/ns2d.strat/plot_buoyancy_reynolds_anisotropy.py b/scripts/ns2d.strat/plot_buoyancy_reynolds_anisotropy.py index d26c0f3ce..b12903f92 100644 --- a/scripts/ns2d.strat/plot_buoyancy_reynolds_anisotropy.py +++ b/scripts/ns2d.strat/plot_buoyancy_reynolds_anisotropy.py @@ -5,6 +5,7 @@ Plots the buoyancy reynolds Vs anisotropy. """ + import os import numpy as np import matplotlib.pyplot as plt diff --git a/scripts/ns2d.strat/plot_buoyancy_reynolds_dissipation.py b/scripts/ns2d.strat/plot_buoyancy_reynolds_dissipation.py index e9e766a0f..831b1bc14 100644 --- a/scripts/ns2d.strat/plot_buoyancy_reynolds_dissipation.py +++ b/scripts/ns2d.strat/plot_buoyancy_reynolds_dissipation.py @@ -5,6 +5,7 @@ Plots the buoyancy reynolds Vs dissipation. """ + import os import numpy as np import matplotlib.pyplot as plt diff --git a/scripts/ns2d.strat/plot_buoyancy_reynolds_froude.py b/scripts/ns2d.strat/plot_buoyancy_reynolds_froude.py index 053c08415..3432e8b94 100644 --- a/scripts/ns2d.strat/plot_buoyancy_reynolds_froude.py +++ b/scripts/ns2d.strat/plot_buoyancy_reynolds_froude.py @@ -2,6 +2,7 @@ plot_buoyancy_reynolds_froude.py ================================= """ + import os import numpy as np import matplotlib.pyplot as plt diff --git a/scripts/ns2d.strat/plot_froude_anisotropy.py b/scripts/ns2d.strat/plot_froude_anisotropy.py index f1ddbda69..72c378a0f 100644 --- a/scripts/ns2d.strat/plot_froude_anisotropy.py +++ b/scripts/ns2d.strat/plot_froude_anisotropy.py @@ -5,6 +5,7 @@ Plots the buoyancy reynolds Vs anisotropy. """ + import os import numpy as np import matplotlib.pyplot as plt diff --git a/scripts/ns2d.strat/plot_froude_dissipation.py b/scripts/ns2d.strat/plot_froude_dissipation.py index f43cd4121..096fcb203 100644 --- a/scripts/ns2d.strat/plot_froude_dissipation.py +++ b/scripts/ns2d.strat/plot_froude_dissipation.py @@ -5,6 +5,7 @@ Plots the horizontal froude Vs dissipation. """ + import os import numpy as np import matplotlib.pyplot as plt diff --git a/scripts/ns2d.strat/plot_length_scales.py b/scripts/ns2d.strat/plot_length_scales.py index f295c8d67..348d621f2 100644 --- a/scripts/ns2d.strat/plot_length_scales.py +++ b/scripts/ns2d.strat/plot_length_scales.py @@ -3,6 +3,7 @@ ======================= """ + import os import numpy as np import h5py diff --git a/scripts/ns2d.strat/simul_from_state.py b/scripts/ns2d.strat/simul_from_state.py index cf858213d..6c5aa3a31 100644 --- a/scripts/ns2d.strat/simul_from_state.py +++ b/scripts/ns2d.strat/simul_from_state.py @@ -3,7 +3,6 @@ =================== """ - import os from glob import glob import argparse diff --git a/scripts/ns2d.strat/submit_simul_from_state.py b/scripts/ns2d.strat/submit_simul_from_state.py index 04150c864..a6e6d626c 100644 --- a/scripts/ns2d.strat/submit_simul_from_state.py +++ b/scripts/ns2d.strat/submit_simul_from_state.py @@ -2,6 +2,7 @@ submit_simul_from_state.py ========================== """ + import argparse from fluiddyn.clusters.legi import Calcul diff --git a/scripts/plot_results/plot_interm.py b/scripts/plot_results/plot_interm.py index 4a22cddf0..58a19540d 100644 --- a/scripts/plot_results/plot_interm.py +++ b/scripts/plot_results/plot_interm.py @@ -143,7 +143,7 @@ def expo_from_order(order, PLOT=False, PLOT_PDF=False): leg1 = ax1.legend( [l_smooth[0], l_K41[0], l_1[0]], ["smooth $r^q$", "K41 $r^{q/3}$", "shocks $r^1$"], - loc=0 + loc=0, # labelspacing = 0.2 ) diff --git a/scripts/sphere.sw1l/galewsky2004.py b/scripts/sphere.sw1l/galewsky2004.py index 75eb7db09..d3f82c208 100644 --- a/scripts/sphere.sw1l/galewsky2004.py +++ b/scripts/sphere.sw1l/galewsky2004.py @@ -18,6 +18,7 @@ "Spectral Transform Solutions to the Shallow Water Test Set" """ + import numpy as np from scipy import integrate from fluidsim.solvers.sphere.sw1l.solver import Simul