def test_truth_and_size(self): actnum = IntVector(initial_size=100, default_value=0) actnum[0:50] = 1 grid = EclGrid.createRectangular((10, 10, 1), (1, 1, 1), actnum=actnum) region = EclRegion(grid, False) self.assertFalse(region) self.assertEqual(0, region.active_size()) self.assertEqual(0, region.global_size()) region.select_all() self.assertTrue(region) self.assertEqual(50, region.active_size()) self.assertEqual(100, region.global_size()) region.deselect_all() self.assertFalse(region) self.assertEqual(0, region.active_size()) self.assertEqual(0, region.global_size()) region = EclRegion(grid, False) region.select_inactive() self.assertTrue(region) self.assertEqual(0, region.active_size()) self.assertEqual(50, region.global_size())
def main(grid): vmin,vmax = volume_min_max(grid) dz_limit = 0.3 region = EclRegion(grid, False) region.select_thin(dz_limit) print "Smallest cell : %g" % vmin print "Largest cell : %g" % vmax print "Thin active cells : %d" % region.active_size() for ai in region.get_active_list(): c = grid.cell(active_index=ai) print('dz(%2d, %2d, %2d) = %.3f' % (c.i, c.j, c.k, c.dz))
def main(grid): vmin, vmax = volume_min_max(grid) dz_limit = 0.3 region = EclRegion(grid, False) region.select_thin(dz_limit) print "Smallest cell : %g" % vmin print "Largest cell : %g" % vmax print "Thin active cells : %d" % region.active_size() for ai in region.get_active_list(): c = grid.cell(active_index=ai) print('dz(%2d, %2d, %2d) = %.3f' % (c.i, c.j, c.k, c.dz))
def volum_min_max(grid): vmin = 10000000 vmax = 0 for a in range(grid.getNumActive()): v = grid.cell_volume(active_index=a) vmin = min(vmin, v) vmax = max(vmax, v) return vmin, vmax if __name__ == "__main__": case = sys.argv[1] grid = EclGrid(case) vmin, vmax = volum_min_max(grid) dz_limit = 0.1 region = EclRegion(grid, False) region.select_thin(dz_limit) print "Smallest cell : %g" % vmin print "Largest cell : %g" % vmax print "Thin active cells : %d" % region.active_size() for ai in region.get_active_list(): ijk = grid.get_ijk(active_index=ai) print ijk