Convert a metres length scale (slope_scale / half_width) into the
GRID coordinate units the formula bathymetry setters operate in.
Cartesian grids carry positions in metres, so the scale passes
through unchanged. Spherical / supergrid / tripolar grids carry
positions in DEGREES, so the metres scale is converted to degrees of
latitude (meridional metres-per-degree = rad_earth · π/180). This
keeps the seamount/spoon length scale commensurate with the grid
coordinate; without it a metres scale divided by a degrees position
underflows the Gaussian/exponential and the basin collapses flat.
Zonal cells are narrower by cos(lat), so a degree-isotropic bump is
mildly elongated zonally in physical space — acceptable for these
idealised topographies; the degeneracy is what this fixes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | length_m | |||
| character(len=*), | intent(in) | :: | grid_config | |||
| real(kind=wp), | intent(in) | :: | rad_earth |
pure function topo_length_to_grid_units(length_m, grid_config, rad_earth) result(len_grid) !! Convert a metres length scale (`slope_scale` / `half_width`) into the !! GRID coordinate units the formula bathymetry setters operate in. !! Cartesian grids carry positions in metres, so the scale passes !! through unchanged. Spherical / supergrid / tripolar grids carry !! positions in DEGREES, so the metres scale is converted to degrees of !! latitude (meridional metres-per-degree = `rad_earth · π/180`). This !! keeps the seamount/spoon length scale commensurate with the grid !! coordinate; without it a metres scale divided by a degrees position !! underflows the Gaussian/exponential and the basin collapses flat. !! Zonal cells are narrower by `cos(lat)`, so a degree-isotropic bump is !! mildly elongated zonally in physical space — acceptable for these !! idealised topographies; the degeneracy is what this fixes. real(wp), intent(in) :: length_m, rad_earth character(len=*), intent(in) :: grid_config real(wp) :: len_grid select case (trim(grid_config)) case ("spherical", "supergrid", "tripolar") len_grid = length_m/(rad_earth*DEG2RAD) case default len_grid = length_m end select end function topo_length_to_grid_units