cavity_bound_to_grid Function

private pure function cavity_bound_to_grid(bound_m, per_metre) result(bound_grid)

Convert ONE shelf-box bound from metres to grid coordinate units, leaving the CAVITY_BOUND_INF “no limit” sentinel alone. Without the guard the sentinel would be scaled by the degrees-per-metre factor on a spherical grid and come out as a finite (if absurd) bound — harmless numerically, but it would stop meaning what it says, and the next reader would have to re-derive that.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: bound_m
real(kind=wp), intent(in) :: per_metre

Grid units per metre (1 on Cartesian).

Return Value real(kind=wp)


Called by

proc~~cavity_bound_to_grid~~CalledByGraph proc~cavity_bound_to_grid cavity_bound_to_grid proc~seed_cavity_draft seed_cavity_draft proc~seed_cavity_draft->proc~cavity_bound_to_grid proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~seed_cavity_draft proc~engine_setup engine_setup proc~engine_setup->proc~ocean_state_seed_from_cfg proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Source Code

   pure function cavity_bound_to_grid(bound_m, per_metre) result(bound_grid)
      !! Convert ONE shelf-box bound from metres to grid coordinate units,
      !! leaving the `CAVITY_BOUND_INF` "no limit" sentinel alone.  Without
      !! the guard the sentinel would be scaled by the degrees-per-metre
      !! factor on a spherical grid and come out as a finite (if absurd)
      !! bound — harmless numerically, but it would stop meaning what it
      !! says, and the next reader would have to re-derive that.
      real(wp), intent(in) :: bound_m
      real(wp), intent(in) :: per_metre
         !! Grid units per metre (1 on Cartesian).
      real(wp) :: bound_grid
      if (abs(bound_m) >= CAVITY_BOUND_INF) then
         bound_grid = bound_m
      else
         bound_grid = bound_m*per_metre
      end if
   end function cavity_bound_to_grid