diff --git a/cicecore/cicedyn/dynamics/ice_transport_remap.F90 b/cicecore/cicedyn/dynamics/ice_transport_remap.F90 index ce545df87..0fc4c08ef 100644 --- a/cicecore/cicedyn/dynamics/ice_transport_remap.F90 +++ b/cicecore/cicedyn/dynamics/ice_transport_remap.F90 @@ -317,7 +317,7 @@ subroutine init_remap !------------------------------------------------------------------- if (grid_ice == 'CD' .or. grid_ice == 'C') then - l_fixed_area = .false. !jlem temporary + l_fixed_area = .true. else l_fixed_area = .false. endif @@ -356,7 +356,7 @@ subroutine horizontal_remap (dt, ntrace, & use ice_domain, only: nblocks, blocks_ice, halo_info, maskhalo_remap use ice_blocks, only: block, get_block, nghost use ice_grid, only: HTE, HTN, dxu, dyu, & - tarear, hm, & + earea, narea, tarear, hm, & xav, yav, xxav, yyav ! xyav, xxxav, xxyav, xyyav, yyyav use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound @@ -728,6 +728,7 @@ subroutine horizontal_remap (dt, ntrace, & indxing(:,:), indxjng(:,:), & dpx (:,:,iblk), dpy(:,:,iblk), & dxu (:,:,iblk), dyu(:,:,iblk), & + earea (:,:,iblk), narea (:,:,iblk), & xp (:,:,:,:), yp (:,:,:,:), & iflux, jflux, & triarea, edgearea_e(:,:)) @@ -787,6 +788,7 @@ subroutine horizontal_remap (dt, ntrace, & indxing(:,:), indxjng(:,:), & dpx (:,:,iblk), dpy (:,:,iblk), & dxu (:,:,iblk), dyu (:,:,iblk), & + earea (:,:,iblk), narea (:,:,iblk), & xp (:,:,:,:), yp(:,:,:,:), & iflux, jflux, & triarea, edgearea_n(:,:)) @@ -1706,6 +1708,7 @@ subroutine locate_triangles (nx_block, ny_block, & indxi, indxj, & dpx, dpy, & dxu, dyu, & + earea, narea, & xp, yp, & iflux, jflux, & triarea, edgearea) @@ -1722,7 +1725,9 @@ subroutine locate_triangles (nx_block, ny_block, & dpx , & ! x coordinates of departure points at cell corners dpy , & ! y coordinates of departure points at cell corners dxu , & ! E-W dimension of U-cell (m) - dyu ! N-S dimension of U-cell (m) + dyu , & ! N-S dimension of U-cell (m) + earea , & ! area of E-cell + narea ! area of N-cell real (kind=dbl_kind), dimension (nx_block,ny_block,0:nvert,ngroups), intent(out) :: & xp, yp ! coordinates of triangle vertices @@ -1749,7 +1754,7 @@ subroutine locate_triangles (nx_block, ny_block, & integer (kind=int_kind) :: & i, j, ij, ic , & ! horizontal indices - ib, ie, jb, je , & ! limits for loops over edges + ib, jb , & ! limits for loops for bugcheck ng, nv , & ! triangle indices ishift , jshift , & ! differences between neighbor cells ishift_tl, jshift_tl , & ! i,j indices of TL cell relative to edge @@ -1757,7 +1762,13 @@ subroutine locate_triangles (nx_block, ny_block, & ishift_tr, jshift_tr , & ! i,j indices of TR cell relative to edge ishift_br, jshift_br , & ! i,j indices of BR cell relative to edge ishift_tc, jshift_tc , & ! i,j indices of TC cell relative to edge - ishift_bc, jshift_bc ! i,j indices of BC cell relative to edge + ishift_bc, jshift_bc , & ! i,j indices of BC cell relative to edge + is_l, js_l , & ! i,j shifts for TL1, BL2 for area consistency + is_r, js_r , & ! i,j shifts for TR1, BR2 for area consistency + ise_tl, jse_tl , & ! i,j of TL other edge relative to edge + ise_bl, jse_bl , & ! i,j of BL other edge relative to edge + ise_tr, jse_tr , & ! i,j of TR other edge relative to edge + ise_br, jse_br ! i,j of BR other edge relative to edge integer (kind=int_kind) :: & icellsd ! number of cells where departure area > 0. @@ -1768,9 +1779,8 @@ subroutine locate_triangles (nx_block, ny_block, & real (kind=dbl_kind), dimension(nx_block,ny_block) :: & dx, dy , & ! scaled departure points - areafac_c , & ! area scale factor at center of edge - areafac_l , & ! area scale factor at left corner - areafac_r ! area scale factor at right corner + areafac_c , & ! earea or narea + areafac_ce ! areafac_c on other edge (narea or earea) real (kind=dbl_kind) :: & xcl, ycl , & ! coordinates of left corner point @@ -1860,9 +1870,9 @@ subroutine locate_triangles (nx_block, ny_block, & if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - areafac_c(:,:) = c0 - areafac_l(:,:) = c0 - areafac_r(:,:) = c0 + areafac_c(:,:) = c0 + areafac_ce(:,:) = c0 + do ng = 1, ngroups do j = 1, ny_block do i = 1, nx_block @@ -1884,13 +1894,6 @@ subroutine locate_triangles (nx_block, ny_block, & if (trim(edge) == 'north') then - ! loop size - - ib = ilo - ie = ihi - jb = jlo - nghost ! lowest j index is a ghost cell - je = jhi - ! index shifts for neighbor cells ishift_tl = -1 @@ -1906,24 +1909,42 @@ subroutine locate_triangles (nx_block, ny_block, & ishift_bc = 0 jshift_bc = 0 + ! index shifts for TL1, BL2, TR1 and BR2 for area consistency + + is_l = -1 + js_l = 0 + is_r = 1 + js_r = 0 + + ! index shifts for neighbor east edges + + ise_tl = -1 + jse_tl = 1 + ise_bl = -1 + jse_bl = 0 + ise_tr = 0 + jse_tr = 1 + ise_br = 0 + jse_br = 0 + ! area scale factor + ! earea, narea valid on halo - do j = jb, je - do i = ib, ie - areafac_l(i,j) = dxu(i-1,j)*dyu(i-1,j) - areafac_r(i,j) = dxu(i ,j)*dyu(i ,j) - areafac_c(i,j) = p5*(areafac_l(i,j) + areafac_r(i,j)) + do j = 1, ny_block + do i = 1, nx_block + areafac_c(i,j) = narea(i,j) enddo enddo - else ! east edge - - ! loop size + ! area scale factor for other edge (east) + + do j = 1, ny_block + do i = 1, nx_block + areafac_ce(i,j) = earea(i,j) + enddo + enddo - ib = ilo - nghost ! lowest i index is a ghost cell - ie = ihi - jb = jlo - je = jhi + else ! east edge ! index shifts for neighbor cells @@ -1940,13 +1961,38 @@ subroutine locate_triangles (nx_block, ny_block, & ishift_bc = 0 jshift_bc = 0 + ! index shifts for TL1, BL2, TR1 and BR2 for area consistency + + is_l = 0 + js_l = 1 + is_r = 0 + js_r = -1 + + ! index shifts for neighbor north edges + + ise_tl = 1 + jse_tl = 0 + ise_bl = 0 + jse_bl = 0 + ise_tr = 1 + jse_tr = -1 + ise_br = 0 + jse_br = -1 + ! area scale factors + ! earea, narea valid on halo + + do j = 1, ny_block + do i = 1, nx_block + areafac_c(i,j) = earea(i,j) + enddo + enddo - do j = jb, je - do i = ib, ie - areafac_l(i,j) = dxu(i,j )*dyu(i,j ) - areafac_r(i,j) = dxu(i,j-1)*dyu(i,j-1) - areafac_c(i,j) = p5 * (areafac_l(i,j) + areafac_r(i,j)) + ! area scale factor for other edge (north) + + do j = 1, ny_block + do i = 1, nx_block + areafac_ce(i,j) = narea(i,j) enddo enddo @@ -1958,8 +2004,8 @@ subroutine locate_triangles (nx_block, ny_block, & icellsd = 0 if (trim(edge) == 'north') then - do j = jb, je - do i = ib, ie + do j = jlo-1, jhi + do i = ilo, ihi if (dpx(i-1,j)/=c0 .or. dpy(i-1,j)/=c0 & .or. & dpx(i,j)/=c0 .or. dpy(i,j)/=c0) then @@ -1970,8 +2016,8 @@ subroutine locate_triangles (nx_block, ny_block, & enddo enddo else ! east edge - do j = jb, je - do i = ib, ie + do j = jlo, jhi + do i = ilo-1, ihi if (dpx(i,j-1)/=c0 .or. dpy(i,j-1)/=c0 & .or. & dpx(i,j)/=c0 .or. dpy(i,j)/=c0) then @@ -1987,8 +2033,8 @@ subroutine locate_triangles (nx_block, ny_block, & ! Scale the departure points !------------------------------------------------------------------- - do j = 1, je - do i = 1, ie + do j = 1, jhi + do i = 1, ihi dx(i,j) = dpx(i,j) / dxu(i,j) dy(i,j) = dpy(i,j) / dyu(i,j) enddo @@ -2056,6 +2102,13 @@ subroutine locate_triangles (nx_block, ny_block, & !------------------------------------------------------------------- ! Locate triangles in TL cell (NW for north edge, NE for east edge) ! and BL cell (W for north edge, N for east edge). + ! + ! areafact_c or areafac_ce (areafact_c for the other edge) are used + ! (with shifted indices) to make sure that a flux area on one edge + ! is consistent with the analogous area on the other edge and to + ! ensure that areas add up when using l_fixed_area = T. See PR #849 + ! for details. + ! !------------------------------------------------------------------- if (yil > c0 .and. xdl < xcl .and. ydl >= c0) then @@ -2071,7 +2124,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydl iflux (i,j,ng) = i + ishift_tl jflux (i,j,ng) = j + jshift_tl - areafact(i,j,ng) = -areafac_l(i,j) + areafact(i,j,ng) = -areafac_ce(i+ise_tl,j+jse_tl) elseif (yil < c0 .and. xdl < xcl .and. ydl < c0) then @@ -2086,7 +2139,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yil iflux (i,j,ng) = i + ishift_bl jflux (i,j,ng) = j + jshift_bl - areafact(i,j,ng) = areafac_l(i,j) + areafact(i,j,ng) = areafac_ce(i+ise_bl,j+jse_bl) elseif (yil < c0 .and. xdl < xcl .and. ydl >= c0) then @@ -2101,7 +2154,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yic iflux (i,j,ng) = i + ishift_tl jflux (i,j,ng) = j + jshift_tl - areafact(i,j,ng) = areafac_l(i,j) + areafact(i,j,ng) = areafac_c(i+is_l,j+js_l) ! BL1 (group 3) @@ -2114,7 +2167,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yil iflux (i,j,ng) = i + ishift_bl jflux (i,j,ng) = j + jshift_bl - areafact(i,j,ng) = areafac_l(i,j) + areafact(i,j,ng) = areafac_ce(i+ise_bl,j+jse_bl) elseif (yil > c0 .and. xdl < xcl .and. ydl < c0) then @@ -2129,7 +2182,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yic iflux (i,j,ng) = i + ishift_tl jflux (i,j,ng) = j + jshift_tl - areafact(i,j,ng) = -areafac_l(i,j) + areafact(i,j,ng) = -areafac_ce(i+ise_tl,j+jse_tl) ! BL2 (group 1) @@ -2142,7 +2195,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydl iflux (i,j,ng) = i + ishift_bl jflux (i,j,ng) = j + jshift_bl - areafact(i,j,ng) = -areafac_l(i,j) + areafact(i,j,ng) = -areafac_c(i+is_l,j+js_l) endif ! TL and BL triangles @@ -2164,7 +2217,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yir iflux (i,j,ng) = i + ishift_tr jflux (i,j,ng) = j + jshift_tr - areafact(i,j,ng) = -areafac_r(i,j) + areafact(i,j,ng) = -areafac_ce(i+ise_tr,j+jse_tr) elseif (yir < c0 .and. xdr >= xcr .and. ydr < c0) then @@ -2179,7 +2232,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydr iflux (i,j,ng) = i + ishift_br jflux (i,j,ng) = j + jshift_br - areafact(i,j,ng) = areafac_r(i,j) + areafact(i,j,ng) = areafac_ce(i+ise_br,j+jse_br) elseif (yir < c0 .and. xdr >= xcr .and. ydr >= c0) then @@ -2194,7 +2247,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydr iflux (i,j,ng) = i + ishift_tr jflux (i,j,ng) = j + jshift_tr - areafact(i,j,ng) = areafac_r(i,j) + areafact(i,j,ng) = areafac_c(i+is_r,j+js_r) ! BR1 (group 3) @@ -2207,7 +2260,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yic iflux (i,j,ng) = i + ishift_br jflux (i,j,ng) = j + jshift_br - areafact(i,j,ng) = areafac_r(i,j) + areafact(i,j,ng) = areafac_ce(i+ise_br,j+jse_br) elseif (yir > c0 .and. xdr >= xcr .and. ydr < c0) then @@ -2222,7 +2275,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yir iflux (i,j,ng) = i + ishift_tr jflux (i,j,ng) = j + jshift_tr - areafact(i,j,ng) = -areafac_r(i,j) + areafact(i,j,ng) = -areafac_ce(i+ise_tr,j+jse_tr) ! BR2 (group 2) @@ -2235,7 +2288,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yic iflux (i,j,ng) = i + ishift_br jflux (i,j,ng) = j + jshift_br - areafact(i,j,ng) = -areafac_r(i,j) + areafact(i,j,ng) = -areafac_c(i+is_r,j+js_r) endif ! TR and BR triangles @@ -2291,9 +2344,7 @@ subroutine locate_triangles (nx_block, ny_block, & ! region so that the sum of all triangle areas is equal to the ! prescribed value. ! If two triangles are in one grid cell and one is in the other, - ! then compute the area of the lone triangle using an area factor - ! corresponding to the adjacent corner. This is necessary to prevent - ! negative masses in some rare cases on curved grids. Then adjust + ! then compute the area of the lone triangle. Then adjust ! the area of the remaining two-triangle region so that the sum of ! all triangle areas has the prescribed value. !----------------------------------------------------------- @@ -2329,7 +2380,7 @@ subroutine locate_triangles (nx_block, ny_block, & endif yicr = c0 - elseif (xic < c0) then ! fix ICL = IC + elseif (xic < c0 .and. xic > xcl) then ! fix ICL = IC xicl = xic yicl = yic @@ -2338,8 +2389,8 @@ subroutine locate_triangles (nx_block, ny_block, & xdm = p5 * (xdr + xicl) ydm = p5 * ydr - ! compute area of triangle adjacent to left corner - area4 = p5 * (xcl - xic) * ydl * areafac_l(i,j) + ! compute area of (lone) triangle adjacent to left corner + area4 = p5 * (xcl - xic) * ydl * areafac_c(i,j) area_c = edgearea(i,j) - area1 - area2 - area3 - area4 ! shift midpoint so that area of remaining triangles = area_c @@ -2358,7 +2409,7 @@ subroutine locate_triangles (nx_block, ny_block, & endif yicr = c0 - elseif (xic >= c0) then ! fix ICR = IR + elseif (xic >= c0 .and. xic < xcr) then ! fix ICR = IR xicr = xic yicr = yic @@ -2367,7 +2418,8 @@ subroutine locate_triangles (nx_block, ny_block, & xdm = p5 * (xicr + xdl) ydm = p5 * ydl - area4 = p5 * (xic - xcr) * ydr * areafac_r(i,j) + ! compute area of (lone) triangle adjacent to right corner + area4 = p5 * (xic - xcr) * ydr * areafac_c(i,j) area_c = edgearea(i,j) - area1 - area2 - area3 - area4 ! shift midpoint so that area of remaining triangles = area_c @@ -2412,7 +2464,7 @@ subroutine locate_triangles (nx_block, ny_block, & iflux (i,j,ng) = i + ishift_tc jflux (i,j,ng) = j + jshift_tc areafact(i,j,ng) = -areafac_c(i,j) - + ! TC2a (group 5) ng = 5 @@ -2425,7 +2477,7 @@ subroutine locate_triangles (nx_block, ny_block, & iflux (i,j,ng) = i + ishift_tc jflux (i,j,ng) = j + jshift_tc areafact(i,j,ng) = -areafac_c(i,j) - + ! TC3a (group 6) ng = 6 @@ -2480,7 +2532,7 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - elseif (ydl < c0 .and. ydr < c0 .and. ydm < c0) then + elseif (ydl <= c0 .and. ydr <= c0 .and. ydm <= c0) then ! BC1a (group 4) @@ -2521,7 +2573,7 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - elseif (ydl < c0 .and. ydr < c0 .and. ydm >= c0) then ! rare + elseif (ydl <= c0 .and. ydr <= c0 .and. ydm > c0) then ! rare ! BC1b (group 4) @@ -2563,11 +2615,9 @@ subroutine locate_triangles (nx_block, ny_block, & areafact(i,j,ng) = -areafac_c(i,j) ! Now consider cases where the two DPs lie in different grid cells - ! For these cases, one triangle is given the area factor associated - ! with the adjacent corner, to avoid rare negative masses on curved grids. - elseif (ydl >= c0 .and. ydr < c0 .and. xic >= c0 & - .and. ydm >= c0) then + elseif (ydl > c0 .and. ydr < c0 .and. xic >= c0 & + .and. ydm >= c0) then ! TC1b (group 4) @@ -2582,7 +2632,7 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_tc areafact(i,j,ng) = -areafac_c(i,j) - ! BC2b (group 5) + ! BC2b (group 5) lone triangle ng = 5 xp (i,j,1,ng) = xcr @@ -2593,7 +2643,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydr iflux (i,j,ng) = i + ishift_bc jflux (i,j,ng) = j + jshift_bc - areafact(i,j,ng) = areafac_r(i,j) + areafact(i,j,ng) = areafac_c(i,j) ! TC3b (group 6) @@ -2608,8 +2658,8 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_tc areafact(i,j,ng) = -areafac_c(i,j) - elseif (ydl >= c0 .and. ydr < c0 .and. xic >= c0 & - .and. ydm < c0 ) then ! less common + elseif (ydl > c0 .and. ydr < c0 .and. xic >= c0 & + .and. ydm < c0 ) then ! less common ! TC1b (group 4) @@ -2624,7 +2674,7 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_tc areafact(i,j,ng) = -areafac_c(i,j) - ! BC2b (group 5) + ! BC2b (group 5) lone triangle ng = 5 xp (i,j,1,ng) = xcr @@ -2635,7 +2685,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydr iflux (i,j,ng) = i + ishift_bc jflux (i,j,ng) = j + jshift_bc - areafact(i,j,ng) = areafac_r(i,j) + areafact(i,j,ng) = areafac_c(i,j) ! BC3b (group 6) @@ -2650,10 +2700,10 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - elseif (ydl >= c0 .and. ydr < c0 .and. xic < c0 & - .and. ydm < c0) then + elseif (ydl > c0 .and. ydr < c0 .and. xic < c0 & + .and. ydm < c0) then - ! TC1b (group 4) + ! TC1b (group 4) lone triangle ng = 4 xp (i,j,1,ng) = xcl @@ -2664,7 +2714,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydl iflux (i,j,ng) = i + ishift_tc jflux (i,j,ng) = j + jshift_tc - areafact(i,j,ng) = -areafac_l(i,j) + areafact(i,j,ng) = -areafac_c(i,j) ! BC2b (group 5) @@ -2692,10 +2742,10 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - elseif (ydl >= c0 .and. ydr < c0 .and. xic < c0 & - .and. ydm >= c0) then ! less common + elseif (ydl > c0 .and. ydr < c0 .and. xic < c0 & + .and. ydm >= c0) then ! less common - ! TC1b (group 4) + ! TC1b (group 4) lone triangle ng = 4 xp (i,j,1,ng) = xcl @@ -2706,7 +2756,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = ydl iflux (i,j,ng) = i + ishift_tc jflux (i,j,ng) = j + jshift_tc - areafact(i,j,ng) = -areafac_l(i,j) + areafact(i,j,ng) = -areafac_c(i,j) ! BC2b (group 5) @@ -2734,10 +2784,10 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_tc areafact(i,j,ng) = -areafac_c(i,j) - elseif (ydl < c0 .and. ydr >= c0 .and. xic < c0 & - .and. ydm >= c0) then + elseif (ydl < c0 .and. ydr > c0 .and. xic < c0 & + .and. ydm >= c0) then - ! BC1b (group 4) + ! BC1b (group 4) lone triangle ng = 4 xp (i,j,1,ng) = xcl @@ -2748,7 +2798,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yicl iflux (i,j,ng) = i + ishift_bc jflux (i,j,ng) = j + jshift_bc - areafact(i,j,ng) = areafac_l(i,j) + areafact(i,j,ng) = areafac_c(i,j) ! TC2b (group 5) @@ -2776,10 +2826,10 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_tc areafact(i,j,ng) = -areafac_c(i,j) - elseif (ydl < c0 .and. ydr >= c0 .and. xic < c0 & - .and. ydm < c0) then ! less common + elseif (ydl < c0 .and. ydr > c0 .and. xic < c0 & + .and. ydm < c0) then ! less common - ! BC1b (group 4) + ! BC1b (group 4) lone triangle ng = 4 xp (i,j,1,ng) = xcl @@ -2790,7 +2840,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yicl iflux (i,j,ng) = i + ishift_bc jflux (i,j,ng) = j + jshift_bc - areafact(i,j,ng) = areafac_l(i,j) + areafact(i,j,ng) = areafac_c(i,j) ! TC2b (group 5) @@ -2818,8 +2868,8 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - elseif (ydl < c0 .and. ydr >= c0 .and. xic >= c0 & - .and. ydm < c0) then + elseif (ydl < c0 .and. ydr > c0 .and. xic >= c0 & + .and. ydm < c0) then ! BC1b (group 4) @@ -2834,7 +2884,7 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - ! TC2b (group 5) + ! TC2b (group 5) lone triangle ng = 5 xp (i,j,1,ng) = xcr @@ -2845,7 +2895,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yicr iflux (i,j,ng) = i + ishift_tc jflux (i,j,ng) = j + jshift_tc - areafact(i,j,ng) = -areafac_r(i,j) + areafact(i,j,ng) = -areafac_c(i,j) ! BC3b (group 6) @@ -2860,8 +2910,8 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - elseif (ydl < c0 .and. ydr >= c0 .and. xic >= c0 & - .and. ydm >= c0) then ! less common + elseif (ydl < c0 .and. ydr > c0 .and. xic >= c0 & + .and. ydm >= c0) then ! less common ! BC1b (group 4) @@ -2876,7 +2926,7 @@ subroutine locate_triangles (nx_block, ny_block, & jflux (i,j,ng) = j + jshift_bc areafact(i,j,ng) = areafac_c(i,j) - ! TC2b (group 5) + ! TC2b (group 5) lone triangle ng = 5 xp (i,j,1,ng) = xcr @@ -2887,7 +2937,7 @@ subroutine locate_triangles (nx_block, ny_block, & yp (i,j,3,ng) = yicr iflux (i,j,ng) = i + ishift_tc jflux (i,j,ng) = j + jshift_tc - areafact(i,j,ng) = -areafac_r(i,j) + areafact(i,j,ng) = -areafac_c(i,j) ! TC3b (group 6) @@ -2961,7 +3011,7 @@ subroutine locate_triangles (nx_block, ny_block, & do ij = 1, icellsd i = indxid(ij) j = indxjd(ij) - if (abs(areasum(i,j) - edgearea(i,j)) > eps13*areafac_c(i,j)) then + if ( abs(areasum(i,j) - edgearea(i,j)) > eps13*areafac_c(i,j) .and. abs(edgearea(i,j)) > c0 ) then write(nu_diag,*) '' write(nu_diag,*) 'Areas do not add up: m, i, j, edge =', & my_task, i, j, trim(edge) @@ -3023,10 +3073,17 @@ subroutine locate_triangles (nx_block, ny_block, & endif if (bugcheck) then + if (trim(edge) == 'north') then + ib = ilo + jb = jlo-1 + else ! east edge + ib = ilo-1 + jb = jlo + endif do ng = 1, ngroups do nv = 1, nvert - do j = jb, je - do i = ib, ie + do j = jb, jhi + do i = ib, ihi if (abs(triarea(i,j,ng)) > puny) then if (abs(xp(i,j,nv,ng)) > p5+puny) then write(nu_diag,*) '' diff --git a/cicecore/cicedyn/infrastructure/ice_grid.F90 b/cicecore/cicedyn/infrastructure/ice_grid.F90 index 770ee9ed9..160e3cc64 100644 --- a/cicecore/cicedyn/infrastructure/ice_grid.F90 +++ b/cicecore/cicedyn/infrastructure/ice_grid.F90 @@ -82,14 +82,14 @@ module ice_grid dyE , & ! height of E-cell through the middle (m) HTE , & ! length of eastern edge of T-cell (m) HTN , & ! length of northern edge of T-cell (m) - tarea , & ! area of T-cell (m^2) - uarea , & ! area of U-cell (m^2) - narea , & ! area of N-cell (m^2) - earea , & ! area of E-cell (m^2) - tarear , & ! 1/tarea - uarear , & ! 1/uarea - narear , & ! 1/narea - earear , & ! 1/earea + tarea , & ! area of T-cell (m^2), valid in halo + uarea , & ! area of U-cell (m^2), valid in halo + narea , & ! area of N-cell (m^2), valid in halo + earea , & ! area of E-cell (m^2), valid in halo + tarear , & ! 1/tarea, valid in halo + uarear , & ! 1/uarea, valid in halo + narear , & ! 1/narea, valid in halo + earear , & ! 1/earea, valid in halo tarean , & ! area of NH T-cells tareas , & ! area of SH T-cells ULON , & ! longitude of velocity pts, NE corner of T pts (radians) @@ -101,7 +101,7 @@ module ice_grid ELON , & ! longitude of center of east face of T pts (radians) ELAT , & ! latitude of center of east face of T pts (radians) ANGLE , & ! for conversions between POP grid and lat/lon - ANGLET , & ! ANGLE converted to T-cells + ANGLET , & ! ANGLE converted to T-cells, valid in halo bathymetry , & ! ocean depth, for grounding keels and bergs (m) ocn_gridcell_frac ! only relevant for lat-lon grids ! gridcell value of [1 - (land fraction)] (T-cell) @@ -635,12 +635,24 @@ subroutine init_grid2 call ice_HaloUpdate (uarea, halo_info, & field_loc_NEcorner, field_type_scalar, & fillValue=c1, tripoleOnly=.true.) + call ice_HaloUpdate (narea, halo_info, & + field_loc_Nface, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) + call ice_HaloUpdate (earea, halo_info, & + field_loc_Eface, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) call ice_HaloUpdate (tarear, halo_info, & field_loc_center, field_type_scalar, & fillValue=c1, tripoleOnly=.true.) call ice_HaloUpdate (uarear, halo_info, & field_loc_NEcorner, field_type_scalar, & fillValue=c1, tripoleOnly=.true.) + call ice_HaloUpdate (narear, halo_info, & + field_loc_Nface, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) + call ice_HaloUpdate (earear, halo_info, & + field_loc_Eface, field_type_scalar, & + fillValue=c1, tripoleOnly=.true.) call ice_timer_stop(timer_bound) diff --git a/doc/source/science_guide/sg_horiztrans.rst b/doc/source/science_guide/sg_horiztrans.rst index 10b668755..4ccf00e9b 100644 --- a/doc/source/science_guide/sg_horiztrans.rst +++ b/doc/source/science_guide/sg_horiztrans.rst @@ -477,9 +477,16 @@ Remote Sensing Center (Norway), who applied an earlier version of the CICE remapping scheme to an ocean model. The implementation in CICE is somewhat more general, allowing for departure regions lying on both sides of a cell edge. The extra triangle is constrained to lie in one -but not both of the grid cells that share the edge. Since this option -has yet to be fully tested in CICE, the current default is -`l\_fixed\_area` = false. +but not both of the grid cells that share the edge. + +The default value for the B grid is `l\_fixed\_area` = false. However, +idealized tests with the C grid have shown that prognostic fields such +as sea ice concentration exhibit a checkerboard pattern with +`l\_fixed\_area` = false. The logical `l\_fixed\_area` is therefore set +to true when using the C grid. The edge areas `edgearea\_e` and `edgearea\_n` +are in this case calculated with the C grid velocity components :math:`uvelE` +and :math:`vvelN`. + We made one other change in the scheme of :cite:`Dukowicz00` for locating triangles. In their paper, departure points are defined by