evp_zero_massless_velocity_impl Subroutine

private pure subroutine evp_zero_massless_velocity_impl(mask_u, mask_v, mis, ui, vi, nx, ny)

SIS2 :899-907 — zero ice velocities where BOTH neighbouring cells are massless (or the face is masked/land).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: mask_u(nx+1,ny)
real(kind=wp), intent(in) :: mask_v(nx,ny+1)
real(kind=wp), intent(in) :: mis(nx,ny)
real(kind=wp), intent(inout) :: ui(nx+1,ny)
real(kind=wp), intent(inout) :: vi(nx,ny+1)
integer, intent(in) :: nx
integer, intent(in) :: ny

Calls

proc~~evp_zero_massless_velocity_impl~~CallsGraph proc~evp_zero_massless_velocity_impl evp_zero_massless_velocity_impl local local proc~evp_zero_massless_velocity_impl->local

Called by

proc~~evp_zero_massless_velocity_impl~~CalledByGraph proc~evp_zero_massless_velocity_impl evp_zero_massless_velocity_impl proc~ice_evp_dynamics_impl ice_evp_dynamics_impl proc~ice_evp_dynamics_impl->proc~evp_zero_massless_velocity_impl proc~ice_evp_dynamics ice_evp_dynamics proc~ice_evp_dynamics->proc~ice_evp_dynamics_impl proc~ice_evp_step ice_evp_step proc~ice_evp_step->proc~ice_evp_dynamics proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_evp_step proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step_ice proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step_ice

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
real(kind=wp), private :: mleft
real(kind=wp), private :: mright

Source Code

   pure subroutine evp_zero_massless_velocity_impl(mask_u, mask_v, mis, ui, vi, nx, ny)
      !! SIS2 :899-907 — zero ice velocities where BOTH neighbouring
      !! cells are massless (or the face is masked/land).
      integer, intent(in) :: nx, ny
      real(wp), intent(in) :: mask_u(nx + 1, ny)
      real(wp), intent(in) :: mask_v(nx, ny + 1)
      real(wp), intent(in) :: mis(nx, ny)
      real(wp), intent(inout) :: ui(nx + 1, ny)
      real(wp), intent(inout) :: vi(nx, ny + 1)
      integer :: i, j
      real(wp) :: mleft, mright

      ! F2: explicit `if` branches — `merge(mis(i-1,j), 0, i>1)` would
      ! still EVALUATE the OOB `mis(0,j)` reference at i=1 (merge does not
      ! conditionally evaluate its args), which is UB and traps under
      ! -Mbounds. Guard the read itself (mirrors `evp_mi_face_impl`).
      do concurrent(j=1:ny, i=1:nx + 1) local(mleft, mright)
         if (i > 1) then
            mleft = mis(i - 1, j)
         else
            mleft = 0.0_wp
         end if
         if (i <= nx) then
            mright = mis(i, j)
         else
            mright = 0.0_wp
         end if
         if (mask_u(i, j)*(mleft + mright) == 0.0_wp) ui(i, j) = 0.0_wp
      end do
      do concurrent(j=1:ny + 1, i=1:nx) local(mleft, mright)
         if (j > 1) then
            mleft = mis(i, j - 1)
         else
            mleft = 0.0_wp
         end if
         if (j <= ny) then
            mright = mis(i, j)
         else
            mright = 0.0_wp
         end if
         if (mask_v(i, j)*(mleft + mright) == 0.0_wp) vi(i, j) = 0.0_wp
      end do
   end subroutine evp_zero_massless_velocity_impl