MINC
Hello, Could you please some one help me to assign minc to subgrid [ specifically along diffrent faults units] and some rocks
while assigned I get the following errors:
''''''raise Exception("Duplicate MINC matrix block name: " + mblockname)
Exception: Duplicate MINC matrix block name: 1ij 2'''''''
from t2data import * import csv
dat = t2data('Model.dat')
vols = [0.01, 0.2, 0.79] # Fracture volume, matrix[0] volume, matrix[1] volume for each MINC level dat.grid.minc(vols, 50., 3) # Fracture spacing, fracture plane
Read CSV file containing blocks to apply MINC on
blocks_to_apply_minc = [] # Initialize an empty list
Assuming your CSV file structure is:
Id, Block_name, layer_name
with open('MINC Block.csv') as f:
r = csv.reader(f)
next(r) # skip header
for row in r:
layername = row[2]
layer = int(layername)
blkname = row[1].lower()
# Assuming you want to apply MINC to blocks within the specified layer range (8 to 20)
if 8 <= layername <= 20:
blocks_to_apply_minc.append(blkname)
Get the block objects for the specified subset
blocks_to_apply = [blk for blk in dat.grid.blocklist if blk.name in blocks_to_apply_minc]
Apply the MINC method with specified parameters to the subset of blocks
dat.grid.minc(vols, blocks=blocks_to_apply)
Write the updated TOUGH2 data file
dat.write('minc_model.dat')
From the error Exception: Duplicate MINC matrix block name: 1ij 2 it looks like you are creating MINC matrix blocks with the same name. This can easily happen if you are using the default matrix block naming, which just replaces the first character of the block name with a digit representing the MINC level. So e.g. blocks aij 2 and bij 2 will both get MINC matrix blocks with name 1ij 2.
If that is what's happening, you need to use a different MINC matrix block naming convention. You can use the matrix_blockname parameter of the minc() method to do that - see detail in the user guide.
Dr. Adrian,
I sincerely appreciate your swift response.
I have endeavored to insert the script provided below into the aforementioned script. However, the following error continues to manifest:
Custom function for matrix block naming
def matrix_name(name, level): return 'm' + str(level) + name[2:]
"""Exception: Duplicate MINC matrix block name: m1d1"""
Thank you
def matrix_name(name, level): return 'm' + str(level) + name[2:]
I think this naming function will give even worse results than the default one, unfortunately - it is even more likely you will get duplicates, because two characters instead of one are lost from the original block name.
You need to design a naming system for the MINC blocks that is less likely to give duplicates. This will depend on how you are naming the blocks in general.
Dr. Adrian Thank you, Could you create small a script for above code based on the given,which will be consistensts with tough3 naming, i will edit based on my needs. thank you so much
Dear Dejene, No, it all depends on how the blocks in your model are named, which I don't know. If you have a model already created with MINC which works, you can copy the naming convention from that and create a matrix block naming function which does that.