Skip to content

Commit

Permalink
Apply Xylar's suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
cbegeman committed Nov 12, 2024
1 parent e45063f commit f56f1f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions polaris/ocean/tasks/barotropic_gyre/forward.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import time
from math import ceil
from math import floor, ceil

from polaris.mesh.planar import compute_planar_hex_nx_ny
from polaris.ocean.model import OceanModelStep, get_time_interval_string
Expand Down Expand Up @@ -124,7 +124,7 @@ def dynamic_model_config(self, at_setup):
rho_0 = config.getfloat("barotropic_gyre", "rho_0")

dt_max = compute_max_time_step(config)
dt = dt_max / 3.
dt = floor(dt_max / 3.)
dt_str = get_time_interval_string(seconds=dt)

options = {'config_dt': dt_str,
Expand Down
6 changes: 3 additions & 3 deletions polaris/ocean/tasks/barotropic_gyre/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ def setup(self):
nu_2 = config.getfloat("barotropic_gyre", "nu_2")

# calculate the boundary layer thickness for specified parameters
M = (np.pi * 2) / np.sqrt(3) * (nu_2 / beta)**(1. / 3.)
m = (np.pi * 2) / np.sqrt(3) * (nu_2 / beta)**(1. / 3.)
# ensure the boundary layer is at least 3 gridcells wide
if M >= 3. * resolution * 1.e3:
if m >= 3. * resolution * 1.e3:
raise ValueError(f"Resolution {resolution} km is too coarse to "
"properly resolve the lateral boundary layer "
f"with anticipated width of {(M * 1e-3):03g} km")
f"with anticipated width of {(m * 1e-3):03g} km")

# check whether viscosity suitable for stability
stability_parameter_max = 0.6
Expand Down

0 comments on commit f56f1f6

Please sign in to comment.