Example #1
0
    def test_dual(self):
        with TestAreaContext("python/grid-test/testDual"):
            grid = EclGrid(self.egrid_file())
            self.assertFalse(grid.dualGrid())
            self.assertTrue(grid.getNumActiveFracture() == 0)

            grid2 = EclGrid(self.grid_file())
            self.assertFalse(grid.dualGrid())
            self.assertTrue(grid.getNumActiveFracture() == 0)

            dgrid = EclGrid(
                self.createTestPath(
                    "Statoil/ECLIPSE/DualPoro/DUALPOR_MSW.EGRID"))
            self.assertTrue(
                dgrid.getNumActive() == dgrid.getNumActiveFracture())
            self.assertTrue(dgrid.getNumActive() == 46118)

            dgrid2 = EclGrid(
                self.createTestPath(
                    "Statoil/ECLIPSE/DualPoro/DUALPOR_MSW.GRID"))
            self.assertTrue(
                dgrid.getNumActive() == dgrid.getNumActiveFracture())
            self.assertTrue(dgrid.getNumActive() == 46118)
            self.assertTrue(dgrid.equal(dgrid2))

            # The DUAL_DIFF grid has been manipulated to create a
            # situation where some cells are only matrix active, and some
            # cells are only fracture active.
            dgrid = EclGrid(
                self.createTestPath(
                    "Statoil/ECLIPSE/DualPoro/DUAL_DIFF.EGRID"))
            self.assertTrue(dgrid.getNumActive() == 106)
            self.assertTrue(dgrid.getNumActiveFracture() == 105)

            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=0) == -1)
            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=2) == -1)
            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=3) == 0)
            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=107) == 104)

            self.assertTrue(dgrid.get_active_index(global_index=1) == 1)
            self.assertTrue(dgrid.get_active_index(global_index=105) == 105)
            self.assertTrue(dgrid.get_active_index(global_index=106) == -1)
            self.assertTrue(dgrid.get_global_index1F(2) == 5)

            dgrid.save_EGRID("DUAL_DIFF.EGRID")
            dgrid2 = EclGrid("DUAL_DIFF.EGRID")
            self.assertTrue(dgrid.equal(dgrid2, verbose=True))
Example #2
0
    def test_coarse(self):
        #work_area = TestArea("python/grid-test/testCoarse")
        with TestAreaContext("python/grid-test/testCoarse"):
            testGRID = True
            g1 = EclGrid(self.createTestPath("Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2.EGRID"))

            g1.save_EGRID("LGC.EGRID")
            g2 = EclGrid("LGC.EGRID")
            self.assertTrue(g1.equal(g2, verbose=True))

            if testGRID:
                g1.save_GRID("LGC.GRID")
                g3 = EclGrid("LGC.GRID")
                self.assertTrue(g1.equal(g3, verbose=True))

            self.assertTrue(g1.coarse_groups() == 3384)
Example #3
0
 def test_coarse(self):
     #work_area = TestArea("python/grid-test/testCoarse")
     with TestAreaContext("python/grid-test/testCoarse"):
         testGRID = True
         g1 = EclGrid(self.createTestPath("Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2.EGRID"))
 
         g1.save_EGRID("LGC.EGRID")
         g2 = EclGrid("LGC.EGRID")
         self.assertTrue(g1.equal(g2, verbose=True))
 
         if testGRID:
             g1.save_GRID("LGC.GRID")
             g3 = EclGrid("LGC.GRID")
             self.assertTrue(g1.equal(g3, verbose=True))
 
         self.assertTrue(g1.coarse_groups() == 3384)
Example #4
0
    def test_save(self):
        with TestAreaContext("python/grid-test/testSave"):
            g1 = EclGrid(self.egrid_file())

            g1.save_EGRID("test.EGRID")
            g2 = EclGrid("test.EGRID")
            self.assertTrue(g1.equal(g2))

            g1.save_GRID("test.GRID")
            g2 = EclGrid("test.GRID")
            self.assertTrue(g1.equal(g2))

            fileH = open("test.grdecl", "w")
            g1.save_grdecl(fileH)
            fileH.close()
            g2 = self.create("test.grdecl")
            self.assertTrue(g1.equal(g2))
