cavity_draft_is_finite_nonneg Function

public pure function cavity_draft_is_finite_nonneg(z_draft, nx, ny) result(ok)

Configure-time guard: every draft entry is finite and >= 0.

The >= 0 test is written as .not. (z >= 0) so a NaN FAILS it: every comparison with NaN is false, so the naive z < 0 test would wave a NaN straight through — the same trap the NaN-laundering clamp gotcha describes, in its cheap form.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: z_draft(nx,ny)
integer, intent(in) :: nx
integer, intent(in) :: ny

Return Value logical


Called by

proc~~cavity_draft_is_finite_nonneg~~CalledByGraph proc~cavity_draft_is_finite_nonneg cavity_draft_is_finite_nonneg proc~seed_cavity_draft seed_cavity_draft proc~seed_cavity_draft->proc~cavity_draft_is_finite_nonneg 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

Variables

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

Source Code

   pure function cavity_draft_is_finite_nonneg(z_draft, nx, ny) result(ok)
      !! Configure-time guard: every draft entry is finite and `>= 0`.
      !!
      !! The `>= 0` test is written as `.not. (z >= 0)` so a NaN FAILS it:
      !! every comparison with NaN is false, so the naive `z < 0` test
      !! would wave a NaN straight through — the same trap the
      !! NaN-laundering clamp gotcha describes, in its cheap form.
      integer, intent(in) :: nx, ny
      real(wp), intent(in) :: z_draft(nx, ny)
      logical :: ok
      integer :: i, j
      ok = .true.
      do j = 1, ny
         do i = 1, nx
            if (.not. (z_draft(i, j) >= 0.0_wp)) ok = .false.
            if (.not. (z_draft(i, j) < huge(1.0_wp))) ok = .false.
         end do
      end do
   end function cavity_draft_is_finite_nonneg