ice_fb_part_sum_fill_impl Subroutine

private pure subroutine ice_fb_part_sum_fill_impl(wet_mask, part_size, m_ice, fb_part_sum, nghost, ncat, nx, ny)

Fill fb_part_sum(i,j) = Σ_c part_size(i,j,c) restricted to categories passing the column’s OWN entry gate (m_ice(i,j,c) > ICE_RHO_ICE*H_VANISHED) — MUST run BEFORE ice_thermo_columns mutates m_ice (module docstring). Device kernel over PHYSICAL cells, inner if/serial do cat — never a masked do concurrent header.

Decl-order: all integer dims declared before the explicit-shape arrays that use them.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: wet_mask(nx,ny)
real(kind=wp), intent(in) :: part_size(nx,ny,0:ncat)
real(kind=wp), intent(in) :: m_ice(nx,ny,ncat)
real(kind=wp), intent(inout) :: fb_part_sum(nx,ny)
integer, intent(in) :: nghost
integer, intent(in) :: ncat
integer, intent(in) :: nx
integer, intent(in) :: ny

Calls

proc~~ice_fb_part_sum_fill_impl~~CallsGraph proc~ice_fb_part_sum_fill_impl ice_fb_part_sum_fill_impl local local proc~ice_fb_part_sum_fill_impl->local

Called by

proc~~ice_fb_part_sum_fill_impl~~CalledByGraph proc~ice_fb_part_sum_fill_impl ice_fb_part_sum_fill_impl proc~ice_thermo_driver_step ice_thermo_driver_step proc~ice_thermo_driver_step->proc~ice_fb_part_sum_fill_impl proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_thermo_driver_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 :: cat
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_fb_part_sum_fill_impl(wet_mask, part_size, m_ice, fb_part_sum, &
                                             nghost, ncat, nx, ny)
      !! Fill `fb_part_sum(i,j) = Σ_c part_size(i,j,c)` restricted to
      !! categories passing the column's OWN entry gate
      !! (`m_ice(i,j,c) > ICE_RHO_ICE*H_VANISHED`) — MUST run BEFORE
      !! `ice_thermo_columns` mutates `m_ice` (module docstring). Device
      !! kernel over PHYSICAL cells, inner `if`/serial `do cat` — never a
      !! masked `do concurrent` header.
      !!
      !! Decl-order: all integer dims declared before the explicit-shape
      !! arrays that use them.
      integer, intent(in) :: nghost, ncat, nx, ny
      real(wp), intent(in) :: wet_mask(nx, ny)
      real(wp), intent(in) :: part_size(nx, ny, 0:ncat)
      real(wp), intent(in) :: m_ice(nx, ny, ncat)
      real(wp), intent(inout) :: fb_part_sum(nx, ny)

      integer :: i, j, cat, i_lo, i_hi, j_lo, j_hi

      i_lo = nghost + 1
      i_hi = nx - nghost
      j_lo = nghost + 1
      j_hi = ny - nghost

      do concurrent(j=j_lo:j_hi, i=i_lo:i_hi) local(cat)
         fb_part_sum(i, j) = 0.0_wp
         if (wet_mask(i, j) > 0.5_wp) then
            do cat = 1, ncat
               if (m_ice(i, j, cat) > ICE_RHO_ICE*H_VANISHED) then
                  fb_part_sum(i, j) = fb_part_sum(i, j) + part_size(i, j, cat)
               end if
            end do
         end if
      end do
   end subroutine ice_fb_part_sum_fill_impl