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 | Intent | Optional | 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 |
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