Example #5
0
 def test_save(self):
     with TestAreaContext("python/grid-test/testSave"):
         g1 = EclGrid(self.egrid_file())
 
         g1.save_EGRID("test.EGRID")
         g2 = EclGrid("test.EGRID")
         self.assertTrue(g1.equal(g2))
 
         g1.save_GRID("test.GRID")
         g2 = EclGrid("test.GRID")
         self.assertTrue(g1.equal(g2))
 
         fileH = open("test.grdecl", "w")
         g1.save_grdecl(fileH)
         fileH.close()
         g2 = self.create("test.grdecl")
         self.assertTrue(g1.equal(g2))
Example #6
0
    def test_dual(self):
        #work_area = TestArea("python/grid-test/testDual", True)
        with TestAreaContext("python/grid-test/testDual", True):
            grid = EclGrid(self.egrid_file())
            self.assertFalse(grid.dual_grid)
            self.assertTrue(grid.nactive_fracture == 0)

            grid2 = EclGrid(self.grid_file())
            self.assertFalse(grid.dual_grid)
            self.assertTrue(grid.nactive_fracture == 0)

            dgrid = EclGrid(self.createTestPath("Statoil/ECLIPSE/DualPoro/DUALPOR_MSW.EGRID"))
            self.assertTrue(dgrid.nactive == dgrid.nactive_fracture)
            self.assertTrue(dgrid.nactive == 46118)

            dgrid2 = EclGrid(self.createTestPath("Statoil/ECLIPSE/DualPoro/DUALPOR_MSW.GRID"))
            self.assertTrue(dgrid.nactive == dgrid.nactive_fracture)
            self.assertTrue(dgrid.nactive == 46118)
            self.assertTrue(dgrid.equal(dgrid2))


            # The DUAL_DIFF grid has been manipulated to create a
            # situation where some cells are only matrix active, and some
            # cells are only fracture active.
            dgrid = EclGrid(self.createTestPath("Statoil/ECLIPSE/DualPoro/DUAL_DIFF.EGRID"))
            self.assertTrue(dgrid.nactive == 106)
            self.assertTrue(dgrid.nactive_fracture == 105)

            self.assertTrue(dgrid.get_active_fracture_index(global_index=0) == -1)
            self.assertTrue(dgrid.get_active_fracture_index(global_index=2) == -1)
            self.assertTrue(dgrid.get_active_fracture_index(global_index=3) == 0)
            self.assertTrue(dgrid.get_active_fracture_index(global_index=107) == 104)

            self.assertTrue(dgrid.get_active_index(global_index=1) == 1)
            self.assertTrue(dgrid.get_active_index(global_index=105) == 105)
            self.assertTrue(dgrid.get_active_index(global_index=106) == -1)
            self.assertTrue(dgrid.get_global_index1F(2) == 5)

            dgrid.save_GRID("DUAL_DIFF.GRID")
            dgrid2 = EclGrid("DUAL_DIFF.GRID")
            self.assertTrue(dgrid.equal(dgrid2))
Example #7
0
def main( eclipse_file_location , opm_file_location ,  base_name , rel_tolerance, abs_tolerance):
    print "Using relative tolerance of: " + str(rel_tolerance)
    print "Using absolute tolerance of: " + str(abs_tolerance)

    eclipse_restart_file = EclFile(eclipse_file_location + base_name + ".UNRST")
    eclipse_grid_file = EclGrid(eclipse_file_location + base_name + ".EGRID")

    opm_restart_file = EclFile(opm_file_location + base_name + ".UNRST")
    opm_grid_file = EclGrid(opm_file_location + base_name + ".EGRID")

    grids_equal = eclipse_grid_file.equal(opm_grid_file, include_lgr=True, verbose=True)
    if not grids_equal:
        print("The grids in files {0} and {1} are not equal!".format(eclipse_grid_file.name, opm_grid_file.name))
        exit(1)

    compareRestartFiles(eclipse_restart_file, opm_restart_file, rel_tolerance, abs_tolerance)