ice_ist_to_cas_impl Subroutine

private pure subroutine ice_ist_to_cas_impl(wet_mask, part_size, m_ice, m_snow, mca_ice, mca_snow, nghost, ncat, nx, ny)

SIS2 ice_state_to_cell_ave_state (:465): mca(c) = part_size(c)*m(c) per category, physical cells only. Ghost cells are zeroed (never read as donors in the flux kernels below — wet mirroring + wall zeroing exclude 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(in) :: m_snow(nx,ny,ncat)
real(kind=wp), intent(out) :: mca_ice(nx,ny,ncat)
real(kind=wp), intent(out) :: mca_snow(nx,ny,ncat)
integer, intent(in) :: nghost
integer, intent(in) :: ncat
integer, intent(in) :: nx
integer, intent(in) :: ny

Called by

proc~~ice_ist_to_cas_impl~~CalledByGraph proc~ice_ist_to_cas_impl ice_ist_to_cas_impl proc~ice_transport_step ice_transport_step proc~ice_transport_step->proc~ice_ist_to_cas_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 :: c
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_ist_to_cas_impl(wet_mask, part_size, m_ice, m_snow, mca_ice, mca_snow, &
                                       nghost, ncat, nx, ny)
      !! SIS2 `ice_state_to_cell_ave_state` (`:465`): `mca(c) =
      !! part_size(c)*m(c)` per category, physical cells only.  Ghost
      !! cells are zeroed (never read as donors in the flux kernels below
      !! — wet mirroring + wall zeroing exclude 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(in) :: m_snow(nx, ny, ncat)
      real(wp), intent(out) :: mca_ice(nx, ny, ncat)
      real(wp), intent(out) :: mca_snow(nx, ny, ncat)
      integer :: i, j, c, 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=1:ny, i=1:nx, c=1:ncat)
         mca_ice(i, j, c) = 0.0_wp
         mca_snow(i, j, c) = 0.0_wp
      end do
      do concurrent(j=j_lo:j_hi, i=i_lo:i_hi, c=1:ncat)
         if (wet_mask(i, j) > 0.5_wp) then
            mca_ice(i, j, c) = part_size(i, j, c)*m_ice(i, j, c)
            mca_snow(i, j, c) = part_size(i, j, c)*m_snow(i, j, c)
         end if
      end do
   end subroutine ice_ist_to_cas_impl