diff --git a/pyro/compressible/simulation.py b/pyro/compressible/simulation.py index d0bcd6a5a..7b75c573b 100644 --- a/pyro/compressible/simulation.py +++ b/pyro/compressible/simulation.py @@ -99,7 +99,7 @@ class Simulation(NullSimulation): """ - def initialize(self, extra_vars=None, ng=4): + def initialize(self, *, extra_vars=None, ng=4): """ Initialize the grid and variables for compressible flow and set the initial conditions for the chosen problem. diff --git a/pyro/compressible_fv4/simulation.py b/pyro/compressible_fv4/simulation.py index dc5afcbfb..a88d64696 100644 --- a/pyro/compressible_fv4/simulation.py +++ b/pyro/compressible_fv4/simulation.py @@ -5,10 +5,11 @@ class Simulation(compressible_rk.Simulation): - def __init__(self, solver_name, problem_name, rp, timers=None, data_class=fv.FV2d): + def __init__(self, solver_name, problem_name, rp, *, + timers=None, data_class=fv.FV2d): super().__init__(solver_name, problem_name, rp, timers=timers, data_class=data_class) - def initialize(self, extra_vars=None, ng=5): + def initialize(self, *, extra_vars=None, ng=5): super().initialize(extra_vars=extra_vars, ng=ng) def substep(self, myd): diff --git a/pyro/compressible_react/simulation.py b/pyro/compressible_react/simulation.py index 6abaecfa2..0648a0c34 100644 --- a/pyro/compressible_react/simulation.py +++ b/pyro/compressible_react/simulation.py @@ -8,7 +8,7 @@ class Simulation(compressible.Simulation): - def initialize(self, extra_vars=None, ng=4): + def initialize(self, *, extra_vars=None, ng=4): """ For the reacting compressible solver, our initialization of the data is the same as the compressible solver, but we diff --git a/pyro/incompressible/simulation.py b/pyro/incompressible/simulation.py index 714d17835..b7ca0fb64 100644 --- a/pyro/incompressible/simulation.py +++ b/pyro/incompressible/simulation.py @@ -15,7 +15,7 @@ class Simulation(burgers_simulation): - def initialize(self, other_bc=False, aux_vars=()): + def initialize(self, *, other_bc=False, aux_vars=()): """ Initialize the grid and variables for incompressible flow and set the initial conditions for the chosen problem. diff --git a/pyro/lm_atm/simulation.py b/pyro/lm_atm/simulation.py index eb09b10fe..cf0a23c86 100644 --- a/pyro/lm_atm/simulation.py +++ b/pyro/lm_atm/simulation.py @@ -12,7 +12,7 @@ class Basestate: - def __init__(self, ny, ng=0): + def __init__(self, ny, *, ng=0): self.ny = ny self.ng = ng self.qy = ny + 2*ng @@ -37,7 +37,7 @@ def jp(self, shift, buf=0): class Simulation(NullSimulation): - def __init__(self, solver_name, problem_name, rp, timers=None): + def __init__(self, solver_name, problem_name, rp, *, timers=None): NullSimulation.__init__(self, solver_name, problem_name, rp, timers=timers) diff --git a/pyro/mesh/boundary.py b/pyro/mesh/boundary.py index a63482f35..84551e693 100644 --- a/pyro/mesh/boundary.py +++ b/pyro/mesh/boundary.py @@ -75,7 +75,7 @@ class BC: """ - def __init__(self, + def __init__(self, *, xlb="outflow", xrb="outflow", ylb="outflow", yrb="outflow", xl_func=None, xr_func=None, diff --git a/pyro/mesh/patch.py b/pyro/mesh/patch.py index 1b5d6997b..dcb9aafbb 100644 --- a/pyro/mesh/patch.py +++ b/pyro/mesh/patch.py @@ -59,7 +59,7 @@ class Grid2d: # pylint: disable=too-many-instance-attributes - def __init__(self, nx, ny, ng=1, + def __init__(self, nx, ny, *, ng=1, xmin=0.0, xmax=1.0, ymin=0.0, ymax=1.0): """ Create a Grid2d object. @@ -146,7 +146,7 @@ def __init__(self, nx, ny, ng=1, self.xr2d = ArrayIndexer(d=xr2d, grid=self) self.yr2d = ArrayIndexer(d=yr2d, grid=self) - def scratch_array(self, nvar=1): + def scratch_array(self, *, nvar=1): """ return a standard numpy array dimensioned to have the size and number of ghostcells as the parent grid @@ -198,10 +198,10 @@ class Cartesian2d(Grid2d): y = y """ - def __init__(self, nx, ny, ng=1, + def __init__(self, nx, ny, *, ng=1, xmin=0.0, xmax=1.0, ymin=0.0, ymax=1.0): - super().__init__(nx, ny, ng, xmin, xmax, ymin, ymax) + super().__init__(nx, ny, ng=ng, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax) self.coord_type = 0 @@ -242,7 +242,7 @@ class SphericalPolar(Grid2d): theta = y """ - def __init__(self, nx, ny, ng=1, + def __init__(self, nx, ny, *, ng=1, xmin=0.2, xmax=1.0, ymin=0.0, ymax=1.0): # Make sure theta is within [0, PI] @@ -252,7 +252,7 @@ def __init__(self, nx, ny, ng=1, assert xmin - ng*(xmax-xmin)/nx >= 0.0, \ "xmin (r-direction), must be large enough so ghost cell doesn't have negative x." - super().__init__(nx, ny, ng, xmin, xmax, ymin, ymax) + super().__init__(nx, ny, ng=ng, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax) self.coord_type = 1 @@ -332,7 +332,7 @@ class CellCenterData2d: # pylint: disable=too-many-instance-attributes - def __init__(self, grid, dtype=np.float64): + def __init__(self, grid, *, dtype=np.float64): """ Initialize the CellCenterData2d object. @@ -608,14 +608,14 @@ def fill_BC(self, name): except TypeError: bnd.ext_bcs[self.BCs[name].yrb](self.BCs[name].yrb, "yrb", name, self, self.ivars) - def min(self, name, ng=0): + def min(self, name, *, ng=0): """ return the minimum of the variable name in the domain's valid region """ n = self.names.index(name) return np.min(self.data.v(buf=ng, n=n)) - def max(self, name, ng=0): + def max(self, name, *, ng=0): """ return the maximum of the variable name in the domain's valid region """ diff --git a/pyro/pyro_sim.py b/pyro/pyro_sim.py index a92c7467e..7d265c2e3 100755 --- a/pyro/pyro_sim.py +++ b/pyro/pyro_sim.py @@ -36,7 +36,7 @@ class Pyro: The main driver to run pyro. """ - def __init__(self, solver_name, from_commandline=False): + def __init__(self, solver_name, *, from_commandline=False): """ Constructor @@ -280,12 +280,13 @@ def get_sim(self): class PyroBenchmark(Pyro): - """ - A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines. + """A subclass of Pyro for benchmarking. Inherits everything from + pyro, but adds benchmarking routines. + """ - def __init__(self, solver_name, comp_bench=False, - reset_bench_on_fail=False, make_bench=False): + def __init__(self, solver_name, *, + comp_bench=False, reset_bench_on_fail=False, make_bench=False): """ Constructor diff --git a/pyro/simulation_null.py b/pyro/simulation_null.py index 7dce37e84..c714117ab 100644 --- a/pyro/simulation_null.py +++ b/pyro/simulation_null.py @@ -102,7 +102,8 @@ def bc_setup(rp): class NullSimulation: - def __init__(self, solver_name, problem_name, rp, timers=None, data_class=patch.CellCenterData2d): + def __init__(self, solver_name, problem_name, rp, *, + timers=None, data_class=patch.CellCenterData2d): """ Initialize the Simulation object diff --git a/pyro/swe/simulation.py b/pyro/swe/simulation.py index db5327bac..a0bb073bc 100644 --- a/pyro/swe/simulation.py +++ b/pyro/swe/simulation.py @@ -93,7 +93,7 @@ class Simulation(NullSimulation): """ - def initialize(self, extra_vars=None, ng=4): + def initialize(self, *, extra_vars=None, ng=4): """ Initialize the grid and variables for swe flow and set the initial conditions for the chosen problem.