ocean_horizontal_viscosity_apply_tendencies Subroutine

public subroutine ocean_horizontal_viscosity_apply_tendencies(this, ms, dt, no_wait)

Forward-Euler accumulation of the viscous tendency onto the face velocities. Shim — hoists this%du_visc%data etc. to the host before dispatching to the flat-impl. Explicit shape dimensions are derived from ms here and passed as scalar args. no_wait (optional, default .false.): forwarded to the impl — when .true. the apply DC loops run on OpenACC queue 1 and the routine returns WITHOUT syncing, so the batched velocity-apply chain in run_stage_split !$acc wait(1)s ONCE. Default ⇒ blocking. Not pure because of the async/wait directives.

Arguments

Type IntentOptional Attributes Name
type(ocean_horizontal_viscosity_t), intent(in) :: this
type(multilayer_state_t), intent(inout) :: ms
real(kind=wp), intent(in) :: dt
logical, intent(in), optional :: no_wait

Calls

proc~~ocean_horizontal_viscosity_apply_tendencies~~CallsGraph proc~ocean_horizontal_viscosity_apply_tendencies ocean_horizontal_viscosity_apply_tendencies proc~hvisc_apply_impl hvisc_apply_impl proc~ocean_horizontal_viscosity_apply_tendencies->proc~hvisc_apply_impl

Called by

proc~~ocean_horizontal_viscosity_apply_tendencies~~CalledByGraph proc~ocean_horizontal_viscosity_apply_tendencies ocean_horizontal_viscosity_apply_tendencies proc~run_stage run_stage proc~run_stage->proc~ocean_horizontal_viscosity_apply_tendencies proc~run_stage_split run_stage_split proc~run_stage_split->proc~ocean_horizontal_viscosity_apply_tendencies proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~run_stage 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 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
logical, private :: lwait
integer, private :: nx_cells
integer, private :: ny_cells
integer, private :: nz

Source Code

   subroutine ocean_horizontal_viscosity_apply_tendencies(this, ms, dt, no_wait)
      !! Forward-Euler accumulation of the viscous tendency onto the
      !! face velocities.  Shim — hoists `this%du_visc%data` etc. to
      !! the host before dispatching to the flat-impl.  Explicit shape
      !! dimensions are derived from `ms` here and passed as scalar
      !! args.
      !! `no_wait` (optional, default .false.): forwarded to the impl —
      !! when .true. the apply DC loops run on OpenACC queue 1 and the
      !! routine returns WITHOUT syncing, so the batched velocity-apply
      !! chain in `run_stage_split` `!$acc wait(1)`s ONCE.  Default ⇒
      !! blocking.  Not `pure` because of the async/wait directives.
      type(ocean_horizontal_viscosity_t), intent(in) :: this
      type(multilayer_state_t), intent(inout) :: ms
      real(wp), intent(in) :: dt
      logical, intent(in), optional :: no_wait
      integer :: nx_cells, ny_cells, nz
      logical :: lwait
      lwait = .true.
      if (present(no_wait)) lwait = .not. no_wait
      nx_cells = size(ms%u_face_x_layer, 1) - 1
      ny_cells = size(ms%v_face_y_layer, 2) - 1
      nz = ms%nz_ml
      call hvisc_apply_impl(ms%u_face_x_layer, ms%v_face_y_layer, &
                            this%du_visc%data, this%dv_visc%data, dt, &
                            nx_cells, ny_cells, nz, lwait)
   end subroutine ocean_horizontal_viscosity_apply_tendencies