modflowpy / flopy

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

SIGSEGV, segmentation error running MODFLOW #2280

Open iaped opened 1 month ago

iaped commented 1 month ago

I have compiled all of my MODFLOW input files and as far as I know they should all be correctly formatted however, MODFLOW is throwing an error I don't recognize because I think it is pointing to something in the source code. I am not sure how to debug this, a screen shot of the error is attached

Screenshot 2024-08-05 at 4 38 18 PM
dbrakenhoff commented 1 month ago

Just a guess here, but do you see any strange values in any timeseries packages you're using?

wpbonelli commented 1 month ago

@manangka can you have a look? the segfault happens here

https://github.com/MODFLOW-USGS/modflow6/blob/8124ad419dc9b52bfdd2655308bd3f621513a0fd/src/Utilities/HashTable.f90#L120

seems the hash doesn't map to any bucket.

Manangka commented 1 month ago

@wpbonelli I will look into it.

Manangka commented 1 month ago

@iaped Could you provide a (minimal) model which causes this issue?

iaped commented 1 month ago

@Manangka I will attach in 2 zip files since it is large. Please note that the mf6 executable is not in the zip files Model_pt1.zip Model_pt2.zip

iaped commented 1 month ago

Just a guess here, but do you see any strange values in any timeseries packages you're using?

I am running this program on a Mac computer and it appears that my mac think a .ts file is a MPEG-2 Transport Stream - 8 MB file. This might be the issue since my computer thinks it is a media file. I am looking into how to change this but it is not working

Manangka commented 1 month ago

@iaped I found some issues in the way the model files are generated. I made some changes to your notebook and I was able to successfully run the generated model.

Attached the fixed notebook issue2280.zip

Manangka commented 1 month ago

A bit more information.

I made the following changes to the ipynb file:

Changes in input_concentrations.xlsx:

The reason for the crash was a missing option in the uzt file. It was missing the line 'TS6 FILEIN input_conc.ts'. When timeseries are defined a hastable is created storing the timeseries data. In this case that wasn't happening because of the missing line. There is a dependency on the timeseries however in the perioddata of the uzt package. When it tries to retrieve the value of PFOS it results in a crash

@wpbonelli We should probably create an issue to prevent a hard crash. A simple null check could be sufficient

@wpbonelli I was a bit surprised that the timeseries needed time=0 to be defined. In the uzt package we also define a start value. Shouldn't that be enough?

wpbonelli commented 1 month ago

@Manangka agreed on the first point, I would defer to someone else with more experience with the timeseries machinery on the second.

langevin-usgs commented 1 month ago

On the second point, I think it makes sense that time=0 needs to be defined. Conceptually, if a string is entered for a value, then it is a time series entry, and the code must be able to interpolate a value from data in the time series. There is no tie to the data in the period block. The behavior is similar for the end of the simulation. And end time in the time series greater than or equal to the simulation length is required. We could rethink this, but it seems to me that requiring a complete time series record is probably the safest.

iaped commented 1 month ago

@Manangka thank you! It appears the transport model is not running along with the flow model. I noticed that in the simulation name file the transport model is not listed under models, was this intentional? When I added it to the name file, it threw the error that it could not find the corresponding UZF file while reading the UZT file.

emorway-usgs commented 1 month ago

@iaped, I just downloaded and ran the notebook included in issue2280.zip that @Manangka posted. The name of the notebook I ran was Peterson.ipynb. I can confirm that the model it produced is running both the GWF and GWT models simultaneously. As you point out, the simulation name file that is in the zip file only includes the GWF model, thus, I think if you rerun the notebook you'll be good-to-go.

iaped commented 1 month ago

Hi again @emorway-usgs @langevin-usgs @Manangka @wpbonelli . Thank you for all of your help however, I am facing an issue I did before with the UZF file, I am not sure why but modflow is not reading my UZF file in its entirety. As I understand, it is supposed to go through each part of the file and in the list file it will state: "BEGIN UZF PACAKGE DATA" and end with "END UZF PACKAGE DATA" for example. However after running the simulation I noticed that no infiltration was occurring and in the list file, it was not reading the UZF past the line in the picture. Any thoughts? attaching the LST file and UZF file Screenshot 2024-08-15 162823 [Uploading UZF and LST file.zip…]()

langevin-usgs commented 1 month ago

One way to troubleshoot this is to start with a much simpler UZF package. Try a single UZF cell, make sure that works, and then gradually increase the number of UZF cells and the complexity. Maybe this would give you an idea of what's causing the problem.