| 
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 | 
 
  | 
@@ -142,6 +146,27 @@ def test_sim_errors(function_tmpdir, targets):  | 
142 | 146 |         run_mf6_error(str(function_tmpdir), mf6, err_str)  | 
143 | 147 | 
 
  | 
144 | 148 | 
 
  | 
 | 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 | + | 
145 | 170 | def test_sim_maxerrors(function_tmpdir, targets):  | 
146 | 171 |     mf6 = targets["mf6"]  | 
147 | 172 | 
 
  | 
 | 
0 commit comments