Skip to content

Commit

Permalink
Black :-)
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Jan 29, 2024
1 parent df18aae commit cc48054
Show file tree
Hide file tree
Showing 81 changed files with 108 additions and 65 deletions.
1 change: 0 additions & 1 deletion bench/profiling/simul_profile2d_vmprof.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""


from simul_profile2d import sim

sim.time_stepping.start()
3 changes: 2 additions & 1 deletion bench/spectraldns/bench_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions bench/spectraldns/bench_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion bench/spectraldns/profile_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"""

import time
import numpy as np

Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions bench/spectraldns/profile_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions doc/examples/simul_ns2dbouss_initfields_in_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The field initialization is done in the script.
"""

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions doc/examples/simul_ns2dstrat_forcing_const_energy_rate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Script for a short simulation with the solver ns2d.strat
"""

import numpy as np

from fluiddyn.util import mpi
Expand Down
1 change: 1 addition & 0 deletions doc/examples/simul_ns2dstrat_forcing_in_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Note how is used the user-defined forcing maker...
"""

from math import pi
import os

Expand Down
1 change: 1 addition & 0 deletions doc/examples/simul_ns2dstrat_initfields_in_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The field initialization is done in the script.
"""

import os
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions doc/examples/simul_ns3dbouss_initfields_in_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
mpirun -np 4 python simul_ns3dbouss_initfields_in_script.py
"""

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions doc/examples/simul_ns3dstrat_waves.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
mpirun -np 4 python simul_ns3dstrat_waves.py
"""

import os
from math import pi

Expand Down
1 change: 1 addition & 0 deletions doc/examples/time_stepping/3d/run_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
```
"""

from pathlib import Path
import sys

Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/forcing/kolmogorov.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:private-members:
"""

from warnings import warn

import numpy as np
Expand Down
6 changes: 3 additions & 3 deletions fluidsim/base/output/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion fluidsim/base/output/cross_corr3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"""


import itertools

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/output/horiz_means.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:undoc-members:
"""

import numpy as np
import h5py
import matplotlib.pyplot as plt
Expand Down
8 changes: 2 additions & 6 deletions fluidsim/base/output/spatiotemporal_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion fluidsim/base/output/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""


import os

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion fluidsim/base/output/spectra3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"""


import os
from textwrap import dedent
from math import sqrt, tau
Expand Down
16 changes: 7 additions & 9 deletions fluidsim/base/output/time_signals_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

from fluidsim_core.params import Parameters
from fluidsim.base.solvers.info_base import InfoSolverBase

Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/preprocess/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:private-members:
"""

from fluidsim_core.params import iter_complete_params


Expand Down
4 changes: 1 addition & 3 deletions fluidsim/base/preprocess/pseudo_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/solvers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:private-members:
"""

from time import time
import atexit
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/solvers/info_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:private-members:
"""

from copy import deepcopy

from fluidsim_core.info import InfoSolverCore, create_info_simul # noqa
Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/time_stepping/pseudo_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19810022965.pdf).
"""

from random import randint

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions fluidsim/base/turb_model/smagorinsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 1 addition & 3 deletions fluidsim/base/turb_model/stress_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
1 change: 1 addition & 0 deletions fluidsim/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions fluidsim/operators/sphericalharmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import numpy as np

from pyshtools.constants import Earth
Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
pkgload
"""

import numpy as _np
from warnings import warn as _warn

Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/ad1d/init_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:members:
"""

import numpy as np

from fluidsim.base.init_fields import InitFieldsBase, SpecificInitFields
Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/ad1d/pseudo_spect/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

from fluidsim.base.setofvariables import SetOfVariables
from fluidsim.base.solvers.pseudo_spect import (
SimulBasePseudoSpectral,
Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/ad1d/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Simul(SimulBase):
constant velocity.
"""

InfoSolver = InfoSolverAD1D

@staticmethod
Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/burgers1d/skew_sym/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

from fluidsim.base.setofvariables import SetOfVariables
from ..solver import Simul as SimulBurgers, InfoSolver as InfoSolverBurgers

Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/burgers1d/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

from fluidsim.base.setofvariables import SetOfVariables
from fluidsim.base.solvers.pseudo_spect import (
SimulBasePseudoSpectral,
Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/nl1d/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:private-members:
"""

import numpy as np

from fluidsim.base.setofvariables import SetOfVariables
Expand Down
1 change: 1 addition & 0 deletions fluidsim/solvers/ns2d/bouss/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:private-members:
"""

import numpy as np

from transonic import boost, Array
Expand Down
1 change: 0 additions & 1 deletion fluidsim/solvers/ns2d/strat/forcing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class ForcingNS2DStrat(ForcingNS2D):

"""Forcing class for the ns2d strat solver.
.. inheritance-diagram:: ForcingNS2DStrat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = (
Expand Down
Loading

0 comments on commit cc48054

Please sign in to comment.