Skip to content

Commit

Permalink
geometry: fixed the staggered interior-sectioning test
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Jun 29, 2023
1 parent 0635e0a commit 48180eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions schism/geometry/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _get_interior_mask(self):
# Exclude exterior points
# Check against min(grid.spacing)*eta as anything within
# this is probably too close anyway
mask_inside = sdf.data > min(spacing)*cutoff + _feps
mask_inside = sdf.data > min(spacing)*cutoff
mask_near = np.logical_and(mask_near, mask_inside)

# Set up boundary points in physical space
Expand All @@ -238,8 +238,9 @@ def _get_interior_mask(self):
# Check nearest boundary point not in box
# Errs on the side of caution (cutoff slightly larger
# according to floating point precision)
cutoff_check = (cutoff+_feps)*np.array(spacing)[np.newaxis, :]
interior = np.any(np.abs(query - bp[i])
> (cutoff+_feps)*np.array(spacing)[np.newaxis, :],
> cutoff_check,
axis=1)

# Fill interior mask away from boundary
Expand Down
3 changes: 2 additions & 1 deletion tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def read_sdf(surface, dims):
"""Unpickle an sdf"""
path = os.path.dirname(os.path.abspath(__file__))
fname = path + '/sdfs/' + surface + '_' + str(dims) + 'd.dat'
print(fname)
with open(fname, 'rb') as f:
sdf = pickle.load(f)
return sdf
Expand Down Expand Up @@ -275,7 +276,7 @@ def test_interior_mask_staggered(self, surface, setup):
check_mask = ymsh < 50
check_mask_stagger = ymsh < 51
for origin in bg.interior_mask:
if origin == (zero, zero):
if origin == (zero, zero) or origin == (zero, h_y/2):
check = bg.interior_mask[origin][slices] \
== check_mask[slices]
else:
Expand Down

0 comments on commit 48180eb

Please sign in to comment.