Skip to content

Commit

Permalink
apply tripolar stitch fix in auto mask_table generation
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Nov 5, 2023
1 parent 4202b78 commit 3cb66ec
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/framework/MOM_domains.F90
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,16 @@ subroutine gen_auto_mask_table(n_global, reentrant, tripolar_N, npes, param_file
mask(i, jbuf+ny+j) = mask(nx+2*ibuf+1-i, jbuf+ny+1-j)
enddo
enddo
!mask(:, jbuf+ny) = 1 ! TODO - REMOVE
endif

! Tripolar Stitch Fix: In cases where masking is asymmetrical across the tripolar stitch, there's a possibility
! that certain unmasked blocks won't be able to obtain grid metrics from the halo points. This occurs when the
! neighboring block on the opposite side of the tripolar stitch is masked. As a consequence, certain metrics like
! dxT and dyT may be calculated through extrapolation (refer to extrapolate_metric), potentially leading to the
! generation of non-positive values. This can result in divide-by-zero errors elsewhere, e.g., in MOM_hor_visc.F90.
! Currently, the safest and most general solution is to prohibit masking along the tripolar stitch:
if (tripolar_N) then
mask(:, jbuf+ny) = 1
endif

glob_ocn_frac = real(sum(mask(1+ibuf:nx+ibuf, 1+jbuf:ny+jbuf))) / (nx * ny)
Expand Down

0 comments on commit 3cb66ec

Please sign in to comment.