ocean_periodic_wrap_face_y_2d Subroutine

public pure subroutine ocean_periodic_wrap_face_y_2d(fld, nx_total, ny_face, nx_phys, ny_phys, nghost, wrap_x, wrap_y)

Fill ghost faces of a 2D y-face field (e.g. bt_vbt, shape ny_total+1). Also copies south physical-wall face onto north physical-wall face. ny_face = ny_total + 1.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: fld(nx_total,ny_face)

y-face field, shape (nx_total, ny_total+1).

integer, intent(in) :: nx_total
integer, intent(in) :: ny_face
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: nghost
logical, intent(in) :: wrap_x
logical, intent(in) :: wrap_y

Called by

proc~~ocean_periodic_wrap_face_y_2d~~CalledByGraph proc~ocean_periodic_wrap_face_y_2d ocean_periodic_wrap_face_y_2d proc~ice_evp_dynamics_impl ice_evp_dynamics_impl proc~ice_evp_dynamics_impl->proc~ocean_periodic_wrap_face_y_2d interface~ocean_halo_face_y ocean_halo_face_y proc~ice_evp_dynamics_impl->interface~ocean_halo_face_y proc~ocean_halo_face_y_2d_impl ocean_halo_face_y_2d_impl proc~ocean_halo_face_y_2d_impl->proc~ocean_periodic_wrap_face_y_2d proc~ocean_seam_refresh_surface_stress ocean_seam_refresh_surface_stress proc~ocean_seam_refresh_surface_stress->proc~ocean_periodic_wrap_face_y_2d proc~ocean_seam_refresh_surface_stress->interface~ocean_halo_face_y proc~configure_ocean_forcing configure_ocean_forcing proc~configure_ocean_forcing->proc~ocean_seam_refresh_surface_stress proc~ice_evp_dynamics ice_evp_dynamics proc~ice_evp_dynamics->proc~ice_evp_dynamics_impl proc~ice_ocean_stress_flux ice_ocean_stress_flux proc~ice_ocean_stress_flux->proc~ocean_seam_refresh_surface_stress proc~ocean_data_forcing_apply ocean_data_forcing_apply proc~ocean_data_forcing_apply->proc~ocean_seam_refresh_surface_stress proc~ocean_data_forcing_configure ocean_data_forcing_configure proc~ocean_data_forcing_configure->proc~ocean_seam_refresh_surface_stress proc~ocean_halo_bt_group_2d_wide ocean_halo_bt_group_2d_wide proc~ocean_halo_bt_group_2d_wide->proc~ocean_halo_face_y_2d_impl proc~ocean_halo_face_y_2d ocean_halo_face_y_2d proc~ocean_halo_face_y_2d->proc~ocean_halo_face_y_2d_impl proc~ocean_halo_face_y_2d_wide ocean_halo_face_y_2d_wide proc~ocean_halo_face_y_2d_wide->proc~ocean_halo_face_y_2d_impl interface~ocean_halo_face_y->proc~ocean_halo_face_y_2d proc~barotropic_substep_nonlinear barotropic_substep_nonlinear proc~barotropic_substep_nonlinear->proc~ocean_halo_bt_group_2d_wide proc~ocean_halo_bt_group_2d ocean_halo_bt_group_2d proc~barotropic_substep_nonlinear->proc~ocean_halo_bt_group_2d proc~bt_wide_entry_exchange_impl bt_wide_entry_exchange_impl proc~bt_wide_entry_exchange_impl->proc~ocean_halo_bt_group_2d_wide proc~bt_wide_entry_exchange_impl->proc~ocean_halo_face_y_2d_wide proc~engine_enter_data engine_enter_data proc~engine_enter_data->proc~ocean_halo_bt_group_2d_wide proc~engine_enter_data->proc~ocean_halo_bt_group_2d proc~ocean_halo_exchange_ml_state ocean_halo_exchange_ml_state proc~engine_enter_data->proc~ocean_halo_exchange_ml_state proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_forcing proc~engine_setup->proc~ocean_data_forcing_configure proc~configure_ocean_closed_faces configure_ocean_closed_faces proc~engine_setup->proc~configure_ocean_closed_faces proc~configure_ocean_k_bot configure_ocean_k_bot proc~engine_setup->proc~configure_ocean_k_bot proc~engine_setup->proc~ocean_halo_exchange_ml_state proc~engine_step engine_step proc~engine_step->proc~ocean_data_forcing_apply proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_ocean_stress_flux proc~ice_evp_step ice_evp_step proc~engine_step_ice->proc~ice_evp_step proc~ice_evp_step->proc~ice_evp_dynamics proc~ocean_halo_bt_group_2d->proc~ocean_halo_face_y_2d proc~barotropic_substep_nonlinear_interior barotropic_substep_nonlinear_interior proc~barotropic_substep_nonlinear_interior->proc~barotropic_substep_nonlinear proc~bt_wide_entry_exchange bt_wide_t%bt_wide_entry_exchange proc~bt_wide_entry_exchange->proc~bt_wide_entry_exchange_impl proc~bt_wide_substep bt_wide_substep proc~bt_wide_substep->proc~barotropic_substep_nonlinear proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_enter_data proc~complete_ocean_create->proc~engine_setup proc~configure_ocean_closed_faces->interface~ocean_halo_face_y proc~configure_ocean_k_bot->interface~ocean_halo_face_y proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_enter_data proc~driver_run_ocean->proc~engine_setup proc~driver_run_ocean->proc~engine_step proc~driver_run_ocean->proc~engine_step_ice proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~ocean_halo_exchange_ml_state->interface~ocean_halo_face_y proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step proc~rdb_ocean_step->proc~engine_step_ice proc~run_stage_split run_stage_split proc~run_stage_split->interface~ocean_halo_face_y proc~run_stage_split->proc~ocean_halo_bt_group_2d proc~run_stage_split->proc~barotropic_substep_nonlinear_interior proc~run_stage_split->proc~bt_wide_entry_exchange proc~run_stage_split->proc~bt_wide_substep proc~run_stage_split->proc~ocean_halo_exchange_ml_state proc~visc_rem_halo_refresh visc_rem_halo_refresh proc~visc_rem_halo_refresh->interface~ocean_halo_face_y proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split 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 proc~run_continuity_chain run_continuity_chain proc~run_continuity_chain->proc~ocean_halo_exchange_ml_state proc~run_gm_step run_gm_step proc~run_gm_step->proc~ocean_halo_exchange_ml_state proc~visc_rem_precompute visc_rem_precompute proc~visc_rem_precompute->proc~visc_rem_halo_refresh proc~vmix_apply_in_stage vmix_apply_in_stage proc~vmix_apply_in_stage->proc~visc_rem_halo_refresh

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: j_n
integer, private :: j_s

