Modflow 6: List of package checks to be added

The mf6 module is lacking package checks. I noticed for every Modflow6 model I build, I made at least 3 mistakes in my imod-python input that has to be corrected. So here I keep track of a list of package checks to do. Feel free to add to it:

I maintained a list of errors I ran into for the last model I'm creating (which still throws me errors).

  • npf -- type(icelltype) != int. Providing 0.0 instead of 0 should give an error.
  • all -- layer checks are missing. I had an issue where xarray broadcasted to an empty layer dimension, which imod-python silently wrote to an erronous mf6 file.
  • all -- xaray's to_netcdf saves optional variables with value None as np.nan. If you consequently call pkg.from_file(), the optional variables are read as a scalar np.nan.
  • all -- there are no checks to check if the y-axis is decreasing or increasing. Xarray has tendency to flip around a decreasing axis to a monotonically increasing axis, which is quite annoying. We should at least check for this.
  • all -- check that no arrays with all nan's are provided. For Boundary Conditions: MAXBOUND should be larger than 0. Important for clipping models.
  • dis -- check that bottom does not exceed top, and that bottom of a lower layer nowhere exceeds an upper layer.
  • dis, npf, ic -- check that not a np.nan is provided where idomain == 1. In case of the ic package, this results in very cryptic errors, where you get a floating errors with whatever boundary condition package lays in that cell. And otherwise in the solution itsself.
  • hfb -- check that not multiple hfb packages are specified. Modflow6 currently allows 1 HFB package to be specified.
  • hfb -- Throw error if self._snap_to_cell_edges() returns an empty array. Likely the geodataframes are out of model extent. Or check that beforehand.
  • riv, drn, ghb -- check that not some cells in a grid of one var have np.nan, whereas cells in another grid have data defined in that cell. You'd be amazed with what one encounters in an existing model dbase.
  • riv, drn, ghb -- check that no conductance of 0. is defined
  • riv -- check river bottom not above its' model layer bottom (Modflow 6 also checks this, but only after reading a lot of data)
  • riv -- check river bottom not above stage (Modflow 6 also checks this, but only after reading a lot of data)
Edited by Joeri van Engelen