Skip to content

Commit

Permalink
dynamics: move 'halo_info_mask' to module 'ice_dyn_shared'
Browse files Browse the repository at this point in the history
The masked halo 'halo_info_mask', used for halo updates when
'maskhalo_dyn' is true, is currently declared as a local variable in
each of the dynamics driver (subroutines 'evp', 'eap' and
'implicit_solver').

Make this variable a module variable in 'ice_dyn_shared', and 'use' this
variable in each of the dynamics drivers.

This has the benefit of not requiring 'halo_info_mask' to be passed to
'ice_HaloUpdate_vel' since this subroutine is in 'ice_dyn_shared' so it
has access to it. This allows it to be removed from the argument list
in a few subroutines in 'ice_dyn_vp'.
  • Loading branch information
phil-blain committed Aug 13, 2020
1 parent e609c48 commit af8d03e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 39 deletions.
11 changes: 4 additions & 7 deletions cicecore/cicedynB/dynamics/ice_dyn_eap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ subroutine eap (dt)
#endif

use ice_arrays_column, only: Cdn_ocn
use ice_boundary, only: ice_halo, ice_HaloMask, ice_HaloUpdate, &
use ice_boundary, only: ice_HaloMask, ice_HaloUpdate, &
ice_HaloDestroy
use ice_blocks, only: block, get_block
use ice_constants, only: field_loc_center, field_loc_NEcorner, &
Expand All @@ -122,7 +122,7 @@ subroutine eap (dt)
use ice_dyn_shared, only: fcor_blk, ndte, dtei, &
denom1, uvel_init, vvel_init, arlx1i, &
dyn_prep1, dyn_prep2, stepu, dyn_finish, &
basal_stress_coeff, basalstress, ice_HaloUpdate_vel
basal_stress_coeff, basalstress, halo_info_mask, ice_HaloUpdate_vel
use ice_flux, only: rdg_conv, strairxT, strairyT, &
strairx, strairy, uocn, vocn, ss_tltx, ss_tlty, iceumask, fm, &
strtltx, strtlty, strocnx, strocny, strintx, strinty, taubx, tauby, &
Expand Down Expand Up @@ -181,9 +181,6 @@ subroutine eap (dt)
icetmask, & ! ice extent mask (T-cell)
halomask ! ice mask for halo update

type (ice_halo) :: &
halo_info_mask ! ghost cell update info for masked halo

type (block) :: &
this_block ! block information for current block

Expand Down Expand Up @@ -373,7 +370,7 @@ subroutine eap (dt)
endif

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

!-----------------------------------------------------------------
! basal stress coefficients (landfast ice)
Expand Down Expand Up @@ -480,7 +477,7 @@ subroutine eap (dt)
enddo
!$TCXOMP END PARALLEL DO

call ice_HaloUpdate_vel(uvel, vvel, halo_info_mask)
call ice_HaloUpdate_vel(uvel, vvel)

enddo ! subcycling

Expand Down
11 changes: 4 additions & 7 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module ice_dyn_evp
subroutine evp (dt)

use ice_arrays_column, only: Cdn_ocn
use ice_boundary, only: ice_halo, ice_HaloMask, ice_HaloUpdate, &
use ice_boundary, only: ice_HaloMask, ice_HaloUpdate, &
ice_HaloDestroy, ice_HaloUpdate_stress
use ice_blocks, only: block, get_block, nx_block, ny_block, nghost
use ice_domain, only: nblocks, blocks_ice, halo_info, maskhalo_dyn
Expand All @@ -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, ice_HaloUpdate_vel
use ice_dyn_shared, only: kevp_kernel, halo_info_mask, ice_HaloUpdate_vel

real (kind=dbl_kind), intent(in) :: &
dt ! time step
Expand Down Expand Up @@ -136,9 +136,6 @@ subroutine evp (dt)
icetmask, & ! ice extent mask (T-cell)
halomask ! generic halo mask

type (ice_halo) :: &
halo_info_mask ! ghost cell update info for masked halo

type (block) :: &
this_block ! block information for current block

Expand Down Expand Up @@ -316,7 +313,7 @@ subroutine evp (dt)
endif

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

!-----------------------------------------------------------------
! basal stress coefficients (landfast ice)
Expand Down Expand Up @@ -429,7 +426,7 @@ subroutine evp (dt)
enddo
!$TCXOMP END PARALLEL DO

call ice_HaloUpdate_vel(uvel, vvel, halo_info_mask)
call ice_HaloUpdate_vel(uvel, vvel)

enddo ! subcycling
endif ! kevp_kernel
Expand Down
11 changes: 6 additions & 5 deletions cicecore/cicedynB/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module ice_dyn_shared
use ice_constants, only: c0, c1, c2, p01, p001
use ice_constants, only: omega, spval_dbl, p5, c4
use ice_blocks, only: nx_block, ny_block
use ice_boundary, only: ice_halo
use ice_domain_size, only: max_blocks
use ice_fileunits, only: nu_diag
use ice_exit, only: abort_ice
Expand Down Expand Up @@ -94,6 +95,9 @@ module ice_dyn_shared
! see keel data from Amundrud et al. 2004 (JGR)
u0 = 5e-5_dbl_kind ! residual velocity for basal stress (m/s)

type (ice_halo), public :: &
halo_info_mask ! ghost cell update info for masked halo

real (kind=dbl_kind), allocatable :: &
fld2(:,:,:,:) ! work array for boundary updates

