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

bug: LGR utility CDIST is 2D, MF6 GWFGWF expects 3D #2079

Closed mroth14 closed 8 months ago

mroth14 commented 8 months ago

Describe the bug The flopy.utils.lgrutil.Lgr class get_exchange_data optional cdist=True calculates straight line connection distance in 2D. The MF6 Groundwater Flow (GWF) Exchange expects 3D straight line distance if the auxiliary 'CDIST' is found (Version mf6.4.2).

To Reproduce Using this example: https://github.com/MODFLOW-USGS/modflow6-examples/blob/master/scripts/ex-gwf-u1gwfgwf.py change the value of ncppl from 1 to 2 on line 265 and the CDIST values in exgdata do not change. In fact, CDIST is not dependent on the value of ncppl (number of child layers per parent layer). 3D distance calculations would be dependent on the ncppl variable.

Expected behavior The exchange data can be input directly into the groundwater flow exchange class as is done in the example above USG-ex1 with GWF-GWF Exchange and XT3D. It is expected that get_exchange_data cdist=True would export 3D distance, which is what MF6 expects in the GWF exchange.

Screenshots In the source code for flopy.utils.lgrutil, the connection distance is calculated based on the 2D distance formula: image

Desktop:

langevin-usgs commented 8 months ago

Yeah, looks like that needs some tending. I will work on a fix.

langevin-usgs commented 8 months ago

After a further look into this issue, the problem is that the description of CDIST in the MODFLOW 6 input/output guide is incorrect; the LGR utility is correct as is. For a horizontal connection, CDIST should be the horizontal distance between the two cell centers. For a vertical connection, CDIST should be the difference in elevation between the two connected cells. When specified this way, the specific discharge at cell centers will be calculated in a manner that is consistent with how specific discharge is calculated for interior model cells. The description of CDIST has been clarified in the MODFLOW 6 input/output guide and will be updated in the next release. Additional information can be found here. Sorry for the confusion.