.true. iff every face satisfies d_min <= d_avg <= d_max, the
invariant the whole fit rests on (m = (d_avg-d_min)/(d_max-d_min)
must lie in [0,1]).
porous_fill_stats_resolved cannot violate it — d_avg is a
convex combination of the same three samples d_min/d_max
bracket. A FILE-backed source can, so this is the assertion the
reader boundary owes: configure_ocean_porous calls it after
filling, whichever source produced the numbers, and fails loud.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n1 |
Face-array extents. |
||
| integer, | intent(in) | :: | n2 |
Face-array extents. |
||
| real(kind=wp), | intent(in) | :: | dmin(n1,n2) |
Along-face deepest / shallowest / mean height (m, positive up). |
||
| real(kind=wp), | intent(in) | :: | dmax(n1,n2) |
Along-face deepest / shallowest / mean height (m, positive up). |
||
| real(kind=wp), | intent(in) | :: | davg(n1,n2) |
Along-face deepest / shallowest / mean height (m, positive up). |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | j |
pure function porous_stats_are_ordered(n1, n2, dmin, dmax, davg) result(ok) !! `.true.` iff every face satisfies `d_min <= d_avg <= d_max`, the !! invariant the whole fit rests on (`m = (d_avg-d_min)/(d_max-d_min)` !! must lie in `[0,1]`). !! !! `porous_fill_stats_resolved` cannot violate it — `d_avg` is a !! convex combination of the same three samples `d_min`/`d_max` !! bracket. A FILE-backed source can, so this is the assertion the !! reader boundary owes: `configure_ocean_porous` calls it after !! filling, whichever source produced the numbers, and fails loud. integer, intent(in) :: n1, n2 !! Face-array extents. real(wp), intent(in) :: dmin(n1, n2), dmax(n1, n2), davg(n1, n2) !! Along-face deepest / shallowest / mean height (m, positive up). logical :: ok integer :: i, j ok = .true. do j = 1, n2 do i = 1, n1 if (davg(i, j) < dmin(i, j) .or. davg(i, j) > dmax(i, j)) then ok = .false. return end if end do end do end function porous_stats_are_ordered