ocean_surfflux_set_components Subroutine

private subroutine ocean_surfflux_set_components(this, grid, enable)

Configure-time gate for the PR-12 component set (&ocean_forcing_nml enable_components). init runs before the namelist gate is known, so allocation happens HERE rather than in init: enable = .false. (default) leaves use_components false and allocates nothing — bit-identical, zero extra device memory. enable = .true. allocates the full component set (source=0.0_wp) and flips the gate so ocean_surface_flux_assemble stops early-returning. Must be called BEFORE enter_data (rdb_ocean_state.F90’s orchestrator) so the freshly-allocated arrays get mapped. Re-entrant: calling again with a different enable deallocates first.

Type Bound

ocean_surface_flux_t

Arguments

Type IntentOptional Attributes Name
class(ocean_surface_flux_t), intent(inout) :: this
type(hgrid_t), intent(in) :: grid
logical, intent(in) :: enable

Calls

proc~~ocean_surfflux_set_components~~CallsGraph proc~ocean_surfflux_set_components ocean_surface_flux_t%ocean_surfflux_set_components proc~ocean_surfflux_alloc_components ocean_surfflux_alloc_components proc~ocean_surfflux_set_components->proc~ocean_surfflux_alloc_components proc~ocean_surfflux_dealloc_components ocean_surfflux_dealloc_components proc~ocean_surfflux_set_components->proc~ocean_surfflux_dealloc_components

Called by

proc~~ocean_surfflux_set_components~~CalledByGraph proc~ocean_surfflux_set_components ocean_surface_flux_t%ocean_surfflux_set_components proc~engine_setup engine_setup proc~engine_setup->proc~ocean_surfflux_set_components 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_components(this, grid, enable)
      !! Configure-time gate for the PR-12 component set
      !! (`&ocean_forcing_nml enable_components`).  `init` runs before the
      !! namelist gate is known, so allocation happens HERE rather than in
      !! `init`: `enable = .false.` (default) leaves `use_components`
      !! false and allocates nothing — bit-identical, zero extra device
      !! memory.  `enable = .true.` allocates the full component set
      !! (`source=0.0_wp`) and flips the gate so
      !! `ocean_surface_flux_assemble` stops early-returning.  Must be
      !! called BEFORE `enter_data` (`rdb_ocean_state.F90`'s orchestrator)
      !! so the freshly-allocated arrays get mapped.  Re-entrant: calling
      !! again with a different `enable` deallocates first.
      class(ocean_surface_flux_t), intent(inout) :: this
      type(hgrid_t), intent(in) :: grid
      logical, intent(in) :: enable
      call ocean_surfflux_dealloc_components(this)
      this%use_components = enable
      if (enable) call ocean_surfflux_alloc_components(this, grid)
   end subroutine ocean_surfflux_set_components