ocean_state_enter_data Subroutine

public subroutine ocean_state_enter_data(state)

Attach the ocean god state’s allocatables to the device. Map the parent struct first so the device knows the shape of state, then call each slot’s bound enter_data. Only slots that own host allocations need to be visited; the Phase 0 shells (dyn, continuity, coriolis_adv, …) have no allocatables yet, so they’re skipped until they ship their own bound methods.

Arguments

Type IntentOptional Attributes Name
type(ocean_state_t), intent(inout) :: state

Calls

proc~~ocean_state_enter_data~~CallsGraph proc~ocean_state_enter_data ocean_state_enter_data proc~barotropic_state_enter_data barotropic_state_t%barotropic_state_enter_data proc~ocean_state_enter_data->proc~barotropic_state_enter_data proc~ocean_bc_state_enter_data ocean_bc_state_enter_data proc~ocean_state_enter_data->proc~ocean_bc_state_enter_data proc~profiler_start profiler_start proc~ocean_state_enter_data->proc~profiler_start proc~profiler_stop profiler_stop proc~ocean_state_enter_data->proc~profiler_stop proc~barotropic_state_enter_data_impl barotropic_state_enter_data_impl proc~barotropic_state_enter_data->proc~barotropic_state_enter_data_impl proc~find_or_create_region find_or_create_region proc~profiler_start->proc~find_or_create_region proc~get_wall_time get_wall_time proc~profiler_start->proc~get_wall_time proc~nvtx_range_push nvtx_range_push proc~profiler_start->proc~nvtx_range_push proc~profiler_stop->proc~get_wall_time proc~nvtx_range_pop nvtx_range_pop proc~profiler_stop->proc~nvtx_range_pop

Called by

