ocean_halo_exchange_ice_transport Subroutine

public subroutine ocean_halo_exchange_ice_transport(ice, grid, bc, device_resident)

X4 of the sea-ice MPI plan: the seam ghosts every advective substep of ice_transport_step reads — the cell-averaged category masses mca_ice/mca_snow (the PPM donors, 5-point stencil) and the riding intensive tracers m_ice, enth_ice, sal_ice, enth_snow (the PCM donors). mca_* ghosts are zeroed by the IST->CAS conversion and the ride/mass updates leave the ghost band one substep old, so this runs at the top of EVERY substep. On one rank with a periodic axis the primitives wrap. Also carries the tripolar north fold of the same six fields (plain-copy scalar contract) — without it the fold-seam row’s advective stencil read a stale/unrelated mirror cell every substep, which is how ice piled up without bound on that row.

Arguments

Type IntentOptional Attributes Name
type(ocean_sea_ice_t), intent(inout) :: ice

Live sea-ice slot (ice%is_init); a no-op otherwise.

type(hgrid_t), intent(in) :: grid
type(ocean_bc_state_t), intent(in) :: bc

Supplies north_fold + the grid metrics the fold kernels need.

logical, intent(in), optional :: device_resident

Forwarded to the halo primitives.


Calls

proc~~ocean_halo_exchange_ice_transport~~CallsGraph proc~ocean_halo_exchange_ice_transport ocean_halo_exchange_ice_transport proc~ice_halo_centre_flat ice_halo_centre_flat proc~ocean_halo_exchange_ice_transport->proc~ice_halo_centre_flat proc~ocean_fold_wrap_centre_flat ocean_fold_wrap_centre_flat proc~ocean_halo_exchange_ice_transport->proc~ocean_fold_wrap_centre_flat proc~oh_count_suppress_off oh_count_suppress_off proc~ocean_halo_exchange_ice_transport->proc~oh_count_suppress_off proc~oh_count_suppress_on oh_count_suppress_on proc~ocean_halo_exchange_ice_transport->proc~oh_count_suppress_on proc~profiler_start profiler_start proc~ocean_halo_exchange_ice_transport->proc~profiler_start proc~profiler_stop profiler_stop proc~ocean_halo_exchange_ice_transport->proc~profiler_stop interface~ocean_halo_centre ocean_halo_centre proc~ice_halo_centre_flat->interface~ocean_halo_centre interface~fold_north_centre fold_north_centre proc~ocean_fold_wrap_centre_flat->interface~fold_north_centre interface~ocean_fold_pack ocean_fold_pack proc~ocean_fold_wrap_centre_flat->interface~ocean_fold_pack interface~ocean_fold_unpack ocean_fold_unpack proc~ocean_fold_wrap_centre_flat->interface~ocean_fold_unpack proc~ocean_fold_begin ocean_fold_begin proc~ocean_fold_wrap_centre_flat->proc~ocean_fold_begin proc~ocean_fold_end ocean_fold_end proc~ocean_fold_wrap_centre_flat->proc~ocean_fold_end proc~ocean_fold_exchange ocean_fold_exchange proc~ocean_fold_wrap_centre_flat->proc~ocean_fold_exchange proc~ocean_fold_is_distributed ocean_fold_is_distributed proc~ocean_fold_wrap_centre_flat->proc~ocean_fold_is_distributed proc~find_or_create_region find_or_create_region proc~profiler_start->proc~find_or_create_region proc~get_wall_time get_wall_time proc~profiler_start->proc~get_wall_time proc~nvtx_range_push nvtx_range_push proc~profiler_start->proc~nvtx_range_push proc~profiler_stop->proc~get_wall_time proc~nvtx_range_pop nvtx_range_pop proc~profiler_stop->proc~nvtx_range_pop proc~fold_north_centre_2d fold_north_centre_2d interface~fold_north_centre->proc~fold_north_centre_2d proc~fold_north_centre_3d fold_north_centre_3d interface~fold_north_centre->proc~fold_north_centre_3d proc~ocean_fold_pack_2d ocean_fold_pack_2d interface~ocean_fold_pack->proc~ocean_fold_pack_2d proc~ocean_fold_pack_3d ocean_fold_pack_3d interface~ocean_fold_pack->proc~ocean_fold_pack_3d proc~ocean_fold_unpack_2d ocean_fold_unpack_2d interface~ocean_fold_unpack->proc~ocean_fold_unpack_2d proc~ocean_fold_unpack_3d ocean_fold_unpack_3d interface~ocean_fold_unpack->proc~ocean_fold_unpack_3d proc~ocean_halo_centre_2d ocean_halo_centre_2d interface~ocean_halo_centre->proc~ocean_halo_centre_2d proc~ocean_halo_centre_3d ocean_halo_centre_3d interface~ocean_halo_centre->proc~ocean_halo_centre_3d proc~grow_buffers grow_buffers proc~ocean_fold_begin->proc~grow_buffers to_string to_string proc~ocean_fold_begin->to_string warning warning proc~ocean_fold_begin->warning comm_irecv_real_sp_array_n comm_irecv_real_sp_array_n proc~ocean_fold_exchange->comm_irecv_real_sp_array_n comm_isend_real_sp_array_n comm_isend_real_sp_array_n proc~ocean_fold_exchange->comm_isend_real_sp_array_n proc~comm_env_compute_comm comm_env_compute_comm proc~ocean_fold_exchange->proc~comm_env_compute_comm waitall waitall proc~ocean_fold_exchange->waitall comm_world comm_world proc~comm_env_compute_comm->comm_world proc~ocean_fold_pack_2d->proc~ocean_fold_pack_3d proc~fold_stagger_family fold_stagger_family proc~ocean_fold_pack_3d->proc~fold_stagger_family proc~fold_stagger_nrows fold_stagger_nrows proc~ocean_fold_pack_3d->proc~fold_stagger_nrows proc~ocean_fold_unpack_2d->proc~ocean_fold_unpack_3d proc~ocean_fold_unpack_3d->proc~fold_stagger_family proc~ocean_fold_unpack_3d->proc~fold_stagger_nrows proc~ocean_halo_centre_2d_impl ocean_halo_centre_2d_impl proc~ocean_halo_centre_2d->proc~ocean_halo_centre_2d_impl proc~oh_count_centre_2d oh_count_centre_2d proc~ocean_halo_centre_2d->proc~oh_count_centre_2d proc~ocean_halo_centre_3d->comm_irecv_real_sp_array_n proc~ocean_halo_centre_3d->comm_isend_real_sp_array_n proc~ocean_halo_centre_3d->proc~comm_env_compute_comm proc~ocean_halo_centre_3d->waitall proc~ew_rank_east ew_rank_east proc~ocean_halo_centre_3d->proc~ew_rank_east proc~ew_rank_west ew_rank_west proc~ocean_halo_centre_3d->proc~ew_rank_west proc~needs_flags needs_flags proc~ocean_halo_centre_3d->proc~needs_flags proc~ns_rank_north ns_rank_north proc~ocean_halo_centre_3d->proc~ns_rank_north proc~ns_rank_south ns_rank_south proc~ocean_halo_centre_3d->proc~ns_rank_south proc~ocean_halo_buffers_ensure_nz ocean_halo_buffers_ensure_nz proc~ocean_halo_centre_3d->proc~ocean_halo_buffers_ensure_nz proc~ocean_periodic_wrap_centre_3d ocean_periodic_wrap_centre_3d proc~ocean_halo_centre_3d->proc~ocean_periodic_wrap_centre_3d proc~oh_count_centre_3d oh_count_centre_3d proc~ocean_halo_centre_3d->proc~oh_count_centre_3d proc~oh_count_msgs oh_count_msgs proc~ocean_halo_centre_3d->proc~oh_count_msgs proc~decomp_rank_from_coords decomp_rank_from_coords proc~ew_rank_east->proc~decomp_rank_from_coords proc~ew_rank_west->proc~decomp_rank_from_coords proc~ns_rank_north->proc~decomp_rank_from_coords proc~ns_rank_south->proc~decomp_rank_from_coords proc~ocean_halo_buffers_ensure_nz->to_string proc~ocean_halo_buffers_ensure_nz->warning proc~ocean_halo_centre_2d_impl->comm_irecv_real_sp_array_n proc~ocean_halo_centre_2d_impl->comm_isend_real_sp_array_n proc~ocean_halo_centre_2d_impl->proc~comm_env_compute_comm proc~ocean_halo_centre_2d_impl->waitall proc~ocean_halo_centre_2d_impl->proc~ew_rank_east proc~ocean_halo_centre_2d_impl->proc~ew_rank_west proc~ocean_halo_centre_2d_impl->proc~needs_flags proc~ocean_halo_centre_2d_impl->proc~ns_rank_north proc~ocean_halo_centre_2d_impl->proc~ns_rank_south proc~ocean_halo_centre_2d_impl->proc~oh_count_msgs proc~ocean_periodic_wrap_centre_2d ocean_periodic_wrap_centre_2d proc~ocean_halo_centre_2d_impl->proc~ocean_periodic_wrap_centre_2d

