Skip to content

Commit

Permalink
ice_dyn_evp: use ice_HaloUpdate_vel
Browse files Browse the repository at this point in the history
Now that the subroutine is in ice_dyn_shared, use it to increase
core reuse.
  • Loading branch information
phil-blain committed Aug 25, 2020
1 parent 64d7bcc commit e85bca8
Showing 1 changed file with 5 additions and 42 deletions.
47 changes: 5 additions & 42 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ subroutine evp (dt)
ice_timer_start, ice_timer_stop, timer_evp_1d, timer_evp_2d
use ice_dyn_evp_1d, only: ice_dyn_evp_1d_copyin, ice_dyn_evp_1d_kernel, &
ice_dyn_evp_1d_copyout
use ice_dyn_shared, only: kevp_kernel
use ice_dyn_shared, only: kevp_kernel, ice_HaloUpdate_vel

real (kind=dbl_kind), intent(in) :: &
dt ! time step
Expand Down Expand Up @@ -127,8 +127,6 @@ subroutine evp (dt)
umass , & ! total mass of ice and snow (u grid)
umassdti ! mass of U-cell/dte (kg/m^2 s)

real (kind=dbl_kind), allocatable :: fld2(:,:,:,:)

real (kind=dbl_kind), dimension(nx_block,ny_block,8):: &
strtmp ! stress combinations for momentum equation

Expand All @@ -154,8 +152,6 @@ subroutine evp (dt)
! Initialize
!-----------------------------------------------------------------

allocate(fld2(nx_block,ny_block,2,max_blocks))

! This call is needed only if dt changes during runtime.
! call set_evp_parameters (dt)

Expand Down Expand Up @@ -297,10 +293,6 @@ subroutine evp (dt)
strength = strength(i,j, iblk) )
enddo ! ij

! load velocity into array for boundary updates
fld2(:,:,1,iblk) = uvel(:,:,iblk)
fld2(:,:,2,iblk) = vvel(:,:,iblk)

enddo ! iblk
!$TCXOMP END PARALLEL DO

Expand All @@ -311,19 +303,8 @@ subroutine evp (dt)
call ice_timer_start(timer_bound)
call ice_HaloUpdate (strength, halo_info, &
field_loc_center, field_type_scalar)
! velocities may have changed in dyn_prep2
call ice_HaloUpdate (fld2, halo_info, &
field_loc_NEcorner, field_type_vector)
call ice_timer_stop(timer_bound)

! unload
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
uvel(:,:,iblk) = fld2(:,:,1,iblk)
vvel(:,:,iblk) = fld2(:,:,2,iblk)
enddo
!$OMP END PARALLEL DO

if (maskhalo_dyn) then
call ice_timer_start(timer_bound)
halomask = 0
Expand All @@ -334,6 +315,9 @@ subroutine evp (dt)
call ice_HaloMask(halo_info_mask, halo_info, halomask)
endif

! velocities may have changed in dyn_prep2
call ice_HaloUpdate_vel(uvel, vvel, halo_info_mask)

!-----------------------------------------------------------------
! basal stress coefficients (landfast ice)
!-----------------------------------------------------------------
Expand Down Expand Up @@ -442,36 +426,15 @@ subroutine evp (dt)
uvel_init(:,:,iblk), vvel_init(:,:,iblk),&
uvel (:,:,iblk), vvel (:,:,iblk), &
Tbu (:,:,iblk))

! load velocity into array for boundary updates
fld2(:,:,1,iblk) = uvel(:,:,iblk)
fld2(:,:,2,iblk) = vvel(:,:,iblk)
enddo
!$TCXOMP END PARALLEL DO

call ice_timer_start(timer_bound)
if (maskhalo_dyn) then
call ice_HaloUpdate (fld2, halo_info_mask, &
field_loc_NEcorner, field_type_vector)
else
call ice_HaloUpdate (fld2, halo_info, &
field_loc_NEcorner, field_type_vector)
endif
call ice_timer_stop(timer_bound)

! unload
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
uvel(:,:,iblk) = fld2(:,:,1,iblk)
vvel(:,:,iblk) = fld2(:,:,2,iblk)
enddo
!$OMP END PARALLEL DO
call ice_HaloUpdate_vel(uvel, vvel, halo_info_mask)

enddo ! subcycling
endif ! kevp_kernel
call ice_timer_stop(timer_evp_2d)

deallocate(fld2)
if (maskhalo_dyn) call ice_HaloDestroy(halo_info_mask)

! Force symmetry across the tripole seam
Expand Down

0 comments on commit e85bca8

Please sign in to comment.