@@ -258,16 +258,6 @@ subroutine mpas_reconstruct_2d(meshPool, u, uReconstructX, uReconstructY, uRecon
258258
259259 call mpas_pool_get_config(meshPool, ' on_a_sphere' , on_a_sphere)
260260
261- MPAS_ACC_TIMER_START(' mpas_reconstruct_2d [ACC_data_xfer]' )
262- ! Only use sections needed, nCells may be all cells or only non- halo cells
263- !$acc enter data copyin(coeffs_reconstruct(:,:,1 :nCells),nEdgesOnCell(1 :nCells), &
264- !$acc edgesOnCell(:,1 :nCells),latCell(1 :nCells),lonCell(1 :nCells))
265- !$acc enter data copyin(u(:,:))
266- !$acc enter data create(uReconstructX(:,1 :nCells),uReconstructY(:,1 :nCells), &
267- !$acc uReconstructZ(:,1 :nCells),uReconstructZonal(:,1 :nCells), &
268- !$acc uReconstructMeridional(:,1 :nCells))
269- MPAS_ACC_TIMER_STOP(' mpas_reconstruct_2d [ACC_data_xfer]' )
270-
271261 ! loop over cell centers
272262 !$omp do schedule(runtime)
273263 !$acc parallel default(present)
@@ -337,6 +327,109 @@ subroutine mpas_reconstruct_2d(meshPool, u, uReconstructX, uReconstructY, uRecon
337327 !$omp end do
338328 end if
339329
330+ end subroutine mpas_reconstruct_2d !}}}
331+
332+
333+ subroutine mpas_reconstruct_2d_h2d (meshPool , u , uReconstructX , uReconstructY , uReconstructZ , uReconstructZonal , uReconstructMeridional , includeHalos )!{{{
334+
335+ implicit none
336+
337+ type (mpas_pool_type), intent (in ) :: meshPool !< Input: Mesh information
338+ real (kind= RKIND), dimension (:,:), intent (in ) :: u !< Input: Velocity field on edges
339+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructX !< Output: X Component of velocity reconstructed to cell centers
340+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructY !< Output: Y Component of velocity reconstructed to cell centers
341+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructZ !< Output: Z Component of velocity reconstructed to cell centers
342+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructZonal !< Output: Zonal Component of velocity reconstructed to cell centers
343+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructMeridional !< Output: Meridional Component of velocity reconstructed to cell centers
344+ logical , optional, intent (in ) :: includeHalos !< Input: Optional logical that allows reconstruction over halo regions
345+
346+ logical :: includeHalosLocal
347+ integer , dimension (:,:), pointer :: edgesOnCell
348+ integer , dimension (:), pointer :: nEdgesOnCell
349+ integer :: nCells
350+ integer , pointer :: nCells_ptr
351+ real (kind= RKIND), dimension (:), pointer :: latCell, lonCell
352+ real (kind= RKIND), dimension (:,:,:), pointer :: coeffs_reconstruct
353+
354+ if ( present (includeHalos) ) then
355+ includeHalosLocal = includeHalos
356+ else
357+ includeHalosLocal = .false.
358+ end if
359+
360+ ! stored arrays used during compute procedure
361+ call mpas_pool_get_array(meshPool, ' coeffs_reconstruct' , coeffs_reconstruct)
362+
363+ ! temporary variables
364+ call mpas_pool_get_array(meshPool, ' nEdgesOnCell' , nEdgesOnCell)
365+ call mpas_pool_get_array(meshPool, ' edgesOnCell' , edgesOnCell)
366+ call mpas_pool_get_array(meshPool, ' latCell' , latCell)
367+ call mpas_pool_get_array(meshPool, ' lonCell' , lonCell)
368+
369+ if ( includeHalosLocal ) then
370+ call mpas_pool_get_dimension(meshPool, ' nCells' , nCells_ptr)
371+ else
372+ call mpas_pool_get_dimension(meshPool, ' nCellsSolve' , nCells_ptr)
373+ end if
374+ nCells = nCells_ptr
375+
376+ MPAS_ACC_TIMER_START(' mpas_reconstruct_2d [ACC_data_xfer]' )
377+ ! Only use sections needed, nCells may be all cells or only non- halo cells
378+ !$acc enter data copyin(coeffs_reconstruct(:,:,1 :nCells),nEdgesOnCell(1 :nCells), &
379+ !$acc edgesOnCell(:,1 :nCells),latCell(1 :nCells),lonCell(1 :nCells))
380+ !$acc enter data copyin(u(:,:))
381+ !$acc enter data create(uReconstructX(:,1 :nCells),uReconstructY(:,1 :nCells), &
382+ !$acc uReconstructZ(:,1 :nCells),uReconstructZonal(:,1 :nCells), &
383+ !$acc uReconstructMeridional(:,1 :nCells))
384+ MPAS_ACC_TIMER_STOP(' mpas_reconstruct_2d [ACC_data_xfer]' )
385+
386+ end subroutine mpas_reconstruct_2d_h2d
387+
388+
389+
390+ subroutine mpas_reconstruct_2d_d2h (meshPool , u , uReconstructX , uReconstructY , uReconstructZ , uReconstructZonal , uReconstructMeridional , includeHalos )!{{{
391+
392+ implicit none
393+
394+ type (mpas_pool_type), intent (in ) :: meshPool !< Input: Mesh information
395+ real (kind= RKIND), dimension (:,:), intent (in ) :: u !< Input: Velocity field on edges
396+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructX !< Output: X Component of velocity reconstructed to cell centers
397+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructY !< Output: Y Component of velocity reconstructed to cell centers
398+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructZ !< Output: Z Component of velocity reconstructed to cell centers
399+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructZonal !< Output: Zonal Component of velocity reconstructed to cell centers
400+ real (kind= RKIND), dimension (:,:), intent (out ) :: uReconstructMeridional !< Output: Meridional Component of velocity reconstructed to cell centers
401+ logical , optional, intent (in ) :: includeHalos !< Input: Optional logical that allows reconstruction over halo regions
402+
403+ logical :: includeHalosLocal
404+ integer , dimension (:,:), pointer :: edgesOnCell
405+ integer , dimension (:), pointer :: nEdgesOnCell
406+ integer :: nCells
407+ integer , pointer :: nCells_ptr
408+ real (kind= RKIND), dimension (:), pointer :: latCell, lonCell
409+ real (kind= RKIND), dimension (:,:,:), pointer :: coeffs_reconstruct
410+
411+ if ( present (includeHalos) ) then
412+ includeHalosLocal = includeHalos
413+ else
414+ includeHalosLocal = .false.
415+ end if
416+
417+ ! stored arrays used during compute procedure
418+ call mpas_pool_get_array(meshPool, ' coeffs_reconstruct' , coeffs_reconstruct)
419+
420+ ! temporary variables
421+ call mpas_pool_get_array(meshPool, ' nEdgesOnCell' , nEdgesOnCell)
422+ call mpas_pool_get_array(meshPool, ' edgesOnCell' , edgesOnCell)
423+ call mpas_pool_get_array(meshPool, ' latCell' , latCell)
424+ call mpas_pool_get_array(meshPool, ' lonCell' , lonCell)
425+
426+ if ( includeHalosLocal ) then
427+ call mpas_pool_get_dimension(meshPool, ' nCells' , nCells_ptr)
428+ else
429+ call mpas_pool_get_dimension(meshPool, ' nCellsSolve' , nCells_ptr)
430+ end if
431+ nCells = nCells_ptr
432+
340433 MPAS_ACC_TIMER_START(' mpas_reconstruct_2d [ACC_data_xfer]' )
341434 !$acc exit data delete(coeffs_reconstruct(:,:,1 :nCells),nEdgesOnCell(1 :nCells), &
342435 !$acc edgesOnCell(:,1 :nCells),latCell(1 :nCells),lonCell(1 :nCells))
@@ -346,7 +439,7 @@ subroutine mpas_reconstruct_2d(meshPool, u, uReconstructX, uReconstructY, uRecon
346439 !$acc uReconstructMeridional(:,1 :nCells))
347440 MPAS_ACC_TIMER_STOP(' mpas_reconstruct_2d [ACC_data_xfer]' )
348441
349- end subroutine mpas_reconstruct_2d !}}}
442+ end subroutine mpas_reconstruct_2d_d2h
350443
351444
352445!***********************************************************************
0 commit comments