proc~~ocean_state_enter_data~~CalledByGraph proc~ocean_state_enter_data ocean_state_enter_data proc~engine_enter_data engine_enter_data proc~engine_enter_data->proc~ocean_state_enter_data proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_enter_data proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_enter_data 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_state_enter_data(state)
      !! Attach the ocean god state's allocatables to the device.
      !! Map the parent struct first so the device knows the shape of
      !! `state`, then call each slot's bound `enter_data`.
      !! Only slots that own host allocations need to be visited; the
      !! Phase 0 shells (dyn, continuity, coriolis_adv, …) have no
      !! allocatables yet, so they're skipped until they ship their
      !! own bound methods.
      type(ocean_state_t), intent(inout) :: state

      !$acc enter data copyin(state)
      call profiler_start("ed_barotropic", nvtx_only=.true.)
      call state%barotropic%enter_data()
      call profiler_stop("ed_barotropic")
      call profiler_start("ed_metrics", nvtx_only=.true.)
      call state%metrics%enter_data()
      call profiler_stop("ed_metrics")
      if (state%use_multilayer) then
         call profiler_start("ed_multilayer", nvtx_only=.true.)
         call state%multilayer%enter_data()
         call profiler_stop("ed_multilayer")
      end if
      call profiler_start("ed_dyn", nvtx_only=.true.)
      call state%dyn%enter_data()
      call profiler_stop("ed_dyn")
      call profiler_start("ed_continuity", nvtx_only=.true.)
      call state%continuity%enter_data()
      call profiler_stop("ed_continuity")
      call profiler_start("ed_coriolis_adv", nvtx_only=.true.)
      call state%coriolis_adv%enter_data()
      call profiler_stop("ed_coriolis_adv")
      call profiler_start("ed_pressure_force", nvtx_only=.true.)
      call state%pressure_force%enter_data()
      call profiler_stop("ed_pressure_force")
      call profiler_start("ed_hvisc", nvtx_only=.true.)
      call state%hvisc%enter_data()
      call profiler_stop("ed_hvisc")
      call profiler_start("ed_bdrag", nvtx_only=.true.)
      call state%bdrag%enter_data()
      call state%tdrag%enter_data()
      call profiler_stop("ed_bdrag")
      call profiler_start("ed_surface_stress", nvtx_only=.true.)
      call state%surface_stress%enter_data()
      call profiler_stop("ed_surface_stress")
      call profiler_start("ed_surface_flux", nvtx_only=.true.)
      call state%surface_flux%enter_data()
      call state%cavity_flux%enter_data()
      call profiler_stop("ed_surface_flux")
      call profiler_start("ed_vert_advect", nvtx_only=.true.)
      call state%vert_advect%enter_data()
      call profiler_stop("ed_vert_advect")
      call profiler_start("ed_hdiff_tracer", nvtx_only=.true.)
      call state%hdiff_tracer%enter_data()
      call profiler_stop("ed_hdiff_tracer")
      call profiler_start("ed_vdiff", nvtx_only=.true.)
      call state%vdiff%enter_data()
      call profiler_stop("ed_vdiff")
      call profiler_start("ed_vmix", nvtx_only=.true.)
      call state%vmix%enter_data()
      call profiler_stop("ed_vmix")
      ! Gated closures are only device-mapped when enabled (their init is
      ! likewise gated, so the arrays are unallocated when off; unlike the
      ! kshear/tidal/epbl/meke slots these `enter_data` bodies carry no
      ! internal `allocated` guard, so the gate lives here at the call).
      call profiler_start("ed_epbl", nvtx_only=.true.)
      if (state%epbl%enable) call state%epbl%enter_data()
      call profiler_stop("ed_epbl")
      call profiler_start("ed_wavespeed", nvtx_only=.true.)
      call state%wavespeed%enter_data()
      call profiler_stop("ed_wavespeed")
      call profiler_start("ed_kshear", nvtx_only=.true.)
      if (state%kshear%enable) call state%kshear%enter_data()
      call profiler_stop("ed_kshear")
      call profiler_start("ed_vmix_tidal", nvtx_only=.true.)
      if (state%vmix_tidal%enable) call state%vmix_tidal%enter_data()
      call profiler_stop("ed_vmix_tidal")
      call profiler_start("ed_lateral_mix", nvtx_only=.true.)
      call state%lateral_mix%enter_data()
      call profiler_stop("ed_lateral_mix")
      call profiler_start("ed_slopes", nvtx_only=.true.)
      if (state%slopes%enable .or. state%gm%enable) call state%slopes%enter_data()
      call profiler_stop("ed_slopes")
      call profiler_start("ed_mle", nvtx_only=.true.)
      if (state%mle%enable) call state%mle%enter_data()
      call profiler_stop("ed_mle")
      call profiler_start("ed_gm", nvtx_only=.true.)
      if (state%gm%enable) call state%gm%enter_data()
      call profiler_stop("ed_gm")
      call profiler_start("ed_redi", nvtx_only=.true.)
      if (state%redi%enable) call state%redi%enter_data()
      call profiler_stop("ed_redi")
      call profiler_start("ed_varmix", nvtx_only=.true.)
      if (state%varmix%enable) call state%varmix%enter_data()
      call profiler_stop("ed_varmix")
      call profiler_start("ed_meke", nvtx_only=.true.)
      if (state%meke%enable) call state%meke%enter_data()
      call profiler_stop("ed_meke")
      call profiler_start("ed_vcoord", nvtx_only=.true.)
      call state%vcoord%enter_data()
      call profiler_stop("ed_vcoord")
      call profiler_start("ed_diag", nvtx_only=.true.)
      call state%diag%enter_data()
      call profiler_stop("ed_diag")
      call profiler_start("ed_tides", nvtx_only=.true.)
      call state%tides%enter_data()
      call profiler_stop("ed_tides")
      call profiler_start("ed_psurf", nvtx_only=.true.)
      call state%p_surf%enter_data()
      call profiler_stop("ed_psurf")
      call profiler_start("ed_ice", nvtx_only=.true.)
      if (state%ice%enable) call state%ice%enter_data()
      call profiler_stop("ed_ice")
      call profiler_start("ed_bc", nvtx_only=.true.)
      call ocean_bc_state_enter_data(state%bc)
      call profiler_stop("ed_bc")
      ! PR-23: gated (mirrors epbl/kshear/... — see the "Gated closures"
      ! comment above) — a disabled sponge (default) has unallocated arrays,
      ! so it must not be mapped.
      call profiler_start("ed_sponge", nvtx_only=.true.)
      if (state%sponge%enable) call state%sponge%enter_data()
      call profiler_stop("ed_sponge")
#ifndef RDB_NO_NETCDF
      call profiler_start("ed_data_input", nvtx_only=.true.)
      call state%data_input%enter_data()
      call profiler_stop("ed_data_input")
#endif
   end subroutine ocean_state_enter_data