pure subroutine apply_surface_restore_2d_cover_impl(hTr, budget, h_layer, &
wet_mask, cover_frac, dt_piston, &
tgt, h_min, nz, nx, ny)
!! Ice-shelf-cover twin of `apply_surface_restore_2d_impl`: the
!! open-water factor `1 - cover_frac` composes multiplicatively
!! with `wet_mask`, so a covered column receives EXACTLY zero
!! restoring — and, because the same factor multiplies the budget
!! mirror, exactly zero restoring shows up in the heat/salt
!! surface budget there too. Separate `_impl`, not an in-loop
!! `present()` test (house idiom).
integer, intent(in) :: nz, nx, ny
real(wp), intent(inout) :: hTr(nx, ny, nz)
real(wp), intent(inout) :: budget(nx, ny, nz)
real(wp), intent(in) :: h_layer(nx, ny, nz)
real(wp), intent(in) :: wet_mask(nx, ny)
real(wp), intent(in) :: cover_frac(nx, ny)
real(wp), intent(in) :: dt_piston, tgt, h_min
integer :: i, j
real(wp) :: surf, inc
do concurrent(j=1:ny, i=1:nx) local(surf, inc)
! vanished-ok: surface restoring measures the surface concentration against a
! CALLER-supplied floor `h_min` (a restoring depth), not the
! vanish marker; zero would restore toward a fictitious fresh sea.
surf = hTr(i, j, nz)/max(h_layer(i, j, nz), h_min)
inc = dt_piston*(tgt - surf)*wet_mask(i, j)*(1.0_wp - cover_frac(i, j))
hTr(i, j, nz) = hTr(i, j, nz) + inc
budget(i, j, nz) = budget(i, j, nz) + inc
end do
end subroutine apply_surface_restore_2d_cover_impl