ocean_fold_wrap_centre_flat Subroutine

public subroutine ocean_fold_wrap_centre_flat(grid, bc, fld, nxt, nyt, nz, device_resident)

Fold the north seam of an arbitrary flat cell-centred (T-stagger) SCALAR field — copy, no sign flip, exactly fold_north_centre’s contract. Exists so a caller holding a sequence-associated flat view of a higher-rank array (the sea-ice category state’s ice_halo_centre_flat pattern — part_size/m_ice/m_snow/ enth_ice/sal_ice/enth_snow/mca_ice/mca_snow, and the per-cell flux diagnostics salt_flux_diag/heat_flux_diag/ sw_thru_diag) can fold it without going through multilayer_state_t. Every one of these is a per-category mass, enthalpy, salinity or fractional area — a scalar, not a vector component — so negate is never offered here. Call AFTER the field’s halo exchange (which also performs the single-rank periodic wrap). No-op when bc%north_fold is .false..

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(ocean_bc_state_t), intent(in) :: bc
real(kind=wp), intent(inout) :: fld(nxt,nyt,nz)
integer, intent(in) :: nxt
integer, intent(in) :: nyt
integer, intent(in) :: nz
logical, intent(in), optional :: device_resident

px > 1 only: .false. for host-side (pre-enter_data) calls.


Calls

proc~~ocean_fold_wrap_centre_flat~~CallsGraph proc~ocean_fold_wrap_centre_flat ocean_fold_wrap_centre_flat 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~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~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

Called by

proc~~ocean_fold_wrap_centre_flat~~CalledByGraph proc~ocean_fold_wrap_centre_flat ocean_fold_wrap_centre_flat proc~ocean_halo_exchange_ice_fluxes ocean_halo_exchange_ice_fluxes proc~ocean_halo_exchange_ice_fluxes->proc~ocean_fold_wrap_centre_flat proc~ocean_halo_exchange_ice_state ocean_halo_exchange_ice_state proc~ocean_halo_exchange_ice_state->proc~ocean_fold_wrap_centre_flat proc~ocean_halo_exchange_ice_transport ocean_halo_exchange_ice_transport proc~ocean_halo_exchange_ice_transport->proc~ocean_fold_wrap_centre_flat proc~engine_setup engine_setup proc~engine_setup->proc~ocean_halo_exchange_ice_state proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ocean_halo_exchange_ice_fluxes proc~engine_step_ice->proc~ocean_halo_exchange_ice_state proc~ice_transport_step ice_transport_step proc~engine_step_ice->proc~ice_transport_step proc~ice_transport_step->proc~ocean_halo_exchange_ice_transport proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_run_ocean->proc~engine_step_ice proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup 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 proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Source Code

   subroutine ocean_fold_wrap_centre_flat(grid, bc, fld, nxt, nyt, nz, device_resident)
      !! Fold the north seam of an arbitrary flat cell-centred (T-stagger)
      !! SCALAR field — copy, no sign flip, exactly `fold_north_centre`'s
      !! contract.  Exists so a caller holding a sequence-associated flat
      !! view of a higher-rank array (the sea-ice category state's
      !! `ice_halo_centre_flat` pattern — `part_size`/`m_ice`/`m_snow`/
      !! `enth_ice`/`sal_ice`/`enth_snow`/`mca_ice`/`mca_snow`, and the
      !! per-cell flux diagnostics `salt_flux_diag`/`heat_flux_diag`/
      !! `sw_thru_diag`) can fold it without going through
      !! `multilayer_state_t`.  Every one of these is a per-category mass,
      !! enthalpy, salinity or fractional area — a scalar, not a vector
      !! component — so `negate` is never offered here.  Call AFTER the
      !! field's halo exchange (which also performs the single-rank
      !! periodic wrap).  No-op when `bc%north_fold` is `.false.`.
      type(hgrid_t), intent(in) :: grid
      type(ocean_bc_state_t), intent(in) :: bc
      integer, intent(in) :: nxt, nyt, nz
      real(wp), intent(inout) :: fld(nxt, nyt, nz)
      logical, intent(in), optional :: device_resident
         !! px > 1 only: `.false.` for host-side (pre-`enter_data`) calls.

      if (.not. bc%north_fold) return

      if (ocean_fold_is_distributed()) then
         call ocean_fold_begin(grid%nghost*nz)
         call ocean_fold_pack(fld, nxt, nyt, nz, FOLD_STAG_T, device_resident)
         call ocean_fold_exchange(device_resident)
         call ocean_fold_unpack(fld, nxt, nyt, nz, FOLD_STAG_T, .false., device_resident)
         call ocean_fold_end()
         return
      end if

      call fold_north_centre(fld, nxt, nyt, nz, grid%nx_phys, grid%ny_phys, grid%nghost)
   end subroutine ocean_fold_wrap_centre_flat