porous_stats_are_ordered Function

public 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.

Arguments

Type IntentOptional 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).

Return Value logical


Called by

proc~~porous_stats_are_ordered~~CalledByGraph proc~porous_stats_are_ordered porous_stats_are_ordered proc~configure_ocean_porous configure_ocean_porous proc~configure_ocean_porous->proc~porous_stats_are_ordered proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_porous 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

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j

Source Code

   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