Expand Down Expand Up @@ -1186,16 +1190,13 @@ end subroutine strain_rates
! Perform a halo update for the velocity field
! author: Philippe Blain, ECCC

subroutine ice_HaloUpdate_vel(uvel, vvel, halo_info_mask)
subroutine ice_HaloUpdate_vel(uvel, vvel)

use ice_boundary, only: ice_HaloUpdate, ice_halo
use ice_boundary, only: ice_HaloUpdate
use ice_constants, only: field_loc_NEcorner, field_type_vector
use ice_domain, only: halo_info, maskhalo_dyn, nblocks
use ice_timers, only: timer_bound, ice_timer_start, ice_timer_stop

type (ice_halo), intent(in) :: &
halo_info_mask ! ghost cell update info for masked halo

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(inout) :: &
uvel , & ! u components of velocity vector
vvel ! v components of velocity vector
Expand Down
27 changes: 7 additions & 20 deletions cicecore/cicedynB/dynamics/ice_dyn_vp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ subroutine implicit_solver (dt)
use ice_blocks, only: block, get_block, nx_block, ny_block
use ice_domain, only: blocks_ice, halo_info, maskhalo_dyn
use ice_domain_size, only: max_blocks, ncat
use ice_dyn_shared, only: deformations
use ice_dyn_shared, only: deformations, halo_info_mask
use ice_flux, only: rdg_conv, rdg_shear, strairxT, strairyT, &
strairx, strairy, uocn, vocn, ss_tltx, ss_tlty, iceumask, fm, &
strtltx, strtlty, strocnx, strocny, strintx, strinty, taubx, tauby, &
Expand Down Expand Up @@ -244,9 +244,6 @@ subroutine implicit_solver (dt)
icetmask, & ! ice extent mask (T-cell)
halomask ! generic halo mask

type (ice_halo) :: &
halo_info_mask ! ghost cell update info for masked halo

type (block) :: &
this_block ! block information for current block

Expand Down Expand Up @@ -433,7 +430,7 @@ subroutine implicit_solver (dt)
endif

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

!-----------------------------------------------------------------
! basal stress coefficients (landfast ice)
Expand Down Expand Up @@ -474,8 +471,7 @@ subroutine implicit_solver (dt)
bxfix , byfix , &
umassdti, sol , &
fpresx , fpresy, &
zetaD , Cb , &
halo_info_mask)
zetaD , Cb )
!-----------------------------------------------------------------
! End of nonlinear iteration
!-----------------------------------------------------------------
Expand Down Expand Up @@ -657,8 +653,7 @@ subroutine anderson_solver (icellt , icellu, &
bxfix , byfix , &
umassdti, sol , &
fpresx , fpresy, &
zetaD , Cb , &
halo_info_mask)
zetaD , Cb )

use ice_arrays_column, only: Cdn_ocn
use ice_blocks, only: nx_block, ny_block
Expand Down Expand Up @@ -696,9 +691,6 @@ subroutine anderson_solver (icellt , icellu, &
real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks,4), intent(out) :: &
zetaD ! zetaD = 2zeta (viscous coeff)

type (ice_halo), intent(in) :: &
halo_info_mask ! ghost cell update info for masked halo

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(inout) :: &
fpresx , & ! fixed point residual vector, x components: fx = uvel - uprev_k
fpresy , & ! fixed point residual vector, y components: fy = vvel - vprev_k
Expand Down Expand Up @@ -918,7 +910,6 @@ subroutine anderson_solver (icellt , icellu, &
call fgmres (zetaD , &
Cb , vrel , &
umassdti , &
halo_info_mask, &
bx , by , &
diagx , diagy , &
reltol_fgmres , dim_fgmres, &
Expand Down Expand Up @@ -1069,7 +1060,7 @@ subroutine anderson_solver (icellt , icellu, &
uvel (:,:,:), vvel (:,:,:))

! Do halo update so that halo cells contain up to date info for advection
call ice_HaloUpdate_vel(uvel, vvel, halo_info_mask)
call ice_HaloUpdate_vel(uvel, vvel)

! Compute "progress" residual norm
!$OMP PARALLEL DO PRIVATE(iblk)
Expand Down Expand Up @@ -2636,7 +2627,6 @@ end subroutine qr_delete
subroutine fgmres (zetaD , &
Cb , vrel , &
umassdti , &
halo_info_mask , &
bx , by , &
diagx , diagy , &
tolerance, maxinner, &
Expand All @@ -2652,9 +2642,6 @@ subroutine fgmres (zetaD , &
Cb , & ! seabed stress coefficient
umassdti ! mass of U-cell/dte (kg/m^2 s)

type (ice_halo), intent(in) :: &
halo_info_mask ! ghost cell update info for masked halo

real (kind=dbl_kind), dimension(nx_block, ny_block, max_blocks), intent(in) :: &
bx , & ! Right hand side of the linear system (x components)
by , & ! Right hand side of the linear system (y components)
Expand Down Expand Up @@ -2839,8 +2826,8 @@ subroutine fgmres (zetaD , &
orig_basis_y(:,:,:,initer) = workspace_y

! Update workspace with boundary values
call ice_HaloUpdate_vel(workspace_x, workspace_y, &
halo_info_mask)
call ice_HaloUpdate_vel(workspace_x, workspace_y)

!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
call matvec (nx_block , ny_block , &
Expand Down

0 comments on commit af8d03e

Please sign in to comment.