Skip to content

Commit 0daabc1

Browse files
mjrenomjreno
authored andcommitted
add chdg duplicate constant head cell test
1 parent d860b94 commit 0daabc1

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

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

@@ -167,6 +171,27 @@ def test_sim_errors(function_tmpdir, targets):
167171
run_mf6_error(str(function_tmpdir), mf6, err_str)
168172

169173

174+
def test_sim_errors_grid(function_tmpdir, targets):
175+
mf6 = targets["mf6"]
176+
177+
with pytest.raises(RuntimeError):
178+
# verify that the correct number of errors are reported
179+
chdkwargs = {}
180+
head = np.full((5, 5, 5), DNODATA, dtype=float)
181+
for i in range(5):
182+
head[0, i, 0] = 2.0
183+
chdkwargs["readarraygrid"] = True
184+
chdkwargs["head"] = head
185+
sim = get_minimal_gwf_simulation(
186+
str(function_tmpdir), exe=mf6, chdkwargs=chdkwargs
187+
)
188+
test_model = sim.get_model("test")
189+
chd2 = flopy.mf6.modflow.mfgwfchdg.ModflowGwfchdg(test_model, **chdkwargs)
190+
sim.write_simulation()
191+
err_str = ["1. Cell is already a constant head ((1,1,1))."]
192+
run_mf6_error(str(function_tmpdir), mf6, err_str)
193+
194+
170195
def test_sim_maxerrors(function_tmpdir, targets):
171196
mf6 = targets["mf6"]
172197

0 commit comments

Comments
 (0)