@@ -242,6 +242,85 @@ def test_disu_errors(function_tmpdir, targets):
242242 run_mf6_error (str (function_tmpdir ), mf6 , err_str )
243243
244244
245+ def run_mf6_normalized (ws , exe ):
246+ """Run mf6 and return (returncode, whitespace-normalized stdout)."""
247+ returncode , buff = run_mf6 ([exe ], ws )
248+ return returncode , " " .join (" " .join (buff ).split ())
249+
250+
251+ def test_dis_passthrough_thickness_error (function_tmpdir , targets ):
252+ """A cell left with a nonpositive thickness beneath a vertical pass-through
253+ cell reports a single, self-explanatory THICKNESS <= 0 error that names the
254+ overlying cell and points at its IDOMAIN status."""
255+ mf6 = targets ["mf6" ]
256+
257+ nlay , nrow , ncol = 4 , 1 , 3
258+ botm = np .empty ((nlay , nrow , ncol ))
259+ botm [0 ] = 30.0
260+ botm [1 ] = 20.0
261+ botm [2 ] = 10.0
262+ botm [2 , 0 , 1 ] = 4.0 # stale BOTM on the pass-through cell, below layer 4
263+ botm [3 ] = 5.0
264+ idomain = np .ones ((nlay , nrow , ncol ), dtype = int )
265+ idomain [2 , 0 , 1 ] = - 1 # vertical pass-through at layer 3, column 2
266+
267+ diskwargs = {
268+ "nlay" : nlay ,
269+ "nrow" : nrow ,
270+ "ncol" : ncol ,
271+ "top" : 40.0 ,
272+ "botm" : botm ,
273+ "idomain" : idomain ,
274+ }
275+ sim = get_minimal_gwf_simulation (str (function_tmpdir ), exe = mf6 , diskwargs = diskwargs )
276+ sim .write_simulation ()
277+
278+ returncode , output = run_mf6_normalized (str (function_tmpdir ), mf6 )
279+ assert returncode != 0 , "mf6 should have failed on a nonpositive thickness"
280+
281+ # only the pass-through column fails ...
282+ assert "CELL (4,1,2) THICKNESS <= 0." in output
283+ assert "CELL (4,1,1)" not in output
284+ assert "CELL (4,1,3)" not in output
285+ # ... and the explanation is folded into that one numbered item
286+ assert "2. CELL (" not in output
287+ assert (
288+ "The top of this cell is the bottom elevation specified for the "
289+ "cell directly above it, cell (3,1,2)." in output
290+ )
291+ assert "inactive or a vertical pass-through cell (IDOMAIN <= 0)" in output
292+ assert "ERROR OCCURRED WHILE READING FILE 'test.dis'" in output
293+
294+
295+ def test_dis_thickness_error_without_passthrough_note (function_tmpdir , targets ):
296+ """An ordinary nonpositive thickness between two active cells names the
297+ overlying cell but does not mention pass-through cells."""
298+ mf6 = targets ["mf6" ]
299+
300+ diskwargs = {
301+ "nlay" : 3 ,
302+ "nrow" : 1 ,
303+ "ncol" : 1 ,
304+ "top" : 10.0 ,
305+ "botm" : [5.0 , 2.0 , 4.0 ], # layer 3 bottom sits above layer 2 bottom
306+ }
307+ chdkwargs = {"stress_period_data" : {0 : [[(0 , 0 , 0 ), 5.0 ]]}}
308+ sim = get_minimal_gwf_simulation (
309+ str (function_tmpdir ), exe = mf6 , diskwargs = diskwargs , chdkwargs = chdkwargs
310+ )
311+ sim .write_simulation ()
312+
313+ returncode , output = run_mf6_normalized (str (function_tmpdir ), mf6 )
314+ assert returncode != 0 , "mf6 should have failed on a nonpositive thickness"
315+
316+ assert "CELL (3,1,1) THICKNESS <= 0." in output
317+ assert (
318+ "The top of this cell is the bottom elevation specified for the "
319+ "cell directly above it, cell (2,1,1)." in output
320+ )
321+ assert "pass-through" not in output
322+
323+
245324def test_drn_options_error_file (function_tmpdir , targets ):
246325 """Errors in DRN options are reported for the DRN input file."""
247326 mf6 = targets ["mf6" ]
0 commit comments