Skip to content

Commit ab81dd5

Browse files
committed
add chdg duplicate constant head cell test
1 parent c5b6ebe commit ab81dd5

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

autotest/test_gwf_errors.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import numpy as np
1111
import pytest
1212
from flopy.utils.gridutil import get_disu_kwargs
13+
from framework import DNODATA
1314

1415

1516
def run_mf6(argv, ws):
@@ -101,7 +102,10 @@ def get_minimal_gwf_simulation(
101102
disu = flopy.mf6.ModflowGwfdisu(gwf, **disukwargs)
102103
ic = flopy.mf6.ModflowGwfic(gwf, **ickwargs)
103104
npf = flopy.mf6.ModflowGwfnpf(gwf, **npfkwargs)
104-
chd = flopy.mf6.modflow.mfgwfchd.ModflowGwfchd(gwf, **chdkwargs)
105+
if "readarraygrid" in chdkwargs:
106+
chd = flopy.mf6.modflow.mfgwfchdg.ModflowGwfchdg(gwf, **chdkwargs)
107+
else:
108+
chd = flopy.mf6.modflow.mfgwfchd.ModflowGwfchd(gwf, **chdkwargs)
105109
return sim
106110

107111

@@ -142,6 +146,27 @@ def test_sim_errors(function_tmpdir, targets):
142146
run_mf6_error(str(function_tmpdir), mf6, err_str)
143147

144148

149+
def test_sim_errors_grid(function_tmpdir, targets):
150+
mf6 = targets["mf6"]
151+
152+
with pytest.raises(RuntimeError):
153+
# verify that the correct number of errors are reported
154+
chdkwargs = {}
155+
head = np.full((5, 5, 5), DNODATA, dtype=float)
156+
for i in range(5):
157+
head[0, i, 0] = 2.0
158+
chdkwargs["readarraygrid"] = True
159+
chdkwargs["head"] = head
160+
sim = get_minimal_gwf_simulation(
161+
str(function_tmpdir), exe=mf6, chdkwargs=chdkwargs
162+
)
163+
test_model = sim.get_model("test")
164+
chd2 = flopy.mf6.modflow.mfgwfchdg.ModflowGwfchdg(test_model, **chdkwargs)
165+
sim.write_simulation()
166+
err_str = ["1. Cell is already a constant head ((1,1,1))."]
167+
run_mf6_error(str(function_tmpdir), mf6, err_str)
168+
169+
145170
def test_sim_maxerrors(function_tmpdir, targets):
146171
mf6 = targets["mf6"]
147172

0 commit comments

Comments
 (0)