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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | bound_m | |||
| real(kind=wp), | intent(in) | :: | per_metre |
Grid units per metre (1 on Cartesian). |
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