ice_max_speed_impl Subroutine

private pure subroutine ice_max_speed_impl(u_ice, v_ice, nghost, nx_phys, ny_phys, nx, ny, vmax)

Max |u_ice|/|v_ice| over PHYSICAL faces only (the array-edge ghost faces carry no meaning here). !$acc parallel loop reduction (inert comment on non-OpenACC compilers) — GPU-safe max reduction for the zero-velocity exact no-op gate.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: u_ice(nx+1,ny)
real(kind=wp), intent(in) :: v_ice(nx,ny+1)
integer, intent(in) :: nghost
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: nx
integer, intent(in) :: ny
real(kind=wp), intent(out) :: vmax

Calls

proc~~ice_max_speed_impl~~CallsGraph proc~ice_max_speed_impl ice_max_speed_impl reduce reduce proc~ice_max_speed_impl->reduce

Called by

proc~~ice_max_speed_impl~~CalledByGraph proc~ice_max_speed_impl ice_max_speed_impl proc~ice_transport_step ice_transport_step proc~ice_transport_step->proc~ice_max_speed_impl proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_transport_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 proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: i_hi
integer, private :: i_lo
integer, private :: j
integer, private :: j_hi
integer, private :: j_lo

Source Code

   pure subroutine ice_max_speed_impl(u_ice, v_ice, nghost, nx_phys, ny_phys, nx, ny, vmax)
      !! Max |u_ice|/|v_ice| over PHYSICAL faces only (the array-edge
      !! ghost faces carry no meaning here).  `!$acc parallel loop
      !! reduction` (inert comment on non-OpenACC compilers) — GPU-safe
      !! max reduction for the zero-velocity exact no-op gate.
      integer, intent(in) :: nghost, nx_phys, ny_phys, nx, ny
      real(wp), intent(in) :: u_ice(nx + 1, ny)
      real(wp), intent(in) :: v_ice(nx, ny + 1)
      real(wp), intent(out) :: vmax
      integer :: i, j, i_lo, i_hi, j_lo, j_hi

      i_lo = nghost + 1
      i_hi = nghost + nx_phys
      j_lo = nghost + 1
      j_hi = nghost + ny_phys

      vmax = 0.0_wp
      do concurrent(j=j_lo:j_hi, i=i_lo:i_hi + 1) reduce(max:vmax)
         vmax = max(vmax, abs(u_ice(i, j)))
      end do
      do concurrent(j=j_lo:j_hi + 1, i=i_lo:i_hi) reduce(max:vmax)
         vmax = max(vmax, abs(v_ice(i, j)))
      end do
   end subroutine ice_max_speed_impl