Skip to content

Commit

Permalink
Copy invariant fields used in atm_advance_acoustic_step_work
Browse files Browse the repository at this point in the history
Ensures the fields which don't change while the model is running are
present on the device from model startup until model shutdown.

It builds on the changes in PR #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 10, 2025
1 parent a954544 commit 3223f28
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions src/core_atmosphere/dynamics/mpas_atm_time_integration.F
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ subroutine mpas_atm_dynamics_init(domain)
real (kind=RKIND), dimension(:,:), pointer :: kiteAreasOnVertex
real (kind=RKIND), dimension(:), pointer :: fEdge
real (kind=RKIND), dimension(:), pointer :: fVertex
real (kind=RKIND), dimension(:,:), pointer :: zz
real (kind=RKIND), dimension(:,:,:), pointer :: zb_cell
real (kind=RKIND), dimension(:,:,:), pointer :: zb3_cell
real (kind=RKIND), dimension(:), pointer :: fzm
real (kind=RKIND), dimension(:), pointer :: fzp
real (kind=RKIND), dimension(:,:), pointer :: zgrid
real (kind=RKIND), dimension(:), pointer :: rdzw
real (kind=RKIND), dimension(:,:), pointer :: zxu
real (kind=RKIND), dimension(:,:), pointer :: dss
real (kind=RKIND), dimension(:), pointer :: specZoneMaskCell
real (kind=RKIND), dimension(:), pointer :: specZoneMaskEdge
#endif


Expand Down Expand Up @@ -335,6 +346,39 @@ subroutine mpas_atm_dynamics_init(domain)

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

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)

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

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

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

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

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

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

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

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

call mpas_pool_get_array(mesh, 'specZoneMaskEdge', specZoneMaskEdge)
!$acc enter data copyin(specZoneMaskEdge)
#endif

end subroutine mpas_atm_dynamics_init
Expand Down Expand Up @@ -399,6 +443,17 @@ subroutine mpas_atm_dynamics_finalize(domain)
real (kind=RKIND), dimension(:,:), pointer :: kiteAreasOnVertex
real (kind=RKIND), dimension(:), pointer :: fEdge
real (kind=RKIND), dimension(:), pointer :: fVertex
real (kind=RKIND), dimension(:,:), pointer :: zz
real (kind=RKIND), dimension(:,:,:), pointer :: zb_cell
real (kind=RKIND), dimension(:,:,:), pointer :: zb3_cell
real (kind=RKIND), dimension(:), pointer :: fzm
real (kind=RKIND), dimension(:), pointer :: fzp
real (kind=RKIND), dimension(:,:), pointer :: zgrid
real (kind=RKIND), dimension(:), pointer :: rdzw
real (kind=RKIND), dimension(:,:), pointer :: zxu
real (kind=RKIND), dimension(:,:), pointer :: dss
real (kind=RKIND), dimension(:), pointer :: specZoneMaskCell
real (kind=RKIND), dimension(:), pointer :: specZoneMaskEdge
#endif


Expand Down Expand Up @@ -506,6 +561,39 @@ subroutine mpas_atm_dynamics_finalize(domain)

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

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

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

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

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

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

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

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

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

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

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

call mpas_pool_get_array(mesh, 'specZoneMaskEdge', specZoneMaskEdge)
!$acc exit data delete(specZoneMaskEdge)
#endif

end subroutine mpas_atm_dynamics_finalize
Expand Down

0 comments on commit 3223f28

Please sign in to comment.