Called by

proc~~ocean_halo_exchange_ice_transport~~CalledByGraph proc~ocean_halo_exchange_ice_transport ocean_halo_exchange_ice_transport proc~ice_transport_step ice_transport_step proc~ice_transport_step->proc~ocean_halo_exchange_ice_transport 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 :: nxt
integer, private :: nyt

Source Code

   subroutine ocean_halo_exchange_ice_transport(ice, grid, bc, device_resident)
      !! X4 of the sea-ice MPI plan: the seam ghosts every advective
      !! substep of `ice_transport_step` reads — the cell-averaged
      !! category masses `mca_ice`/`mca_snow` (the PPM donors, 5-point
      !! stencil) and the riding intensive tracers `m_ice`, `enth_ice`,
      !! `sal_ice`, `enth_snow` (the PCM donors).  `mca_*` ghosts are
      !! zeroed by the IST->CAS conversion and the ride/mass updates leave
      !! the ghost band one substep old, so this runs at the top of EVERY
      !! substep.  On one rank with a periodic axis the primitives wrap.
      !! Also carries the tripolar north fold of the same six fields
      !! (plain-copy scalar contract) — without it the fold-seam row's
      !! advective stencil read a stale/unrelated mirror cell every
      !! substep, which is how ice piled up without bound on that row.
      type(ocean_sea_ice_t), intent(inout) :: ice
         !! Live sea-ice slot (`ice%is_init`); a no-op otherwise.
      type(hgrid_t), intent(in) :: grid
      type(ocean_bc_state_t), intent(in) :: bc
         !! Supplies `north_fold` + the grid metrics the fold kernels need.
      logical, intent(in), optional :: device_resident
         !! Forwarded to the halo primitives.

      integer :: nxt, nyt

      if (.not. ice%is_init) return
      nxt = ice%nx_total
      nyt = ice%ny_total
      call profiler_start("ice_comms_transport")
      call oh_count_suppress_on()
      call ice_halo_centre_flat(ice%mca_ice, nxt, nyt, ice%ncat, device_resident)
      call ice_halo_centre_flat(ice%mca_snow, nxt, nyt, ice%ncat, device_resident)
      call ice_halo_centre_flat(ice%m_ice, nxt, nyt, ice%ncat, device_resident)
      call ice_halo_centre_flat(ice%enth_ice, nxt, nyt, ice%ncat*ice%nk_ice, device_resident)
      call ice_halo_centre_flat(ice%sal_ice, nxt, nyt, ice%ncat*ice%nk_ice, device_resident)
      call ice_halo_centre_flat(ice%enth_snow, nxt, nyt, ice%ncat, device_resident)
      call oh_count_suppress_off()
      call profiler_stop("ice_comms_transport")

      if (bc%north_fold) then
         call ocean_fold_wrap_centre_flat(grid, bc, ice%mca_ice, nxt, nyt, &
                                          ice%ncat, device_resident)
         call ocean_fold_wrap_centre_flat(grid, bc, ice%mca_snow, nxt, nyt, &
                                          ice%ncat, device_resident)
         call ocean_fold_wrap_centre_flat(grid, bc, ice%m_ice, nxt, nyt, &
                                          ice%ncat, device_resident)
         call ocean_fold_wrap_centre_flat(grid, bc, ice%enth_ice, nxt, nyt, &
                                          ice%ncat*ice%nk_ice, device_resident)
         call ocean_fold_wrap_centre_flat(grid, bc, ice%sal_ice, nxt, nyt, &
                                          ice%ncat*ice%nk_ice, device_resident)
         call ocean_fold_wrap_centre_flat(grid, bc, ice%enth_snow, nxt, nyt, &
                                          ice%ncat, device_resident)
      end if
   end subroutine ocean_halo_exchange_ice_transport