fold_north_u_face_2d Subroutine

private pure subroutine fold_north_u_face_2d(u, nx_face, ny_total, nx_phys, ny_phys, nghost, negate)

Fill the north halo of a 2D x-face (Cu) field. Sign-flipped by default (negate absent / .true., the true-vector contract — wind stress, velocity). negate=.false. copies instead: for a SCALAR carried on a u-face (e.g. the viscous remnant visc_rem_u — a fraction, not a flux component), the 180-degree fold rotation still swaps which side of the seam the value sits on, but the value itself does not change sign (see fold_north_corner_2d’s negate for the matching corner-stagger contract).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout) :: u(nx_face,ny_total)

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

integer, intent(in) :: nx_face
integer, intent(in) :: ny_total
integer, intent(in) :: nx_phys
integer, intent(in) :: ny_phys
integer, intent(in) :: nghost
logical, intent(in), optional :: negate

.true. (default) = true-vector component; .false. = scalar.


Called by

proc~~fold_north_u_face_2d~~CalledByGraph proc~fold_north_u_face_2d fold_north_u_face_2d interface~fold_north_u_face fold_north_u_face interface~fold_north_u_face->proc~fold_north_u_face_2d proc~drain_wrap_face_x drain_wrap_face_x proc~drain_wrap_face_x->interface~fold_north_u_face proc~fold_u_2d fold_u_2d proc~fold_u_2d->interface~fold_north_u_face proc~fold_u_3d fold_u_3d proc~fold_u_3d->interface~fold_north_u_face proc~ocean_fold_wrap_state ocean_fold_wrap_state proc~ocean_fold_wrap_state->interface~fold_north_u_face proc~ocean_fold_wrap_stress ocean_fold_wrap_stress proc~ocean_fold_wrap_stress->interface~fold_north_u_face proc~ocean_fold_wrap_time_means ocean_fold_wrap_time_means proc~ocean_fold_wrap_time_means->interface~fold_north_u_face proc~ocean_fold_wrap_visc_rem ocean_fold_wrap_visc_rem proc~ocean_fold_wrap_visc_rem->interface~fold_north_u_face interface~ocean_fold_north_u_face ocean_fold_north_u_face interface~ocean_fold_north_u_face->proc~fold_u_2d interface~ocean_fold_north_u_face->proc~fold_u_3d proc~continuity_tracer_drain continuity_tracer_drain proc~continuity_tracer_drain->proc~drain_wrap_face_x proc~engine_setup engine_setup proc~engine_setup->proc~ocean_fold_wrap_state proc~configure_ocean_forcing configure_ocean_forcing proc~engine_setup->proc~configure_ocean_forcing proc~ocean_data_forcing_configure ocean_data_forcing_configure proc~engine_setup->proc~ocean_data_forcing_configure proc~ocean_seam_refresh_surface_stress ocean_seam_refresh_surface_stress proc~ocean_seam_refresh_surface_stress->proc~ocean_fold_wrap_stress proc~run_continuity_chain run_continuity_chain proc~run_continuity_chain->proc~ocean_fold_wrap_state proc~run_gm_step run_gm_step proc~run_gm_step->proc~ocean_fold_wrap_state proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_fold_wrap_state proc~run_stage_split->proc~ocean_fold_wrap_time_means proc~run_stage_split->proc~run_continuity_chain proc~visc_rem_precompute visc_rem_precompute proc~run_stage_split->proc~visc_rem_precompute proc~vmix_apply_in_stage vmix_apply_in_stage proc~run_stage_split->proc~vmix_apply_in_stage proc~visc_rem_halo_refresh visc_rem_halo_refresh proc~visc_rem_halo_refresh->proc~ocean_fold_wrap_visc_rem proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~configure_ocean_forcing->proc~ocean_seam_refresh_surface_stress proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~ocean_dyn_flush_tracer_window ocean_dyn_flush_tracer_window proc~driver_run_ocean->proc~ocean_dyn_flush_tracer_window proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup 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->proc~ocean_seam_refresh_surface_stress proc~ocean_dyn_flush_tracer_window->proc~continuity_tracer_drain proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~continuity_tracer_drain proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~continuity_tracer_drain proc~ocean_dyn_step_split->proc~run_gm_step proc~ocean_dyn_step_split->proc~run_stage_split proc~visc_rem_precompute->proc~visc_rem_halo_refresh proc~vmix_apply_in_stage->proc~visc_rem_halo_refresh proc~vmix_apply_in_stage->proc~visc_rem_precompute proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~engine_step engine_step proc~engine_step->proc~ocean_data_forcing_apply proc~engine_step->proc~ocean_dyn_step proc~engine_step->proc~ocean_dyn_step_split proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_ocean_stress_flux 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~rdb_ocean_set_tracer rdb_ocean_set_tracer proc~rdb_ocean_set_tracer->proc~ocean_dyn_flush_tracer_window proc~run_stage run_stage proc~run_stage->proc~vmix_apply_in_stage

Variables

Type Visibility Attributes Name Initial
integer, private :: fsum
integer, private :: i
integer, private :: j
integer, private :: j_lo
integer, private :: jsum
real(kind=wp), private :: sgn

Source Code

   pure subroutine fold_north_u_face_2d(u, nx_face, ny_total, &
                                        nx_phys, ny_phys, nghost, negate)
      !! Fill the north halo of a 2D x-face (Cu) field.  Sign-flipped by
      !! default (`negate` absent / `.true.`, the true-vector contract —
      !! wind stress, velocity).  `negate=.false.` copies instead: for a
      !! SCALAR carried on a u-face (e.g. the viscous remnant `visc_rem_u`
      !! — a fraction, not a flux component), the 180-degree fold rotation
      !! still swaps which side of the seam the value sits on, but the
      !! value itself does not change sign (see `fold_north_corner_2d`'s
      !! `negate` for the matching corner-stagger contract).
      integer, intent(in) :: nx_face, ny_total, nx_phys, ny_phys, nghost
      real(wp), intent(inout) :: u(nx_face, ny_total)
         !! x-face field, shape (nx_total+1, ny_total).
      logical, intent(in), optional :: negate
         !! `.true.` (default) = true-vector component; `.false.` = scalar.

      integer :: i, j, fsum, jsum, j_lo
      real(wp) :: sgn

      sgn = -1.0_wp
      if (present(negate)) then
         if (.not. negate) sgn = 1.0_wp
      end if
      fsum = 2*nghost + nx_phys + 2
      jsum = 2*nghost + 2*ny_phys + 1
      j_lo = nghost + ny_phys + 1

      do concurrent(j=j_lo:ny_total, i=1:nx_face)
         u(i, j) = sgn*u(fsum - i, jsum - j)
      end do
   end subroutine fold_north_u_face_2d