subroutine barotropic_workstate_enter_data_impl(this)
type(barotropic_workstate_t), intent(inout) :: this
!$acc enter data copyin(this%bt_eta, this%bt_H_ref)
!$acc enter data copyin(this%bt_ubt, this%bt_vbt)
!$acc enter data copyin(this%eta_sum, this%ubt_sum, this%vbt_sum)
!$acc enter data copyin(this%uhbt_sum, this%vhbt_sum, this%bt_uhbt, this%bt_vhbt)
!$acc enter data copyin(this%bt_ubt_end, this%bt_vbt_end, this%bt_eta_end)
!$acc enter data copyin(this%bt_zeta_corner, this%bt_ke_centre, this%bt_eta_new)
!$acc enter data copyin(this%cor_ref_u, this%cor_ref_v)
!$acc enter data copyin(this%bt_ubt_prev, this%bt_vbt_prev)
! bt_rem_u/v: always present (barotropic-only path uses them too)
!$acc enter data copyin(this%bt_rem_u, this%bt_rem_v)
! av_rem_u/v: PR-2, same "always present" posture as bt_rem_u/v.
!$acc enter data copyin(this%av_rem_u, this%av_rem_v)
! Wave-drag piston-velocity maps: filled on the host at configure
! time and never written on the device, so this MUST be `copyin`
! (not `create`) — see CLAUDE.md gotcha (2). Lazy: allocated only
! when `lwd_enable`.
if (allocated(this%lwd_drag_u)) then
!$acc enter data copyin(this%lwd_drag_u, this%lwd_drag_v)
end if
if (allocated(this%F_slow_u)) then
!$acc enter data copyin(this%F_slow_u, this%F_slow_v)
!$acc enter data copyin(this%F_bt_u, this%F_bt_v)
!$acc enter data copyin(this%F_bt_u_fast, this%F_bt_v_fast)
!$acc enter data copyin(this%ubt_at_n, this%vbt_at_n)
!$acc enter data copyin(this%pbce)
!$acc enter data copyin(this%gtot_E, this%gtot_W, this%gtot_N, this%gtot_S)
!$acc enter data copyin(this%e_anom, this%eta_PF)
!$acc enter data copyin(this%visc_rem_u, this%visc_rem_v)
end if
! BTCL_u/v are arrays of derived type with POD scalar components,
! so copying the array body is enough (parent before components
! on enter, reverse on exit).
if (allocated(this%BTCL_u)) then
!$acc enter data copyin(this%BTCL_u)
end if
if (allocated(this%BTCL_v)) then
!$acc enter data copyin(this%BTCL_v)
end if
! Upstream-h-face slots — same lazy pattern as BTCL_u/v.
if (allocated(this%h_face_up_x)) then
!$acc enter data copyin(this%h_face_up_x)
end if
if (allocated(this%h_face_up_y)) then
!$acc enter data copyin(this%h_face_up_y)
end if
! Wet/dry workspaces — same lazy pattern (allocated only when
! `wetdry_enable`); missing this attach = the per-launch memcpy
! explosion foot-gun, so every wd_* array is listed.
if (allocated(this%wd_wet_dyn)) then
!$acc enter data copyin(this%wd_wet_dyn, this%wd_theta)
!$acc enter data copyin(this%wd_flux_x, this%wd_flux_y)
!$acc enter data copyin(this%wd_open_u, this%wd_open_v)
end if
end subroutine barotropic_workstate_enter_data_impl