|
10 | 10 | import numpy as np |
11 | 11 | import pytest |
12 | 12 | from flopy.utils.gridutil import get_disu_kwargs |
| 13 | +from framework import DNODATA |
13 | 14 |
|
14 | 15 |
|
15 | 16 | def run_mf6(argv, ws): |
@@ -101,7 +102,10 @@ def get_minimal_gwf_simulation( |
101 | 102 | disu = flopy.mf6.ModflowGwfdisu(gwf, **disukwargs) |
102 | 103 | ic = flopy.mf6.ModflowGwfic(gwf, **ickwargs) |
103 | 104 | 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) |
105 | 109 | return sim |
106 | 110 |
|
107 | 111 |
|
@@ -167,6 +171,27 @@ def test_sim_errors(function_tmpdir, targets): |
167 | 171 | run_mf6_error(str(function_tmpdir), mf6, err_str) |
168 | 172 |
|
169 | 173 |
|
| 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 | + |
170 | 195 | def test_sim_maxerrors(function_tmpdir, targets): |
171 | 196 | mf6 = targets["mf6"] |
172 | 197 |
|
|
0 commit comments