epbl_merge_into_kv_kt Subroutine

public pure subroutine epbl_merge_into_kv_kt(this, nx, ny, nzp1, kv, kt)

Fold the EPBL diffusivity into the vmix interface fields. Called EVERY stage (the interior closure rewrites kv/kt each stage; kd_int itself refreshes at thermo cadence). Interior interfaces only — k=1 (bed) and k=nz+1 (surface) stay at the closed-boundary zero in both source and target.

Arguments

Type IntentOptional Attributes Name
type(ocean_epbl_t), intent(in) :: this
integer, intent(in) :: nx

Interface-field extents (explicit shape: assumed-shape dummies in a do concurrent kernel make NVHPC walk the descriptor with per-launch memcpys — this runs every stage).

integer, intent(in) :: ny

Interface-field extents (explicit shape: assumed-shape dummies in a do concurrent kernel make NVHPC walk the descriptor with per-launch memcpys — this runs every stage).

integer, intent(in) :: nzp1

Interface-field extents (explicit shape: assumed-shape dummies in a do concurrent kernel make NVHPC walk the descriptor with per-launch memcpys — this runs every stage).

real(kind=wp), intent(inout) :: kv(nx,ny,nzp1)

Momentum viscosity at interfaces; gets prandtl*kd.

real(kind=wp), intent(inout) :: kt(nx,ny,nzp1)

Tracer diffusivity at interfaces; gets kd.


Called by

proc~~epbl_merge_into_kv_kt~~CalledByGraph proc~epbl_merge_into_kv_kt epbl_merge_into_kv_kt proc~vmix_apply_in_stage vmix_apply_in_stage proc~vmix_apply_in_stage->proc~epbl_merge_into_kv_kt proc~run_stage run_stage proc~run_stage->proc~vmix_apply_in_stage proc~run_stage_split run_stage_split proc~run_stage_split->proc~vmix_apply_in_stage 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

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: k

Source Code

   pure subroutine epbl_merge_into_kv_kt(this, nx, ny, nzp1, kv, kt)
      !! Fold the EPBL diffusivity into the vmix interface fields.
      !! Called EVERY stage (the interior closure rewrites kv/kt each
      !! stage; `kd_int` itself refreshes at thermo cadence).
      !! Interior interfaces only — k=1 (bed) and k=nz+1 (surface)
      !! stay at the closed-boundary zero in both source and target.
      type(ocean_epbl_t), intent(in) :: this
      integer, intent(in) :: nx, ny, nzp1
         !! Interface-field extents (explicit shape: assumed-shape
         !! dummies in a `do concurrent` kernel make NVHPC walk the
         !! descriptor with per-launch memcpys — this runs every stage).
      real(wp), intent(inout) :: kv(nx, ny, nzp1)
         !! Momentum viscosity at interfaces; gets prandtl*kd.
      real(wp), intent(inout) :: kt(nx, ny, nzp1)
         !! Tracer diffusivity at interfaces; gets kd.

      integer :: i, j, k

      do concurrent(k=2:nzp1 - 1, j=1:ny, i=1:nx)
         if (this%combine_mode == EPBL_COMBINE_MAX) then
            kt(i, j, k) = max(kt(i, j, k), this%kd_int(i, j, k))
            kv(i, j, k) = max(kv(i, j, k), this%prandtl*this%kd_int(i, j, k))
         else
            kt(i, j, k) = kt(i, j, k) + this%kd_int(i, j, k)
            kv(i, j, k) = kv(i, j, k) + this%prandtl*this%kd_int(i, j, k)
         end if
      end do
   end subroutine epbl_merge_into_kv_kt