modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
517 stars 313 forks source link

little errors importing old MODFLOW models from visual modflow #1433

Closed vcantarella closed 4 months ago

vcantarella commented 2 years ago

Hi,

I am working with a visual modflow nwt model and I encountered subtle differences in how visual modflow writes some packages that crash the import from flopy. Interestingly, these models run just fine with the standard executable. I am not sure if it is of interest to flopy to be able to read these, but they might be found in many more models out there.

First, in the UPW file, visual modflow has written the first line like this: 154 -1.00e+30 0 And flopy is expecting the input like this: [IUPWCB HDRY NPUPW IPHDRY] Otherwise, it is expecting the IPHDRY value, so it crashes. From the manual, I thought the parameter is mandatory, but the model runs just fine.

Second, in the ZON file from the zone-budget. It has written the last line with a 0 This crashes the loop in the flopy code as it is either expecting a layer definition line or the zone values. Again, when I run the zone-budget executable with this file it runs just fine.

In both cases, from reading the source code and identifying where it was crashing, I was able to edit the modflow files to import the model, however, I don't know if you find it interesting to be able to support those little changes or not. Visual MODFLOW has also their packages and if the user does not edit the .nam file it cannot be imported into flopy anyway.

jdhughes-usgs commented 2 years ago

@jlarsen-usgs Is this something you could look at to see if it is an easy fix to support an empty iphdry entry? I am not sure about the zonebudget issue. I don't think we want to provide support for Visual MODFLOW files since then we might be obligated to support other GUI customizations but since the codes run with these files they must not be mandatory parameterss.

jlarsen-usgs commented 2 years ago

@jdhughes-usgs I can look into the empty iphdry entry.

jlarsen-usgs commented 2 years ago

@vcantarella

I'm not able to recreate with iphdry with modflow-nwt version 1.3.0. When I remove the iphdry entry from the UPW input file modflow-nwt crashes while attempting to load that line. What version of nwt are you working with?

vcantarella commented 2 years ago

@jlarsen-usgs I am running Version 1.2.0 03/01/2020. I believe that is also the latest here: executables-repo

jlarsen-usgs commented 2 years ago

@vcantarella I just tested this with Version 1.2.0 03/01/2020 and can't reproduce a run. On windows, UPW read crashes for me when iphdry is omitted from the UPW file, in addition, I don't see anywhere in the source code that would allow. What operating system are you using?

vcantarella commented 2 years ago

@jlarsen-usgs So, I tested some models this morning, and at first, I could not reproduce a run. But then I tested removing the comments in the line and I was able to reproduce a run. Could this be a bug??

Original model UPW line: 9 -2.000000000000E+020 3 0 # Data Set 1, IUPWCB HDRY NPUPW IPHDRY

This doesn't run: 9 -2.000000000000E+020 3 # Data Set 1, IUPWCB HDRY NPUPW IPHDRY

This runs: 9 -2.000000000000E+020 3

wpbonelli commented 4 months ago

is this issue still present @vcantarella @jlarsen-usgs or has it been resolved?

vcantarella commented 4 months ago

Hi @wpbonelli, Thanks for looking into it. To be honest, I don't remember how I dealt with this. I now view this as not a flopy error, but It is related how an old software wrote the MODFLOW files. Skimming through the official manual, I have come to think that the file had been written wrongly. Thus, I believe that it is not something worth pursuing and my opinion would be to close this issue.

wpbonelli commented 4 months ago

Ok, sounds good @vcantarella, thanks for the update. Please feel free to reopen if needed.