ke_probe_coradv_split Subroutine

public subroutine ke_probe_coradv_split(grid, metrics, ms, cor, probe, stage, step, dt)

Sub-attribute the coriolis_adv segment: split the just-applied tendency into its PV-flux part and its −∇KE part and print each part’s work integral per region (KE_ATTR_PV rows). Call immediately AFTER coriolis_adv_apply_tendencies (and after the “coriolis_adv” KE_ATTR sample).

Method: the kernel left pv_flux_* = F_tot = F_pv − ∇KE and ke_centre in its scratch buffers. Per face, F_ke = −∇KE (recomputed from ke_centre), F_pv = F_tot − F_ke, and the work of each part over the apply is W_part = h_face · u_mid · dt · F_part with u_mid = u_new − ½·dt·F_tot (u_new is the post-apply face velocity), so W_pv + W_ke equals the segment’s dKE up to the face/cell weighting convention (a few % — use the split, not the sum, as the signal).

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(ocean_metrics_t), intent(in) :: metrics
type(multilayer_state_t), intent(in) :: ms
type(coriolis_adv_t), intent(in) :: cor
type(ke_probe_t), intent(inout) :: probe
integer, intent(in) :: stage
integer, intent(in) :: step
real(kind=wp), intent(in) :: dt

Calls

proc~~ke_probe_coradv_split~~CallsGraph proc~ke_probe_coradv_split ke_probe_coradv_split proc~coradv_split_impl coradv_split_impl proc~ke_probe_coradv_split->proc~coradv_split_impl proc~ke_probe_active ke_probe_active proc~ke_probe_coradv_split->proc~ke_probe_active reduce reduce proc~coradv_split_impl->reduce

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: wke_east
real(kind=wp), private :: wke_full
real(kind=wp), private :: wke_rim
real(kind=wp), private :: wpv_east
real(kind=wp), private :: wpv_full
real(kind=wp), private :: wpv_rim

Source Code

   subroutine ke_probe_coradv_split(grid, metrics, ms, cor, probe, stage, step, dt)
      !! Sub-attribute the coriolis_adv segment: split the just-applied
      !! tendency into its PV-flux part and its −∇KE part and print each
      !! part's work integral per region (`KE_ATTR_PV` rows).  Call
      !! immediately AFTER `coriolis_adv_apply_tendencies` (and after
      !! the "coriolis_adv" KE_ATTR sample).
      !!
      !! Method: the kernel left `pv_flux_*` = F_tot = F_pv − ∇KE and
      !! `ke_centre` in its scratch buffers.  Per face,
      !! F_ke = −∇KE (recomputed from ke_centre), F_pv = F_tot − F_ke,
      !! and the work of each part over the apply is
      !! `W_part = h_face · u_mid · dt · F_part` with
      !! u_mid = u_new − ½·dt·F_tot (u_new is the post-apply face
      !! velocity), so W_pv + W_ke equals the segment's dKE up to the
      !! face/cell weighting convention (a few % — use the split, not
      !! the sum, as the signal).
      type(hgrid_t), intent(in) :: grid
      type(ocean_metrics_t), intent(in) :: metrics
      type(multilayer_state_t), intent(in) :: ms
      type(coriolis_adv_t), intent(in) :: cor
      type(ke_probe_t), intent(inout) :: probe
      integer, intent(in) :: stage, step
      real(wp), intent(in) :: dt

      real(wp) :: wpv_full, wpv_rim, wpv_east
      real(wp) :: wke_full, wke_rim, wke_east

      if (.not. ke_probe_active(probe, step)) return

      !$acc wait
      call coradv_split_impl(ms%h_layer, ms%u_face_x_layer, ms%v_face_y_layer, &
                             cor%pv_flux_x%data, cor%pv_flux_y%data, &
                             cor%ke_centre%data, metrics%idxCu, metrics%idyCv, &
                             grid%nx_total, grid%ny_total, ms%nz_ml, &
                             grid%nghost, grid%nx_phys, grid%ny_phys, &
                             probe%rim_band, probe%east_band, dt, &
                             wpv_full, wpv_rim, wpv_east, &
                             wke_full, wke_rim, wke_east)

      write (*, "(a,1x,i6,1x,a,i1,6(1x,es13.5))") &
         "KE_ATTR_PV", step, "s", stage, &
         wpv_full, wke_full, wpv_rim, wke_rim, wpv_east, wke_east
   end subroutine ke_probe_coradv_split