ocean_fold_wrap_time_means Subroutine

public subroutine ocean_fold_wrap_time_means(grid, bc, ms)

Fold the pred_corr step time-means u_av (u, −), v_av (v, −, + fold-row projection) and h_av (T) — the stage-entry site that mirrors the prognostic fold for the Coriolis / viscosity inputs. Call after their periodic wrap. No-op when not folding or when the means are not allocated (ssp_rk2). Device-only: unlike the other dispatchers it takes no device_resident flag, because its production caller (run_stage_split) always runs on the mapped state.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(ocean_bc_state_t), intent(in) :: bc
type(multilayer_state_t), intent(inout) :: ms

Calls

proc~~ocean_fold_wrap_time_means~~CallsGraph proc~ocean_fold_wrap_time_means ocean_fold_wrap_time_means interface~fold_north_centre fold_north_centre proc~ocean_fold_wrap_time_means->interface~fold_north_centre interface~fold_north_u_face fold_north_u_face proc~ocean_fold_wrap_time_means->interface~fold_north_u_face interface~fold_north_v_face fold_north_v_face proc~ocean_fold_wrap_time_means->interface~fold_north_v_face interface~ocean_fold_pack ocean_fold_pack proc~ocean_fold_wrap_time_means->interface~ocean_fold_pack interface~ocean_fold_unpack ocean_fold_unpack proc~ocean_fold_wrap_time_means->interface~ocean_fold_unpack proc~ocean_fold_begin ocean_fold_begin proc~ocean_fold_wrap_time_means->proc~ocean_fold_begin proc~ocean_fold_end ocean_fold_end proc~ocean_fold_wrap_time_means->proc~ocean_fold_end proc~ocean_fold_exchange ocean_fold_exchange proc~ocean_fold_wrap_time_means->proc~ocean_fold_exchange proc~ocean_fold_is_distributed ocean_fold_is_distributed proc~ocean_fold_wrap_time_means->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~fold_north_u_face_2d fold_north_u_face_2d interface~fold_north_u_face->proc~fold_north_u_face_2d proc~fold_north_u_face_3d fold_north_u_face_3d interface~fold_north_u_face->proc~fold_north_u_face_3d proc~fold_north_v_face_2d fold_north_v_face_2d interface~fold_north_v_face->proc~fold_north_v_face_2d proc~fold_north_v_face_3d fold_north_v_face_3d interface~fold_north_v_face->proc~fold_north_v_face_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 local local proc~fold_north_v_face_2d->local proc~fold_north_v_face_3d->local 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_time_means~~CalledByGraph proc~ocean_fold_wrap_time_means ocean_fold_wrap_time_means proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_fold_wrap_time_means proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step_split proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer, private :: nxh
integer, private :: nxu
integer, private :: nxv
integer, private :: nyh
integer, private :: nyu
integer, private :: nyv
integer, private :: nz

Source Code

   subroutine ocean_fold_wrap_time_means(grid, bc, ms)
      !! Fold the `pred_corr` step time-means u_av (u, −), v_av (v, −, +
      !! fold-row projection) and h_av (T) — the stage-entry site that
      !! mirrors the prognostic fold for the Coriolis / viscosity inputs.
      !! Call after their periodic wrap.  No-op when not folding or when
      !! the means are not allocated (ssp_rk2).  Device-only: unlike the
      !! other dispatchers it takes no `device_resident` flag, because its
      !! production caller (`run_stage_split`) always runs on the mapped state.
      type(hgrid_t), intent(in) :: grid
      type(ocean_bc_state_t), intent(in) :: bc
      type(multilayer_state_t), intent(inout) :: ms

      integer :: nxu, nyu, nxv, nyv, nxh, nyh, nz

      if (.not. bc%north_fold) return
      if (.not. allocated(ms%u_av_layer)) return

      nxu = size(ms%u_av_layer, 1)
      nyu = size(ms%u_av_layer, 2)
      nxv = size(ms%v_av_layer, 1)
      nyv = size(ms%v_av_layer, 2)
      nxh = size(ms%h_av_layer, 1)
      nyh = size(ms%h_av_layer, 2)
      nz = size(ms%u_av_layer, 3)

      if (ocean_fold_is_distributed()) then
         call ocean_fold_begin(3*(grid%nghost + 1)*nz)
         call ocean_fold_pack(ms%u_av_layer, nxu, nyu, nz, FOLD_STAG_U)
         call ocean_fold_pack(ms%v_av_layer, nxv, nyv, nz, FOLD_STAG_V)
         call ocean_fold_pack(ms%h_av_layer, nxh, nyh, nz, FOLD_STAG_T)
         call ocean_fold_exchange()
         call ocean_fold_unpack(ms%u_av_layer, nxu, nyu, nz, FOLD_STAG_U, .true.)
         call ocean_fold_unpack(ms%v_av_layer, nxv, nyv, nz, FOLD_STAG_V, .true.)
         call ocean_fold_unpack(ms%h_av_layer, nxh, nyh, nz, FOLD_STAG_T, .false.)
         call ocean_fold_end()
         return
      end if

      call fold_north_u_face(ms%u_av_layer, nxu, nyu, nz, &
                             grid%nx_phys, grid%ny_phys, grid%nghost)
      call fold_north_v_face(ms%v_av_layer, nxv, nyv, nz, &
                             grid%nx_phys, grid%ny_phys, grid%nghost)
      call fold_north_centre(ms%h_av_layer, nxh, nyh, nz, &
                             grid%nx_phys, grid%ny_phys, grid%nghost)
   end subroutine ocean_fold_wrap_time_means