Skip to content

Commit 07a7cda

Browse files
“Your“Your
“Your
authored and
“Your
committed
Optimize ESMF atm to xgrid by sending once and then copying into the rest of the levels.
1 parent 20fdeff commit 07a7cda

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

exec/qksrt_partition__genmod.f90

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
!COMPILER-GENERATED INTERFACE MODULE: Mon Feb 24 21:00:35 2020
1+
!COMPILER-GENERATED INTERFACE MODULE: Tue Mar 10 22:11:05 2020
22
! This source file is for reference only and may not completely
33
! represent the generated interface used by the compiler.
44
MODULE QKSRT_PARTITION__genmod

exec/qksrt_quicksort__genmod.f90

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
!COMPILER-GENERATED INTERFACE MODULE: Mon Feb 24 21:00:35 2020
1+
!COMPILER-GENERATED INTERFACE MODULE: Tue Mar 10 22:11:05 2020
22
! This source file is for reference only and may not completely
33
! represent the generated interface used by the compiler.
44
MODULE QKSRT_QUICKSORT__genmod

src/shared/exchange/xgrid.F90

+21-7
Original file line numberDiff line numberDiff line change
@@ -3613,17 +3613,31 @@ subroutine esmf_wrap_put_side1_to_xgrid(ew_s1, ew_x, xmap)
36133613
type (xmap_type), intent(inout) :: xmap
36143614
integer :: rc
36153615
integer :: k
3616+
real(ESMF_KIND_R8), dimension(:), pointer :: x_level_1=>NULL()
3617+
real(ESMF_KIND_R8), dimension(:), pointer :: x_level_k=>NULL()
36163618

36173619
! Start timer
36183620
call mpp_clock_begin(id_put_1_to_xgrid_order_1)
36193621

3620-
! Loop regridding fields
3621-
do k = 1, ew_x%num_fields
3622-
call ESMF_FieldRegrid(ew_s1%fields(1), ew_x%fields(k), &
3623-
routehandle=xmap%grids(ew_s1%grid_index)%g2x, &
3624-
termorderflag=ESMF_TERMORDER_SRCSEQ, &
3625-
rc=rc)
3626-
if(rc /= ESMF_SUCCESS) call error_mesg("put_side2_to_xgrid", "fail at ESMF_FieldRegrid", FATAL)
3622+
! Regrid once
3623+
call ESMF_FieldRegrid(ew_s1%fields(1), ew_x%fields(1), &
3624+
routehandle=xmap%grids(ew_s1%grid_index)%g2x, &
3625+
termorderflag=ESMF_TERMORDER_SRCSEQ, &
3626+
rc=rc)
3627+
if(rc /= ESMF_SUCCESS) call error_mesg("put_side2_to_xgrid", "fail at ESMF_FieldRegrid", FATAL)
3628+
3629+
! Get pointer from xgrid level 1 Field
3630+
call ESMF_FieldGet(ew_x%fields(1), farrayPtr=x_level_1, rc=rc)
3631+
if(rc /= ESMF_SUCCESS) call error_mesg("get_side1_from_xgrid", "fail at ESMF_FieldGet()", FATAL)
3632+
3633+
! Copy field 1 to the rest of the fields
3634+
do k = 2, ew_x%num_fields
3635+
! Get pointer from xgrid level Field
3636+
call ESMF_FieldGet(ew_x%fields(k), farrayPtr=x_level_k, rc=rc)
3637+
if(rc /= ESMF_SUCCESS) call error_mesg("get_side1_from_xgrid", "fail at ESMF_FieldGet()", FATAL)
3638+
3639+
! Assign level k to level 1
3640+
x_level_k=x_level_1
36273641
enddo
36283642

36293643
! Stop timer

0 commit comments

Comments
 (0)