ocean_handle_refresh_host Subroutine

private subroutine ocean_handle_refresh_host(h)

Lazy D->H refresh of every P2-exposed leaf array, gated on h%host_is_current. !$acc update self on LEAF component names only, via associate — never the aggregate ocean_state_t/ sub-state derived type (rdb_ocean_dyn.F90:2949). Inert on a host-only build.

Arguments

Type IntentOptional Attributes Name
type(ocean_handle_t), intent(inout), pointer :: h

Called by

proc~~ocean_handle_refresh_host~~CalledByGraph proc~ocean_handle_refresh_host ocean_handle_refresh_host proc~rdb_ocean_get_kinetic_energy rdb_ocean_get_kinetic_energy proc~rdb_ocean_get_kinetic_energy->proc~ocean_handle_refresh_host proc~rdb_ocean_refresh_host rdb_ocean_refresh_host proc~rdb_ocean_refresh_host->proc~ocean_handle_refresh_host proc~rdb_ocean_set_tracer rdb_ocean_set_tracer proc~rdb_ocean_set_tracer->proc~ocean_handle_refresh_host

Variables

Type Visibility Attributes Name Initial
integer, private :: it

Source Code

   subroutine ocean_handle_refresh_host(h)
      !! Lazy D->H refresh of every P2-exposed leaf array, gated on
      !! `h%host_is_current`. `!$acc update self` on LEAF component names
      !! only, via `associate` — never the aggregate `ocean_state_t`/
      !! sub-state derived type (`rdb_ocean_dyn.F90:2949`). Inert on a
      !! host-only build.
      type(ocean_handle_t), pointer, intent(inout) :: h

      integer :: it

      if (h%host_is_current) return

      associate (ms => h%state%multilayer, bt => h%state%barotropic, &
                 bw => h%state%dyn%bt_work, ss => h%state%surface_stress, &
                 vm => h%state%vmix, mt => h%state%metrics, sf => h%state%surface_flux)
         !$acc update self(ms%h_layer, ms%u_face_x_layer, ms%v_face_y_layer, &
         !$acc&            ms%hu_face_x_layer, ms%hv_face_y_layer, &
         !$acc&            ms%w_interface, ms%rho_layer)
         if (allocated(ms%tracers)) then
            do it = 1, size(ms%tracers)
               !$acc update self(ms%tracers(it)%hTr)
            end do
         end if
         !$acc update self(bt%b, bw%bt_eta)
         !$acc update self(ss%tau_x, ss%tau_y)
         !$acc update self(sf%Q_heat, sf%Q_salt)
         !$acc update self(vm%kv, vm%kt, vm%ks)
         !$acc update self(mt%wet_T)
      end associate
      h%host_is_current = .true.
   end subroutine ocean_handle_refresh_host