Skip to content

Commit

Permalink
Check for reversed connection block names in t2data.mesh_json()
Browse files Browse the repository at this point in the history
These can occur if the t2data was generated outside of PyTOUGH,
e.g. by Petrasim
  • Loading branch information
acroucher committed May 10, 2024
1 parent deaab9d commit 805520e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions t2data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2073,18 +2073,27 @@ def mesh_json(self, geo, mesh_filename):
c, s = cos(anglerad), sin(anglerad)
rotation = np.array([[c, s], [-s, c]])
for blknames in geo.block_connection_name_list:
con = self.grid.connection[blknames]
if blknames in self.grid.connection:
names = blknames
con = self.grid.connection[blknames]
else:
rnames = blknames[::-1]
if rnames in self.grid.connection:
names = rnames
con = self.grid.connection[rnames]
else:
raise Exception ('Connection not found: ' + str(blknames))
blkindices = [geo.block_name_index[blkname] -
geo.num_atmosphere_blocks for blkname in blknames]
laynames = [geo.layer_name(blkname) for blkname in blknames]
geo.num_atmosphere_blocks for blkname in names]
laynames = [geo.layer_name(blkname) for blkname in names]
if laynames[0] != laynames[1]: # vertical connection
underground = all([blkindex >= 0 for blkindex in blkindices])
if underground and con.direction != 3:
face_directions.append({
"cells": blkindices,
"permeability_direction": con.direction})
else:
colnames = [geo.column_name(blkname) for blkname in blknames]
colnames = [geo.column_name(blkname) for blkname in names]
d = geo.column[colnames[1]].centre - geo.column[colnames[0]].centre
d2 = np.dot(rotation, d)
expected_direction = np.argmax(abs(d2)) + 1
Expand Down

0 comments on commit 805520e

Please sign in to comment.