subroutine multilayer_state_exit_data_impl(this)
type(multilayer_state_t), intent(inout) :: this
integer :: it
if (allocated(this%tracers)) then
do it = 1, size(this%tracers)
!$acc exit data copyout(this%tracers(it)%hTr)
!$acc exit data delete(this%tracers(it)%hTr0)
end do
!$acc exit data delete(this%tracers)
end if
this%registry_locked = .false.
!$acc exit data copyout(this%h_layer, &
!$acc& this%u_face_x_layer, this%v_face_y_layer, &
!$acc& this%hu_face_x_layer, this%hv_face_y_layer, &
!$acc& this%w_interface)
!$acc exit data copyout(this%rho_layer)
!$acc exit data delete(this%p_top)
!$acc exit data delete(this%h_layer0, &
!$acc& this%u_av_layer, this%v_av_layer, this%h_av_layer, &
!$acc& this%u_face_x_layer0, this%v_face_y_layer0, &
!$acc& this%mass_flux_x_layer, this%mass_flux_y_layer, &
!$acc& this%flux_h_layer, this%mass_budget_continuity, &
!$acc& this%heat_budget_surface, this%salt_budget_surface, &
!$acc& this%heat_budget_geothermal, &
!$acc& this%heat_budget_sponge, this%salt_budget_sponge, &
!$acc& this%heat_budget_vert_adv, this%salt_budget_vert_adv, &
!$acc& this%heat_budget_vdiff, this%salt_budget_vdiff, &
!$acc& this%heat_budget_hdiff, this%salt_budget_hdiff, &
!$acc& this%heat_budget_horiz_adv, this%salt_budget_horiz_adv, &
!$acc& this%mass_budget_remap, this%heat_budget_remap, &
!$acc& this%salt_budget_remap, this%wet_mask)
!$acc exit data delete(this%k_top, this%k_top_u, this%k_top_v)
!$acc exit data delete(this%k_bot, this%k_bot_u, this%k_bot_v)
end subroutine multilayer_state_exit_data_impl