Skip to content

Commit

Permalink
fix(get_disu_kwargs): incorrect indexing of delr and delc
Browse files Browse the repository at this point in the history
  • Loading branch information
langevin-usgs committed Nov 20, 2023
1 parent 7cc5e6f commit 7a73645
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions autotest/test_gridutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ def test_get_lni_infers_layer_count_when_int_ncpl(ncpl, nodes, expected):
np.array([-10]),
np.array([-30.0, -50.0]),
),
(
1, # nlay
3, # nrow
4, # ncol
np.array(4 * [4.]), # delr
np.array(3 * [3.]), # delc
np.array([-10]), # top
np.array([-30.0]), # botm
),
],
)
def test_get_disu_kwargs(nlay, nrow, ncol, delr, delc, tp, botm):
Expand Down
6 changes: 3 additions & 3 deletions flopy/utils/gridutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def get_nn(k, i, j):
n = get_nn(k, i, j)
ja.append(n)
iac[n] += 1
area[n] = delr[i] * delc[j]
area[n] = delr[j] * delc[i]
ihc.append(n + 1)
cl12.append(n + 1)
hwva.append(n + 1)
Expand All @@ -126,7 +126,7 @@ def get_nn(k, i, j):
ihc.append(0)
dz = botm[k - 1] - botm[k]
cl12.append(0.5 * dz)
hwva.append(delr[i] * delc[j])
hwva.append(delr[j] * delc[i])
# back
if i > 0:
ja.append(get_nn(k, i - 1, j))
Expand Down Expand Up @@ -165,7 +165,7 @@ def get_nn(k, i, j):
else:
dz = botm[k - 1] - botm[k]
cl12.append(0.5 * dz)
hwva.append(delr[i] * delc[j])
hwva.append(delr[j] * delc[i])
ja = np.array(ja, dtype=int)
nja = ja.shape[0]
hwva = np.array(hwva, dtype=float)
Expand Down

0 comments on commit 7a73645

Please sign in to comment.