nikolai-andrianov / sr3_reader

Python routines for reading of Computer Modelling Group Ltd. (CMG) binary output files
MIT License
12 stars 3 forks source link

Using non-box model leads to strange geometry of grid in PyVista #2

Open sebastian-hogeweg opened 1 week ago

sebastian-hogeweg commented 1 week ago

Applying the suggested workflow on an actual geological model (see first screenshot) results in a weird geometry (see second screenshot)

Screenshot from 2024-06-12 14-24-58

Screenshot from 2024-06-12 14-26-24

Method used for extracting the grid:

`def spatialProperties(self, properties): print(sr3_reader.list_spatial_properties(self.sr3)) (sp_ind, sp) = sr3_reader.get_spatial_properties(self.sr3, properties) t_sp = self.sr3.times["Days"].iloc[sp_ind]

    # The dimensions of grid nodes (+1 to the cells' dimensions)
    dim = np.array(self.sr3.grid.cart_dims) + 1

    # Create the pyvista grid representation
    grid = pv.ExplicitStructuredGrid(dim, self.sr3.grid.cells.corners)
    grid = grid.compute_connectivity()
    grid = grid.compute_connections()
    grid = grid.compute_cell_sizes(length=False, area=False, volume=True)

    # Hide inactive cells
    grid.hide_cells(self.sr3.grid.cells.inactive, inplace=True)
    for property in properties:
        grid.cell_data[property] = sp[property][0]

    grid.scale([1, 1, 40], inplace=True)

    # Hide inactive cells
    grid.hide_cells(self.sr3.grid.cells.inactive, inplace=True)

    return grid`
nikolai-andrianov commented 1 week ago

Hi Sebastian, the current version does not support corner-point grids as the one you are using. But you are welcome to contribute :)