MODFLOW-USGS / modelviewer-mf6

Model Viewer for MODFLOW 6
https://modelviewer-mf6.readthedocs.io/
Other
7 stars 2 forks source link

Starting a new data model from ex-gwf-csub-p04 crashes Model Viewer #20

Open scharlton2 opened 2 years ago

scharlton2 commented 2 years ago

This still needs work the CSUB model features aren't handled correctly. Temporarily fixed by excluding CSUB features within the Modflow6DataSource::IsModelFeature function.

scharlton2 commented 2 years ago

The list of Model Features (from the 'Model Features Toolbox') is created by iterating over the budget file. For each 'Flowtype' (TEXT) where (IMETH=6) and doesn't contain any of the following substrings ("MVR", "UZF-GWD", "UZF-GWET", "LAK", "FLOW-JA-FACE", "DATA-SPDIS") it adds TXT2ID2 to the list of model features.

The problem in example ex-gwf-csub-p04 arises when it loads ex-gwf-csub-p04.cbc and both Flowtypes "CSUB-ELASTIC" and "CSUB-INELASTIC" have TXT2ID2="CSUB". This causes the m_ModelFeatureArraySize to be too small to hold both the elastic and inelastic cell ids.

I created a python file that simulates what model viewer does: CellBudgetFile2.py

modelviewer-mf6 1.0.0 fixed it by adding CSUB to the list of ignored flowTypes: CellBudgetFile2.py:L29-L31

I could fix modelviewer-mf6 using the special cases: CellBudgetFile2.py:L45-L52

But sometimes the TXT2ID2 has an integer appended to the Flowtype(TEXT) in TXT2ID2 for example from ex-gwf-csub-p04.cbc:

TEXT = '             RCH'   TXT2ID2 = 'RCH_0           '

while ex-gwf-disvmesh.cbc doesn't

TEXT = '             RCH'   TXT2ID2 = 'RCH             '

I don't know if this occurs in the "CSUB-ELASTIC" or "CSUB-INELASTIC" flowtypes(imeth==6). That's what the two assertions on lines 48 and 51 are verifying.