Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change icetmask to logical consistent with iceumask, icenmask, iceemask #773

Merged
merged 8 commits into from
Oct 17, 2022
13 changes: 6 additions & 7 deletions cicecore/cicedynB/dynamics/ice_dyn_eap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ subroutine eap (dt)
stressm_1, stressm_2, stressm_3, stressm_4, &
stress12_1, stress12_2, stress12_3, stress12_4
use ice_grid, only: tmask, umask, dxT, dyT, dxhy, dyhx, cxp, cyp, cxm, cym, &
tarear, uarear, grid_average_X2Y, iceumask, &
tarear, uarear, grid_average_X2Y, icetmask, iceumask, &
grid_atm_dynu, grid_atm_dynv, grid_ocn_dynu, grid_ocn_dynv
use ice_state, only: aice, aiU, vice, vsno, uvel, vvel, divu, shear, &
aice_init, aice0, aicen, vicen, strength
Expand All @@ -163,8 +163,8 @@ subroutine eap (dt)
i, j, ij

integer (kind=int_kind), dimension(max_blocks) :: &
icellt , & ! no. of cells where icetmask = 1
icellu ! no. of cells where iceumask = 1
icellt , & ! no. of cells where icetmask = .true.
icellu ! no. of cells where iceumask = .true.

integer (kind=int_kind), dimension (nx_block*ny_block, max_blocks) :: &
indxti , & ! compressed index in i-direction
Expand Down Expand Up @@ -195,7 +195,6 @@ subroutine eap (dt)
calc_strair

integer (kind=int_kind), dimension (nx_block,ny_block,max_blocks) :: &
icetmask , & ! ice extent mask (T-cell)
halomask ! ice mask for halo update

type (ice_halo) :: &
Expand Down Expand Up @@ -342,7 +341,7 @@ subroutine eap (dt)

do j = 1, ny_block
do i = 1, nx_block
if (icetmask(i,j,iblk)==0) then
if (.not.icetmask(i,j,iblk)) then
if (tmask(i,j,iblk)) then
! structure tensor
a11_1(i,j,iblk) = p5
Expand Down Expand Up @@ -1172,7 +1171,7 @@ subroutine stress_eap (nx_block, ny_block, &
nx_block, ny_block, & ! block dimensions
ksub , & ! subcycling step
ndte , & ! number of subcycles
icellt ! no. of cells where icetmask = 1
icellt ! no. of cells where icetmask = .true.

integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxti , & ! compressed index in i-direction
Expand Down Expand Up @@ -1877,7 +1876,7 @@ subroutine stepa (nx_block, ny_block, &

integer (kind=int_kind), intent(in) :: &
nx_block, ny_block, & ! block dimensions
icellt ! no. of cells where icetmask = 1
icellt ! no. of cells where icetmask = .true.

real (kind=dbl_kind), intent(in) :: &
dtei ! 1/dte, where dte is subcycling timestep (1/s)
Expand Down
23 changes: 11 additions & 12 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ subroutine evp (dt)
stresspT, stressmT, stress12T, &
stresspU, stressmU, stress12U
use ice_grid, only: tmask, umask, umaskCD, nmask, emask, uvm, epm, npm, &
iceumask, iceemask, icenmask, &
icetmask, iceumask, iceemask, icenmask, &
dxE, dxN, dxT, dxU, dyE, dyN, dyT, dyU, &
ratiodxN, ratiodxNr, ratiodyE, ratiodyEr, &
dxhy, dyhx, cxp, cyp, cxm, cym, &
Expand Down Expand Up @@ -130,7 +130,7 @@ subroutine evp (dt)
i, j, ij ! local indices

integer (kind=int_kind), dimension(max_blocks) :: &
icellt , & ! no. of cells where icetmask = 1
icellt , & ! no. of cells where icetmask = .true.
icelln , & ! no. of cells where icenmask = .true.
icelle , & ! no. of cells where iceemask = .true.
icellu ! no. of cells where iceumask = .true.
Expand Down Expand Up @@ -207,7 +207,6 @@ subroutine evp (dt)
calc_strair ! calculate air/ice stress

integer (kind=int_kind), dimension (nx_block,ny_block,max_blocks) :: &
icetmask, & ! ice extent mask (T-cell)
halomask ! generic halo mask

type (ice_halo) :: &
Expand Down Expand Up @@ -548,7 +547,7 @@ subroutine evp (dt)
stressmU (i,j,iblk) = c0
stress12U(i,j,iblk) = c0
endif
if (icetmask(i,j,iblk) == 0) then
if (.not.icetmask(i,j,iblk)) then
stresspT (i,j,iblk) = c0
stressmT (i,j,iblk) = c0
stress12T(i,j,iblk) = c0
Expand Down Expand Up @@ -618,11 +617,11 @@ subroutine evp (dt)
jhi = this_block%jhi
do j = jlo,jhi
do i = ilo,ihi
if (icetmask(i ,j ,iblk) /= 0 .or. &
icetmask(i-1,j ,iblk) /= 0 .or. &
icetmask(i+1,j ,iblk) /= 0 .or. &
icetmask(i ,j-1,iblk) /= 0 .or. &
icetmask(i ,j+1,iblk) /= 0) then
if (icetmask(i ,j ,iblk) .or. &
icetmask(i-1,j ,iblk) .or. &
icetmask(i+1,j ,iblk) .or. &
icetmask(i ,j-1,iblk) .or. &
icetmask(i ,j+1,iblk)) then
halomask(i,j,iblk) = 1
endif
enddo
Expand Down Expand Up @@ -1359,7 +1358,7 @@ subroutine stress (nx_block, ny_block, &

integer (kind=int_kind), intent(in) :: &
nx_block, ny_block, & ! block dimensions
icellt ! no. of cells where icetmask = 1
icellt ! no. of cells where icetmask = .true.

integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxti , & ! compressed index in i-direction
Expand Down Expand Up @@ -1656,7 +1655,7 @@ subroutine stressC_T (nx_block, ny_block , &

integer (kind=int_kind), intent(in) :: &
nx_block, ny_block, & ! block dimensions
icellt ! no. of cells where icetmask = 1
icellt ! no. of cells where icetmask = .true.

integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxti , & ! compressed index in i-direction
Expand Down Expand Up @@ -1862,7 +1861,7 @@ subroutine stressCD_T (nx_block, ny_block, &

integer (kind=int_kind), intent(in) :: &
nx_block, ny_block, & ! block dimensions
icellt ! no. of cells where icetmask = 1
icellt ! no. of cells where icetmask = .true.

integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxti , & ! compressed index in i-direction
Expand Down
32 changes: 12 additions & 20 deletions cicecore/cicedynB/dynamics/ice_dyn_evp_1d.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,7 @@ subroutine ice_dyn_evp_1d_copyin(nx, ny, nblk, nx_glob, ny_glob, &

integer(int_kind), intent(in) :: nx, ny, nblk, nx_glob, ny_glob
logical(kind=log_kind), dimension(nx, ny, nblk), intent(in) :: &
I_iceumask
integer(kind=int_kind), dimension(nx, ny, nblk), intent(in) :: &
I_icetmask
I_icetmask, I_iceumask
real(kind=dbl_kind), dimension(nx, ny, nblk), intent(in) :: &
I_cdn_ocn, I_aiu, I_uocn, I_vocn, I_forcex, I_forcey, I_Tbu, &
I_umassdti, I_fm, I_uarear, I_tarear, I_strintx, I_strinty, &
Expand All @@ -1049,9 +1047,7 @@ subroutine ice_dyn_evp_1d_copyin(nx, ny, nblk, nx_glob, ny_glob, &
! local variables

logical(kind=log_kind), dimension(nx_glob, ny_glob) :: &
G_iceumask
integer(kind=int_kind), dimension(nx_glob, ny_glob) :: &
G_icetmask
G_icetmask, G_iceumask
real(kind=dbl_kind), dimension(nx_glob, ny_glob) :: &
G_cdn_ocn, G_aiu, G_uocn, G_vocn, G_forcex, G_forcey, G_Tbu, &
G_umassdti, G_fm, G_uarear, G_tarear, G_strintx, G_strinty, &
Expand Down Expand Up @@ -1344,10 +1340,8 @@ subroutine calc_na(nx, ny, na, icetmask, iceumask)
implicit none

integer(kind=int_kind), intent(in) :: nx, ny
integer(kind=int_kind), dimension(nx, ny), intent(in) :: &
icetmask
logical(kind=log_kind), dimension(nx, ny), intent(in) :: &
iceumask
icetmask, iceumask
integer(kind=int_kind), intent(out) :: na

! local variables
Expand All @@ -1360,7 +1354,7 @@ subroutine calc_na(nx, ny, na, icetmask, iceumask)
! NOTE: T mask includes northern and eastern ghost cells
do j = 1 + nghost, ny
do i = 1 + nghost, nx
if (icetmask(i,j) == 1 .or. iceumask(i,j)) na = na + 1
if (icetmask(i,j) .or. iceumask(i,j)) na = na + 1
end do
end do

Expand All @@ -1375,10 +1369,8 @@ subroutine calc_2d_indices(nx, ny, na, icetmask, iceumask)
implicit none

integer(kind=int_kind), intent(in) :: nx, ny, na
integer(kind=int_kind), dimension(nx, ny), intent(in) :: &
icetmask
logical(kind=log_kind), dimension(nx, ny), intent(in) :: &
iceumask
icetmask, iceumask

! local variables

Expand All @@ -1394,11 +1386,11 @@ subroutine calc_2d_indices(nx, ny, na, icetmask, iceumask)
! NOTE: T mask includes northern and eastern ghost cells
do j = 1 + nghost, ny
do i = 1 + nghost, nx
if (icetmask(i,j) == 1 .or. iceumask(i,j)) then
if (icetmask(i,j) .or. iceumask(i,j)) then
Nmaskt = Nmaskt + 1
indi(Nmaskt) = i
indj(Nmaskt) = j
if (icetmask(i,j) /= 1) skiptcell(Nmaskt) = .true.
if (.not. icetmask(i,j)) skiptcell(Nmaskt) = .true.
if (.not. iceumask(i,j)) skipucell(Nmaskt) = .true.
! NOTE: U mask does not include northern and eastern
! ghost cells. Skip northern and eastern ghost cells
Expand Down Expand Up @@ -1593,7 +1585,7 @@ subroutine calc_halo_parent(nx, ny, na, navel, I_icetmask)
implicit none

integer(kind=int_kind), intent(in) :: nx, ny, na, navel
integer(kind=int_kind), dimension(nx, ny), intent(in) :: &
logical(kind=log_kind), dimension(nx, ny), intent(in) :: &
I_icetmask

! local variables
Expand All @@ -1619,10 +1611,10 @@ subroutine calc_halo_parent(nx, ny, na, navel, I_icetmask)
j = int((indij(iw) - 1) / (nx)) + 1
i = indij(iw) - (j - 1) * nx
! if within ghost zone
if (i == nx .and. I_icetmask(2, j) == 1) Ihalo(iw) = 2 + (j - 1) * nx
if (i == 1 .and. I_icetmask(nx - 1, j) == 1) Ihalo(iw) = (nx - 1) + (j - 1) * nx
if (j == ny .and. I_icetmask(i, 2) == 1) Ihalo(iw) = i + nx
if (j == 1 .and. I_icetmask(i, ny - 1) == 1) Ihalo(iw) = i + (ny - 2) * nx
if (i == nx .and. I_icetmask(2, j) ) Ihalo(iw) = 2 + (j - 1) * nx
if (i == 1 .and. I_icetmask(nx - 1, j) ) Ihalo(iw) = (nx - 1) + (j - 1) * nx
if (j == ny .and. I_icetmask(i, 2) ) Ihalo(iw) = i + nx
if (j == 1 .and. I_icetmask(i, ny - 1) ) Ihalo(iw) = i + (ny - 2) * nx
end do

! relate halo indices to indij vector
Expand Down
Loading