Skip to content

Commit

Permalink
Use consistent naming 'n' -> 'num'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ceyron committed Mar 12, 2024
1 parent 2628f8e commit 6594f69
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions exponax/_base_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
*,
num_channels: int,
order: int,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
self.num_spatial_dims = num_spatial_dims
Expand Down Expand Up @@ -71,31 +71,31 @@ def __init__(
dt,
linear_operator,
nonlinear_fun,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)
elif order == 2:
self._integrator = ETDRK2(
dt,
linear_operator,
nonlinear_fun,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)
elif order == 3:
self._integrator = ETDRK3(
dt,
linear_operator,
nonlinear_fun,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)
elif order == 4:
self._integrator = ETDRK4(
dt,
linear_operator,
nonlinear_fun,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)
else:
Expand Down
4 changes: 2 additions & 2 deletions exponax/etdrk/_etdrk_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def __init__(
linear_operator: Complex[Array, "E ... (N//2)+1"],
nonlinear_fun: BaseNonlinearFun,
*,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
super().__init__(dt, linear_operator)
self._nonlinear_fun = nonlinear_fun

LR = (
circle_radius * roots_of_unity(n_circle_points)
circle_radius * roots_of_unity(num_circle_points)
+ linear_operator[..., jnp.newaxis] * dt
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/etdrk/_etdrk_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ def __init__(
linear_operator: Complex[Array, "E ... (N//2)+1"],
nonlinear_fun: BaseNonlinearFun,
*,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
super().__init__(dt, linear_operator)
self._nonlinear_fun = nonlinear_fun

LR = (
circle_radius * roots_of_unity(n_circle_points)
circle_radius * roots_of_unity(num_circle_points)
+ linear_operator[..., jnp.newaxis] * dt
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/etdrk/_etdrk_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ def __init__(
linear_operator: Complex[Array, "E ... (N//2)+1"],
nonlinear_fun: BaseNonlinearFun,
*,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
super().__init__(dt, linear_operator)
self._nonlinear_fun = nonlinear_fun
self._half_exp_term = jnp.exp(0.5 * dt * linear_operator)

LR = (
circle_radius * roots_of_unity(n_circle_points)
circle_radius * roots_of_unity(num_circle_points)
+ linear_operator[..., jnp.newaxis] * dt
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/etdrk/_etdrk_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def __init__(
linear_operator: Complex[Array, "E ... (N//2)+1"],
nonlinear_fun: BaseNonlinearFun,
*,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
super().__init__(dt, linear_operator)
self._nonlinear_fun = nonlinear_fun
self._half_exp_term = jnp.exp(0.5 * dt * linear_operator)

LR = (
circle_radius * roots_of_unity(n_circle_points)
circle_radius * roots_of_unity(num_circle_points)
+ linear_operator[..., jnp.newaxis] * dt
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/normalized/_convection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(
normalized_convection_scale: float = 1.0 * 0.1,
order: int = 2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -40,7 +40,7 @@ def __init__(
dt=1.0,
num_channels=num_spatial_dims,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/normalized/_general_nonlinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(
normalized_coefficients_nonlinear: list[float] = [0.0, -1.0 * 0.1, 0.0],
order=2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -45,7 +45,7 @@ def __init__(
dt=1.0,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/normalized/_gradient_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
normalized_gradient_norm_scale: float = 1.0 * 0.1 / (60.0**2),
order: int = 2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -45,7 +45,7 @@ def __init__(
dt=1.0,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/normalized/_polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(
],
order: int = 2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -44,7 +44,7 @@ def __init__(
dt=1.0,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/stepper/_burgers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
convection_scale: float = 1.0,
order=2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand Down Expand Up @@ -72,7 +72,7 @@ def __init__(
dt=dt,
num_channels=num_spatial_dims, # Number of channels grows with dimension
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/stepper/_convection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
convection_scale: float = 1.0,
order=2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -40,7 +40,7 @@ def __init__(
dt=dt,
num_channels=num_spatial_dims,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/stepper/_general_nonlinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
coefficients_nonlinear: list[float] = [0.0, -1.0, 0.0],
order=2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -46,7 +46,7 @@ def __init__(
dt=dt,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/stepper/_gradient_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
gradient_norm_scale: float = 1.0,
order=2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -40,7 +40,7 @@ def __init__(
dt=dt,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
4 changes: 2 additions & 2 deletions exponax/stepper/_korteweg_de_vries.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(
diffusivity: float = 0.0,
order: int = 2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
self.convection_scale = convection_scale
Expand All @@ -51,7 +51,7 @@ def __init__(
dt=dt,
num_channels=num_spatial_dims,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
8 changes: 4 additions & 4 deletions exponax/stepper/_kuramoto_sivashinsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
fourth_order_diffusivity: float = 1.0,
dealiasing_fraction: float = 2 / 3,
order: int = 2,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -43,7 +43,7 @@ def __init__(
dt=dt,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down Expand Up @@ -91,7 +91,7 @@ def __init__(
fourth_order_diffusivity: float = 1.0,
dealiasing_fraction: float = 2 / 3,
order: int = 2,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
"""
Expand All @@ -110,7 +110,7 @@ def __init__(
dt=dt,
num_channels=num_spatial_dims,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
8 changes: 4 additions & 4 deletions exponax/stepper/_navier_stokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
drag: float = 0.0,
order: int = 2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
self.diffusivity = diffusivity
Expand All @@ -34,7 +34,7 @@ def __init__(
dt=dt,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down Expand Up @@ -79,7 +79,7 @@ def __init__(
injection_scale: float = 1.0,
order: int = 2,
dealiasing_fraction: float = 2 / 3,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
self.diffusivity = diffusivity
Expand All @@ -94,7 +94,7 @@ def __init__(
dt=dt,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
8 changes: 4 additions & 4 deletions exponax/stepper/_nikolaevskiy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
sixth_order_diffusivity: float = 1.0,
dealiasing_fraction: float = 2 / 3,
order: int = 2,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
self.gradient_norm_scale = gradient_norm_scale
Expand All @@ -40,7 +40,7 @@ def __init__(
dt=dt,
num_channels=1,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down Expand Up @@ -93,7 +93,7 @@ def __init__(
sixth_order_diffusivity: float = 1.0,
dealiasing_fraction: float = 2 / 3,
order: int = 2,
n_circle_points: int = 16,
num_circle_points: int = 16,
circle_radius: float = 1.0,
):
self.convection_scale = convection_scale
Expand All @@ -108,7 +108,7 @@ def __init__(
dt=dt,
num_channels=num_spatial_dims,
order=order,
n_circle_points=n_circle_points,
num_circle_points=num_circle_points,
circle_radius=circle_radius,
)

Expand Down
Loading

0 comments on commit 6594f69

Please sign in to comment.