From 6594f69aa2653e56a52b3fee83dcb4cc962c3f11 Mon Sep 17 00:00:00 2001 From: Felix Koehler Date: Tue, 12 Mar 2024 08:05:08 +0100 Subject: [PATCH] Use consistent naming 'n' -> 'num' --- exponax/_base_stepper.py | 10 +++++----- exponax/etdrk/_etdrk_1.py | 4 ++-- exponax/etdrk/_etdrk_2.py | 4 ++-- exponax/etdrk/_etdrk_3.py | 4 ++-- exponax/etdrk/_etdrk_4.py | 4 ++-- exponax/normalized/_convection.py | 4 ++-- exponax/normalized/_general_nonlinear.py | 4 ++-- exponax/normalized/_gradient_norm.py | 4 ++-- exponax/normalized/_polynomial.py | 4 ++-- exponax/stepper/_burgers.py | 4 ++-- exponax/stepper/_convection.py | 4 ++-- exponax/stepper/_general_nonlinear.py | 4 ++-- exponax/stepper/_gradient_norm.py | 4 ++-- exponax/stepper/_korteweg_de_vries.py | 4 ++-- exponax/stepper/_kuramoto_sivashinsky.py | 8 ++++---- exponax/stepper/_navier_stokes.py | 8 ++++---- exponax/stepper/_nikolaevskiy.py | 8 ++++---- exponax/stepper/_polynomial.py | 4 ++-- exponax/stepper/_reaction.py | 24 ++++++++++++------------ 19 files changed, 57 insertions(+), 57 deletions(-) diff --git a/exponax/_base_stepper.py b/exponax/_base_stepper.py index eeb717a..14f261c 100644 --- a/exponax/_base_stepper.py +++ b/exponax/_base_stepper.py @@ -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 @@ -71,7 +71,7 @@ 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: @@ -79,7 +79,7 @@ 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 == 3: @@ -87,7 +87,7 @@ 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 == 4: @@ -95,7 +95,7 @@ def __init__( dt, linear_operator, nonlinear_fun, - n_circle_points=n_circle_points, + num_circle_points=num_circle_points, circle_radius=circle_radius, ) else: diff --git a/exponax/etdrk/_etdrk_1.py b/exponax/etdrk/_etdrk_1.py index e5c156b..de8215e 100644 --- a/exponax/etdrk/_etdrk_1.py +++ b/exponax/etdrk/_etdrk_1.py @@ -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 ) diff --git a/exponax/etdrk/_etdrk_2.py b/exponax/etdrk/_etdrk_2.py index 3e0ec37..45a2123 100644 --- a/exponax/etdrk/_etdrk_2.py +++ b/exponax/etdrk/_etdrk_2.py @@ -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 ) diff --git a/exponax/etdrk/_etdrk_3.py b/exponax/etdrk/_etdrk_3.py index 59f4ce7..8d1cade 100644 --- a/exponax/etdrk/_etdrk_3.py +++ b/exponax/etdrk/_etdrk_3.py @@ -21,7 +21,7 @@ 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) @@ -29,7 +29,7 @@ def __init__( 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 ) diff --git a/exponax/etdrk/_etdrk_4.py b/exponax/etdrk/_etdrk_4.py index 1406029..a5c7336 100644 --- a/exponax/etdrk/_etdrk_4.py +++ b/exponax/etdrk/_etdrk_4.py @@ -22,7 +22,7 @@ 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) @@ -30,7 +30,7 @@ def __init__( 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 ) diff --git a/exponax/normalized/_convection.py b/exponax/normalized/_convection.py index 0a78d89..3c511fd 100644 --- a/exponax/normalized/_convection.py +++ b/exponax/normalized/_convection.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/normalized/_general_nonlinear.py b/exponax/normalized/_general_nonlinear.py index dea7fab..d5233ec 100644 --- a/exponax/normalized/_general_nonlinear.py +++ b/exponax/normalized/_general_nonlinear.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/normalized/_gradient_norm.py b/exponax/normalized/_gradient_norm.py index 96883f1..d414102 100644 --- a/exponax/normalized/_gradient_norm.py +++ b/exponax/normalized/_gradient_norm.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/normalized/_polynomial.py b/exponax/normalized/_polynomial.py index feeb689..3da08dd 100644 --- a/exponax/normalized/_polynomial.py +++ b/exponax/normalized/_polynomial.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/stepper/_burgers.py b/exponax/stepper/_burgers.py index 97b0d92..2341feb 100644 --- a/exponax/stepper/_burgers.py +++ b/exponax/stepper/_burgers.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/stepper/_convection.py b/exponax/stepper/_convection.py index b2e5fe7..a7fad7b 100644 --- a/exponax/stepper/_convection.py +++ b/exponax/stepper/_convection.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/stepper/_general_nonlinear.py b/exponax/stepper/_general_nonlinear.py index 927bf9b..1c24211 100644 --- a/exponax/stepper/_general_nonlinear.py +++ b/exponax/stepper/_general_nonlinear.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/stepper/_gradient_norm.py b/exponax/stepper/_gradient_norm.py index 861249c..1afe83b 100644 --- a/exponax/stepper/_gradient_norm.py +++ b/exponax/stepper/_gradient_norm.py @@ -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, ): """ @@ -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, ) diff --git a/exponax/stepper/_korteweg_de_vries.py b/exponax/stepper/_korteweg_de_vries.py index 30785bb..6b78979 100644 --- a/exponax/stepper/_korteweg_de_vries.py +++ b/exponax/stepper/_korteweg_de_vries.py @@ -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 @@ -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, ) diff --git a/exponax/stepper/_kuramoto_sivashinsky.py b/exponax/stepper/_kuramoto_sivashinsky.py index 9a5a265..2207701 100644 --- a/exponax/stepper/_kuramoto_sivashinsky.py +++ b/exponax/stepper/_kuramoto_sivashinsky.py @@ -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, ): """ @@ -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, ) @@ -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, ): """ @@ -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, ) diff --git a/exponax/stepper/_navier_stokes.py b/exponax/stepper/_navier_stokes.py index 99a0ad9..332d1ae 100644 --- a/exponax/stepper/_navier_stokes.py +++ b/exponax/stepper/_navier_stokes.py @@ -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 @@ -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, ) @@ -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 @@ -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, ) diff --git a/exponax/stepper/_nikolaevskiy.py b/exponax/stepper/_nikolaevskiy.py index 87b187e..1b02371 100644 --- a/exponax/stepper/_nikolaevskiy.py +++ b/exponax/stepper/_nikolaevskiy.py @@ -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 @@ -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, ) @@ -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 @@ -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, ) diff --git a/exponax/stepper/_polynomial.py b/exponax/stepper/_polynomial.py index 5957d12..d65230e 100644 --- a/exponax/stepper/_polynomial.py +++ b/exponax/stepper/_polynomial.py @@ -21,7 +21,7 @@ def __init__( polynomial_scales: list[float] = [0.0, 0.0, 10.0], order=2, dealiasing_fraction: float = 2 / 3, - n_circle_points: int = 16, + num_circle_points: int = 16, circle_radius: float = 1.0, ): """ @@ -42,7 +42,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, ) diff --git a/exponax/stepper/_reaction.py b/exponax/stepper/_reaction.py index 25904f6..45c0047 100644 --- a/exponax/stepper/_reaction.py +++ b/exponax/stepper/_reaction.py @@ -28,7 +28,7 @@ def __init__( order: int = 2, dealiasing_fraction: float = 1 / 2, # Needs lower value due to cubic nonlinearity - n_circle_points: int = 16, + num_circle_points: int = 16, circle_radius: float = 1.0, ): self.g = g @@ -41,7 +41,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, ) @@ -88,7 +88,7 @@ def __init__( order: int = 2, dealiasing_fraction: float = 1 / 2, # Needs lower value due to cubic nonlinearity - n_circle_points: int = 16, + num_circle_points: int = 16, circle_radius: float = 1.0, ): self.epsilon_1 = epsilon_1 @@ -103,7 +103,7 @@ def __init__( dt=dt, num_channels=2, order=order, - n_circle_points=n_circle_points, + num_circle_points=num_circle_points, circle_radius=circle_radius, ) @@ -152,7 +152,7 @@ def __init__( order: int = 2, r=1.0, dealiasing_fraction: float = 2 / 3, - n_circle_points: int = 16, + num_circle_points: int = 16, circle_radius: float = 1.0, ): self.dealiasing_fraction = dealiasing_fraction @@ -164,7 +164,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, ) @@ -203,7 +203,7 @@ def __init__( order: int = 2, dealiasing_fraction: float = 1 / 2, # Needs lower value due to cubic nonlinearity - n_circle_points: int = 16, + num_circle_points: int = 16, circle_radius: float = 1.0, ): self.dealiasing_fraction = dealiasing_fraction @@ -214,7 +214,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, ) @@ -255,7 +255,7 @@ def __init__( order: int = 2, dealiasing_fraction: float = 1 / 2, # Needs lower value due to cubic nonlinearity - n_circle_points: int = 16, + num_circle_points: int = 16, circle_radius: float = 1.0, ): self.hyper_diffusivity = hyper_diffusivity @@ -267,7 +267,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, ) @@ -308,7 +308,7 @@ def __init__( order: int = 2, dealiasing_fraction: float = 1 / 2, # Needs lower value due to cubic nonlinearity - n_circle_points: int = 16, + num_circle_points: int = 16, circle_radius: float = 1.0, ): self.diffusivities = diffusivities @@ -320,7 +320,7 @@ def __init__( dt=dt, num_channels=3, order=order, - n_circle_points=n_circle_points, + num_circle_points=num_circle_points, circle_radius=circle_radius, )