multilayer_enforce_vanished_content_host Subroutine

private subroutine multilayer_enforce_vanished_content_host(this, nx, ny)

HOST twin of enforce_vanished_content, for SETUP only. The seed (ocean_state_seed_land_cells) runs before enter_data, where a do concurrent on the offload build would work on device memory that is not mapped yet (mem:separate: no implicit copies). Plain host loops over the SAME included rdb_vl_merge_content, so the seeded state satisfies I1′ by the one definition. Never call it on a device-resident state.

Type Bound

multilayer_state_t

Arguments

Type IntentOptional Attributes Name
class(multilayer_state_t), intent(inout) :: this
integer, intent(in) :: nx

i-extent (total, incl. halos).

integer, intent(in) :: ny

j-extent (total, incl. halos).


Calls

proc~~multilayer_enforce_vanished_content_host~~CallsGraph proc~multilayer_enforce_vanished_content_host multilayer_state_t%multilayer_enforce_vanished_content_host rdb_vl_merge_content rdb_vl_merge_content proc~multilayer_enforce_vanished_content_host->rdb_vl_merge_content

Called by

proc~~multilayer_enforce_vanished_content_host~~CalledByGraph proc~multilayer_enforce_vanished_content_host multilayer_state_t%multilayer_enforce_vanished_content_host proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~multilayer_enforce_vanished_content_host proc~ocean_state_seed_land_cells ocean_state_seed_land_cells proc~ocean_state_seed_land_cells->proc~multilayer_enforce_vanished_content_host proc~configure_ocean_land_mask configure_ocean_land_mask proc~configure_ocean_land_mask->proc~ocean_state_seed_land_cells proc~engine_setup engine_setup proc~engine_setup->proc~ocean_state_seed_from_cfg proc~engine_setup->proc~configure_ocean_land_mask 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

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: h_col(NZ_STACK_MAX)
integer, private :: i
integer, private :: j
integer, private :: k
real(kind=wp), private :: q_col(NZ_STACK_MAX)
integer, private :: t

Source Code

   subroutine multilayer_enforce_vanished_content_host(this, nx, ny)
      !! HOST twin of `enforce_vanished_content`, for SETUP only.  The seed
      !! (`ocean_state_seed_land_cells`) runs before `enter_data`, where a
      !! `do concurrent` on the offload build would work on device memory
      !! that is not mapped yet (`mem:separate`: no implicit copies).  Plain
      !! host loops over the SAME included `rdb_vl_merge_content`, so the
      !! seeded state satisfies I1′ by the one definition.  Never call it on
      !! a device-resident state.
      class(multilayer_state_t), intent(inout) :: this
      integer, intent(in) :: nx
         !! i-extent (total, incl. halos).
      integer, intent(in) :: ny
         !! j-extent (total, incl. halos).
      integer :: t, i, j, k
      real(wp) :: h_col(NZ_STACK_MAX), q_col(NZ_STACK_MAX)

      if (.not. allocated(this%h_layer)) return
      if (.not. allocated(this%tracers)) return
      do t = 1, size(this%tracers)
         if (.not. allocated(this%tracers(t)%hTr)) cycle
         do j = 1, ny
            do i = 1, nx
               do k = 1, this%nz_ml
                  h_col(k) = this%h_layer(i, j, k)
                  q_col(k) = this%tracers(t)%hTr(i, j, k)
               end do
               call rdb_vl_merge_content(this%nz_ml, h_col, q_col)
               do k = 1, this%nz_ml
                  this%tracers(t)%hTr(i, j, k) = q_col(k)
               end do
            end do
         end do
      end do
   end subroutine multilayer_enforce_vanished_content_host