ocean_surfflux_set_sw Subroutine

private subroutine ocean_surfflux_set_sw(this, sw_pen_frac, sw_band_ratio, sw_zeta1, sw_zeta2, sw_source)

Seed the shortwave-penetration band parameters and set the has_sw gate (sw_pen_frac /= 0). Sibling to set_surface_flux_const — kept separate so existing callers of the heat/salt setter are unchanged. Host only; the scalars are read host-side by the apply kernel (they parameterise the by-value arguments passed into the device _impl), so no extra device sync is needed beyond the existing copyin(this).

sw_source (optional; default "net_heat") selects the irradiance source: "net_heat" ⇒ I0 = sw_pen_frac*Q_heat (legacy, bit-identical); "q_sw" ⇒ I0 = sw_pen_frac*q_sw (requires the PR-12 component set — the caller / validate_config guards allocation). Sets the host-side sw_from_qsw gate.

Type Bound

ocean_surface_flux_t

Arguments

Type IntentOptional Attributes Name
class(ocean_surface_flux_t), intent(inout) :: this
real(kind=wp), intent(in) :: sw_pen_frac
real(kind=wp), intent(in) :: sw_band_ratio
real(kind=wp), intent(in) :: sw_zeta1
real(kind=wp), intent(in) :: sw_zeta2
character(len=*), intent(in), optional :: sw_source

Called by

proc~~ocean_surfflux_set_sw~~CalledByGraph proc~ocean_surfflux_set_sw ocean_surface_flux_t%ocean_surfflux_set_sw proc~engine_setup engine_setup proc~engine_setup->proc~ocean_surfflux_set_sw proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Source Code

   subroutine ocean_surfflux_set_sw(this, sw_pen_frac, sw_band_ratio, &
                                    sw_zeta1, sw_zeta2, sw_source)
      !! Seed the shortwave-penetration band parameters and set the
      !! `has_sw` gate (`sw_pen_frac /= 0`).  Sibling to
      !! `set_surface_flux_const` — kept separate so existing callers of
      !! the heat/salt setter are unchanged.  Host only; the scalars are
      !! read host-side by the apply kernel (they parameterise the
      !! by-value arguments passed into the device `_impl`), so no extra
      !! device sync is needed beyond the existing `copyin(this)`.
      !!
      !! `sw_source` (optional; default `"net_heat"`) selects the
      !! irradiance source: `"net_heat"` ⇒ `I0 = sw_pen_frac*Q_heat`
      !! (legacy, bit-identical); `"q_sw"` ⇒ `I0 = sw_pen_frac*q_sw`
      !! (requires the PR-12 component set — the caller / `validate_config`
      !! guards allocation).  Sets the host-side `sw_from_qsw` gate.
      class(ocean_surface_flux_t), intent(inout) :: this
      real(wp), intent(in) :: sw_pen_frac, sw_band_ratio, sw_zeta1, sw_zeta2
      character(len=*), intent(in), optional :: sw_source
      this%sw_pen_frac = sw_pen_frac
      this%sw_band_ratio = sw_band_ratio
      this%sw_zeta1 = sw_zeta1
      this%sw_zeta2 = sw_zeta2
      this%has_sw = (sw_pen_frac /= 0.0_wp)
      this%sw_from_qsw = .false.
      if (present(sw_source)) this%sw_from_qsw = (trim(sw_source) == "q_sw")
   end subroutine ocean_surfflux_set_sw