Source Code

   pure subroutine ocean_periodic_wrap_face_y_2d(fld, nx_total, ny_face, &
                                                 nx_phys, ny_phys, nghost, &
                                                 wrap_x, wrap_y)
      !! Fill ghost faces of a 2D y-face field (e.g. bt_vbt, shape ny_total+1).
      !! Also copies south physical-wall face onto north physical-wall face.
      !! ny_face = ny_total + 1.
      integer, intent(in) :: nx_total, ny_face, nx_phys, ny_phys, nghost
      real(wp), intent(inout) :: fld(nx_total, ny_face)
         !! y-face field, shape (nx_total, ny_total+1).
      logical, intent(in) :: wrap_x
      logical, intent(in) :: wrap_y

      integer :: i, j
      integer :: j_s, j_n

      j_s = nghost + 1
      j_n = nghost + ny_phys + 1

      ! Two-pass: X-wrap first, Y-wrap (+ belt-and-braces) second.
      if (wrap_x) then
         do concurrent(j=1:ny_face, i=1:nx_total)
            if (i <= nghost) then
               fld(i, j) = fld(i + nx_phys, j)
            end if
            if (i > nx_phys + nghost) then
               fld(i, j) = fld(i - nx_phys, j)
            end if
         end do
      end if
      if (wrap_y) then
         do concurrent(j=1:ny_face, i=1:nx_total)
            ! South ghost faces j=1..nghost ← interior face j+ny_phys
            if (j <= nghost) then
               fld(i, j) = fld(i, j + ny_phys)
            end if
            ! North ghost faces j=ny_phys+nghost+2..ny_face ← interior face j-ny_phys
            if (j > ny_phys + nghost + 1) then
               fld(i, j) = fld(i, j - ny_phys)
            end if
            ! Belt-and-braces: copy south wall face onto north wall face.
            if (j == j_n) fld(i, j) = fld(i, j_s)
         end do
      end if
   end subroutine ocean_periodic_wrap_face_y_2d