Skip to content

Commit

Permalink
black, version 20.8b1
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Sep 22, 2020
1 parent d589f8d commit 130fd65
Show file tree
Hide file tree
Showing 54 changed files with 158 additions and 184 deletions.
7 changes: 2 additions & 5 deletions fluidsim/base/basilisk/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions fluidsim/base/basilisk/time_stepping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 2 additions & 5 deletions fluidsim/base/dedalus/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions fluidsim/base/dedalus/time_stepping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 2 additions & 4 deletions fluidsim/base/forcing/anisotropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class TimeCorrelatedRandomPseudoSpectralAnisotropic(

@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)
Expand All @@ -47,8 +46,7 @@ def __init__(self, sim):
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
Expand Down
6 changes: 2 additions & 4 deletions fluidsim/base/forcing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def _complete_info_solver(info_solver, classes=None):

@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={
Expand Down Expand Up @@ -189,8 +188,7 @@ def _complete_info_solver(info_solver, classes=None):

@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})
Expand Down
13 changes: 4 additions & 9 deletions fluidsim/base/forcing/specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,7 @@ class NormalizedForcing(SpecificForcingPseudoSpectralCoarse):

@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
Expand Down Expand Up @@ -790,8 +789,7 @@ class RandomSimplePseudoSpectral(NormalizedForcing):

@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:
Expand Down Expand Up @@ -835,8 +833,7 @@ class TimeCorrelatedRandomPseudoSpectral(RandomSimplePseudoSpectral):

@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:
Expand Down Expand Up @@ -882,9 +879,7 @@ def forcingc_raw_each_time(self, a_fft):
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
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/base/init_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def _complete_info_solver(info_solver, classes=None):

@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={
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/base/output/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ def _complete_info_solver(info_solver):

@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,
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/base/output/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def __init__(self, output):
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)
Expand Down
4 changes: 1 addition & 3 deletions fluidsim/base/output/phys_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@ def time_from_path(path):


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
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/base/output/phys_fields2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def __init__(self, output, phys_fields):
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

Expand Down
4 changes: 1 addition & 3 deletions fluidsim/base/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ def load_params_simul(path=None, only_mpi_rank0=True):


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()

Expand Down
3 changes: 1 addition & 2 deletions fluidsim/base/preprocess/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def _complete_info_solver(info_solver, classes=None):

@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",
Expand Down
2 changes: 1 addition & 1 deletion fluidsim/base/preprocess/pseudo_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def set_viscosity(self):
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
Expand Down
8 changes: 2 additions & 6 deletions fluidsim/base/time_stepping/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ def max_abs(arr):


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,
Expand Down
6 changes: 2 additions & 4 deletions fluidsim/base/time_stepping/finite_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
13 changes: 7 additions & 6 deletions fluidsim/base/time_stepping/pseudo_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,11 @@ def get_coefs(self):


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

Expand Down Expand Up @@ -907,7 +904,11 @@ def _time_step_RK4(self):
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(
Expand Down
4 changes: 1 addition & 3 deletions fluidsim/base/time_stepping/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def get_coefs(self):


class TimeSteppingSimple(TimeSteppingBase):
"""Time stepping class for pseudo-spectral solvers.
"""
"""Time stepping class for pseudo-spectral solvers."""

def __init__(self, sim):
super().__init__(sim)
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/operators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ def _reinit_truncation(self):
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
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/operators/op_finitediff2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions fluidsim/operators/operators0d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 2 additions & 5 deletions fluidsim/operators/operators1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/operators/operators2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ def _create_default_params(cls):

@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,
Expand Down
7 changes: 4 additions & 3 deletions fluidsim/operators/operators3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def compute_energy_from_2fields(vx: Ac, vy: Ac):

@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)

Expand Down Expand Up @@ -153,8 +155,7 @@ def _create_default_params(cls):

@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",
Expand Down
3 changes: 1 addition & 2 deletions fluidsim/solvers/ad1d/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def _complete_info_solver(info_solver):

@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"
Expand Down
Loading

0 comments on commit 130fd65

Please sign in to comment.