Closed matthiaskardel closed 3 years ago
If you are doing any low-level surgery on your mulgrid geometry, like adding or deleting individual columns, you will need to rebuild the global lists of blocks and connections before converting to a t2grid.
This is not done automatically in methods like mulgrid.delete_column(), because rebuilding these global lists is expensive - so it would slow your code down significantly if you were adding or deleting a lot of columns. For that reason, users of low-level methods need to rebuild them explicitly,
You just need to call these two methods after your column deletion code (if your mulgrid is called geo
):
geo.setup_block_name_index()
geo.setup_block_connection_name_index()
Thank you for the quick answer!
Does that resolve your problem?
Yes, thanks!
When deleting a column of a MULGraph Grid the conversion into a TOUGH2 Grid fails. This is due to a call in
t2grids.add_underground_blocks
, which references potentially deleted columns, here.A possible workaround is a continue the for loop in
add_underground_blocks
on a KeyError exception, yet not very elegant.Reproduction:
t2grids.t2grid().fromgeo(mulgrid)