Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For unstructured grid and budget method 3, node numbers written instead of layer numbers #48

Open
aprovost-usgs opened this issue Jun 28, 2021 · 2 comments

Comments

@aprovost-usgs
Copy link

Budget method 3 (which is used, e.g., by RCH when recharge is to the topmost active layer) should write layer numbers and flows. But when the grid is unstructured, node numbers are apparently passed via array IBUFF to subroutine UBDSV3U, which then writes them to the budget without converting them to layer numbers. This was discovered when MODPATH crashed while reading method 3 budget information written for EVT. MODPATH attempted to convert the "layer numbers" it read to node numbers, resulting in out-of-bounds values. It's not clear to me how to best implement the fix. Converting node numbers to layer numbers is not as straightforward for an unstructured grid as it is for a structured grid, since there can be different numbers of nodes in each layer (stored in array NODLAY). But in any case, the conversion needs to take place at some point, either within UBDSV3U (with IBUFF loaded with node numbers and NODLAY presumably also passed in) or before UBDSV3U is called (with IBUFF loaded with pre-computed layer numbers).

@aprovost-usgs
Copy link
Author

aprovost-usgs commented Jun 29, 2021

The following related concern is based on examination of the code and has not been confirmed in a test run. In subroutine UBDSV3, which handles method 3 for structured grids, pre-computed layer numbers are passed in via actual argument ITEMP, which corresponds to dummy argument IBUFF. These layer numbers are written to the budget appropriately. However, when extracting the corresponding flows, UBDSV3 apparently assumes IBUFF(J,I) is a node number and "converts" the value to a layer number, KLAYER, which is then used in BUFF(J,I,KLAYER). If this is the case, it would result in flows being extracted from the wrong layers.

@aprovost-usgs
Copy link
Author

The writing of node numbers instead of layer numbers for an unstructured grid using budget method 3 is intentional and is consistent with the documentation, so my comment of Jun 28 should be disregarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant