1.0 where b >= cutoff (ocean), 0.0 elsewhere (land).
Default (absent land_cutoff): cutoff = LAND_DEPTH_THRESHOLD
(byte-identical to the pre-v2 path). When land_cutoff is
present, a column is land iff b < land_cutoff; the wetdry-aware
seed passes land_cutoff = -land_margin so intertidal columns
(bed above rest MSL but below the flood headroom) stay wet_mask=1
and the dynamic wd_wet_dyn gate handles their wetting/drying.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(inout) | :: | wet_mask(:,:) | |||
| real(kind=wp), | intent(in) | :: | b(:,:) | |||
| real(kind=wp), | intent(in), | optional | :: | land_cutoff |
When present, a column is land iff |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | cutoff | ||||
| integer, | private | :: | i | ||||
| integer, | private | :: | j | ||||
| integer, | private | :: | nx | ||||
| integer, | private | :: | ny |
pure subroutine seed_wet_mask_impl(wet_mask, b, land_cutoff) !! 1.0 where `b >= cutoff` (ocean), 0.0 elsewhere (land). !! Default (absent `land_cutoff`): `cutoff = LAND_DEPTH_THRESHOLD` !! (byte-identical to the pre-v2 path). When `land_cutoff` is !! present, a column is land iff `b < land_cutoff`; the wetdry-aware !! seed passes `land_cutoff = -land_margin` so intertidal columns !! (bed above rest MSL but below the flood headroom) stay wet_mask=1 !! and the dynamic wd_wet_dyn gate handles their wetting/drying. ! assumed-shape-ok: init routine called once at startup; size(b,1/2) used ! to derive loop bounds. real(wp), intent(inout) :: wet_mask(:, :) real(wp), intent(in) :: b(:, :) ! assumed-shape-ok: init routine; size(b,1/2) derives loop bounds real(wp), intent(in), optional :: land_cutoff !! When present, a column is land iff `b < land_cutoff` (used by !! the wetdry-aware seed: land_cutoff = -land_margin lets intertidal !! columns near/above rest MSL stay wet_mask=1). Absent ⇒ the default !! `b >= LAND_DEPTH_THRESHOLD` ocean test (byte-identical). integer :: i, j, nx, ny real(wp) :: cutoff nx = size(b, 1) ny = size(b, 2) cutoff = LAND_DEPTH_THRESHOLD if (present(land_cutoff)) cutoff = land_cutoff ! Plain host loop ON PURPOSE: this runs BEFORE enter_data, so a ! do concurrent here makes -stdpar=gpu implicitly round-trip the ! (unmapped) arrays through the device per loop — measured 36.9 s ! of ic_seed at 5.3M cells. Setup-only code seeds on the host; ! enter_data then maps the seeded values once. do j = 1, ny do i = 1, nx if (b(i, j) >= cutoff) then wet_mask(i, j) = 1.0_wp else wet_mask(i, j) = 0.0_wp end if end do end do end subroutine seed_wet_mask_impl