Skip to content

Commit

Permalink
Copy invariant fields used in atm_recover_large_step_variables_work
Browse files Browse the repository at this point in the history
This commit ensures the invariant fields used during this work routine
are present on the device from model startup to model shutdown.

It builds on the changes in PR MPAS-Dev#1176 to copyin invariant fields during
mpas_atm_dynamics_init and delete them from the device during
mpas_atm_dynamics_finalize.
  • Loading branch information
gdicker1 committed Jan 15, 2025
1 parent be74b89 commit d0f46ff
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/core_atmosphere/dynamics/mpas_atm_time_integration.F
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ subroutine mpas_atm_dynamics_init(domain)
real (kind=RKIND), dimension(:,:,:), pointer :: zb3_cell
real (kind=RKIND), dimension(:), pointer :: fzm
real (kind=RKIND), dimension(:), pointer :: fzp
real (kind=RKIND), dimension(:,:,:), pointer :: zb
real (kind=RKIND), dimension(:,:,:), pointer :: zb3
#endif


Expand Down Expand Up @@ -344,6 +346,9 @@ subroutine mpas_atm_dynamics_init(domain)
call mpas_pool_get_array(mesh, 'zz', zz)
!$acc enter data copyin(zz)

call mpas_pool_get_array(mesh, 'zz', zz)
!$acc enter data copyin(zz)

call mpas_pool_get_array(mesh, 'zb_cell', zb_cell)
!$acc enter data copyin(zb_cell)

Expand All @@ -356,6 +361,12 @@ subroutine mpas_atm_dynamics_init(domain)
call mpas_pool_get_array(mesh, 'fzp', fzp)
!$acc enter data copyin(fzp)

call mpas_pool_get_array(mesh, 'zb', zb)
!$acc enter data copyin(zb)

call mpas_pool_get_array(mesh, 'zb3', zb3)
!$acc enter data copyin(zb3)

#endif

end subroutine mpas_atm_dynamics_init
Expand Down Expand Up @@ -425,6 +436,8 @@ subroutine mpas_atm_dynamics_finalize(domain)
real (kind=RKIND), dimension(:,:,:), pointer :: zb3_cell
real (kind=RKIND), dimension(:), pointer :: fzm
real (kind=RKIND), dimension(:), pointer :: fzp
real (kind=RKIND), dimension(:,:,:), pointer :: zb
real (kind=RKIND), dimension(:,:,:), pointer :: zb3
#endif


Expand Down Expand Up @@ -547,6 +560,13 @@ subroutine mpas_atm_dynamics_finalize(domain)

call mpas_pool_get_array(mesh, 'fzp', fzp)
!$acc exit data delete(fzp)

call mpas_pool_get_array(mesh, 'zb', zb)
!$acc exit data delete(zb)

call mpas_pool_get_array(mesh, 'zb3', zb3)
!$acc exit data delete(zb3)

#endif

end subroutine mpas_atm_dynamics_finalize
Expand Down

0 comments on commit d0f46ff

Please sign in to comment.