vmix_apply_kpp_overlay Subroutine

public pure subroutine vmix_apply_kpp_overlay(grid, this, ms, ss, sf)

Thin host-side shim over vmix_kpp_overlay_impl — same signature as before this PR, so the call site in rdb_ocean_dyn.F90 is unchanged. Selects the shortwave irradiance source HOST-SIDE (sf%sw_from_qsw): the PR-12 q_sw component is allocated only under use_components, so it is only ever passed on the branch guarded by the host flag (validate_config forces enable_components when sw_source="q_sw", making this total). sf%has_sw is passed as the sw_active gate — false ⇒ the _impl’s B_0 reduces to the unmodified legacy source line, bit-for-bit.

E4: this shim is also the OUTER SHIM for the surface (T, S) the buoyancy_coeffs = "eos" path needs — the tracer registry is an array of derived types, so ms%tracers(t)%hTr is dereferenced HERE, on the host, and the flat top-level arrays are handed down as explicit-shape dummies (array-of-derived-type device indirection rule). They are passed UNCONDITIONALLY, on both branches: the _impl reads them only under the knob, and a host-gated call handing a state array to an external subroutine costs even when never taken.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(ocean_vmix_t), intent(inout) :: this
type(multilayer_state_t), intent(in) :: ms
type(ocean_surface_stress_t), intent(in) :: ss
type(ocean_surface_flux_t), intent(in) :: sf

Calls

proc~~vmix_apply_kpp_overlay~~CallsGraph proc~vmix_apply_kpp_overlay vmix_apply_kpp_overlay proc~vmix_kpp_overlay_impl vmix_kpp_overlay_impl proc~vmix_apply_kpp_overlay->proc~vmix_kpp_overlay_impl local local proc~vmix_kpp_overlay_impl->local proc~eos_buoyancy_coeffs eos_buoyancy_coeffs proc~vmix_kpp_overlay_impl->proc~eos_buoyancy_coeffs proc~kpp_surface_buoyancy_flux kpp_surface_buoyancy_flux proc~vmix_kpp_overlay_impl->proc~kpp_surface_buoyancy_flux proc~sw_transmission sw_transmission proc~vmix_kpp_overlay_impl->proc~sw_transmission proc~roquet_spv_point roquet_spv_point proc~eos_buoyancy_coeffs->proc~roquet_spv_point

Called by

proc~~vmix_apply_kpp_overlay~~CalledByGraph proc~vmix_apply_kpp_overlay vmix_apply_kpp_overlay proc~vmix_apply_in_stage vmix_apply_in_stage proc~vmix_apply_in_stage->proc~vmix_apply_kpp_overlay 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

Source Code

   pure subroutine vmix_apply_kpp_overlay(grid, this, ms, ss, sf)
      !! Thin host-side shim over `vmix_kpp_overlay_impl` — same
      !! signature as before this PR, so the call site in
      !! `rdb_ocean_dyn.F90` is unchanged.  Selects the shortwave
      !! irradiance source HOST-SIDE (`sf%sw_from_qsw`): the PR-12 `q_sw`
      !! component is allocated only under `use_components`, so it is only
      !! ever passed on the branch guarded by the host flag
      !! (validate_config forces `enable_components` when
      !! `sw_source="q_sw"`, making this total).  `sf%has_sw` is passed as
      !! the `sw_active` gate — false ⇒ the `_impl`'s `B_0` reduces to the
      !! unmodified legacy source line, bit-for-bit.
      !!
      !! E4: this shim is also the OUTER SHIM for the surface (T, S) the
      !! `buoyancy_coeffs = "eos"` path needs — the tracer registry is an
      !! array of derived types, so `ms%tracers(t)%hTr` is dereferenced
      !! HERE, on the host, and the flat top-level arrays are handed down
      !! as explicit-shape dummies (array-of-derived-type device
      !! indirection rule).  They are passed UNCONDITIONALLY, on both
      !! branches: the `_impl` reads them only under the knob, and a
      !! host-gated call handing a state array to an external subroutine
      !! costs even when never taken.
      type(hgrid_t), intent(in) :: grid
      type(ocean_vmix_t), intent(inout) :: this
      type(multilayer_state_t), intent(in) :: ms
      type(ocean_surface_stress_t), intent(in) :: ss
      type(ocean_surface_flux_t), intent(in) :: sf
      if (sf%sw_from_qsw) then
         call vmix_kpp_overlay_impl(grid, this, ms, ss, sf, &
                                    grid%nx_total, grid%ny_total, ms%nz_ml, sf%q_sw, &
                                    ms%tracers(ms%idx_temperature)%hTr, &
                                    ms%tracers(ms%idx_salinity)%hTr, &
                                    sf%has_sw, sf%sw_pen_frac, sf%sw_band_ratio, &
                                    sf%sw_zeta1, sf%sw_zeta2, this%kpp_sw_method)
      else
         call vmix_kpp_overlay_impl(grid, this, ms, ss, sf, &
                                    grid%nx_total, grid%ny_total, ms%nz_ml, sf%Q_heat, &
                                    ms%tracers(ms%idx_temperature)%hTr, &
                                    ms%tracers(ms%idx_salinity)%hTr, &
                                    sf%has_sw, sf%sw_pen_frac, sf%sw_band_ratio, &
                                    sf%sw_zeta1, sf%sw_zeta2, this%kpp_sw_method)
      end if
   end subroutine vmix_apply_kpp_overlay