Exemplo n.º 1
0
    def testRect(self):
        a1 = 1.0
        a2 = 2.0
        a3 = 3.0
        grid = ecl.EclGrid.create_rectangular((9, 9, 9), (a1, a2, a3))
        grid.save_EGRID("/tmp/rect.EGRID")
        grid2 = ecl.EclGrid("/tmp/rect.EGRID")
        self.addFile("/tmp/rect.EGRID")
        self.assertTrue(grid)
        self.assertTrue(grid2)

        (x, y, z) = grid.get_xyz(ijk=(4, 4, 4))
        self.assertTrue(
            approx_equalv([x, y, z], [4.5 * a1, 4.5 * a2, 4.5 * a3]))

        v = grid.cell_volume(ijk=(4, 4, 4))
        self.assertTrue(approx_equal(v, a1 * a2 * a3))

        z = grid.depth(ijk=(4, 4, 4))
        self.assertTrue(approx_equal(z, 4.5 * a3))

        g1 = grid.global_index(ijk=(2, 2, 2))
        g2 = grid.global_index(ijk=(4, 4, 4))
        (dx, dy, dz) = grid.distance(g2, g1)
        self.assertTrue(approx_equalv([dx, dy, dz], [2 * a1, 2 * a2, 2 * a3]))

        self.assertTrue(
            grid.cell_contains(2.5 * a1, 2.5 * a2, 2.5 * a3, ijk=(2, 2, 2)))

        ijk = grid.find_cell(1.5 * a1, 2.5 * a2, 3.5 * a3)
        self.assertTrue(approx_equalv(ijk, [1, 2, 3]))
Exemplo n.º 2
0
    def testCoarse(self):
        self.addFile("/tmp/LGC.EGRID")
        self.addFile("/tmp/LGC.GRID")

        testGRID = True
        g1 = ecl.EclGrid(
            "test-data/Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2.EGRID")

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

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

        self.assertTrue(g1.coarse_groups() == 3384)
Exemplo n.º 3
0
    def testSave(self):
        self.addFile("/tmp/test.EGRID")
        self.addFile("/tmp/test.GRID")
        self.addFile("/tmp/test.grdecl")

        g1 = ecl.EclGrid(egrid_file)

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

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

        fileH = open("/tmp/test.grdecl", "w")
        g1.save_grdecl(fileH)
        fileH.close()
        g2 = self.create("/tmp/test.grdecl")
        self.assertTrue(g1.equal(g2))
Exemplo n.º 4
0
    def testDual(self):
        grid = ecl.EclGrid(egrid_file)
        self.assertFalse(grid.dual_grid)
        self.assertTrue(grid.nactive_fracture == 0)

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

        dgrid = ecl.EclGrid(
            "test-data/Statoil/ECLIPSE/DualPoro/DUALPOR_MSW.EGRID")
        self.assertTrue(dgrid.nactive == dgrid.nactive_fracture)
        self.assertTrue(dgrid.nactive == 46118)

        dgrid2 = ecl.EclGrid(
            "test-data/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 = ecl.EclGrid(
            "test-data/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)

        self.addFile("/tmp/DUAL_DIFF.GRID")
        dgrid.save_GRID("/tmp/DUAL_DIFF.GRID")
        dgrid2 = ecl.EclGrid("/tmp/DUAL_DIFF.GRID")
        self.assertTrue(dgrid.equal(dgrid2))
Exemplo n.º 5
0
def load_egrid(egrid_file):
    grid = ecl.EclGrid(egrid_file)
    return grid
Exemplo n.º 6
0
 def testEGRID(self):
     grid = ecl.EclGrid(egrid_file)
     self.assertTrue(grid)
Exemplo n.º 7
0
 def testTime(self):
     t0 = time.clock()
     g1 = ecl.EclGrid(egrid_file)
     t1 = time.clock()
     t = t1 - t0
     self.assertTrue(t < 1.0)
Exemplo n.º 8
0
#!/usr/bin/env python
import ert.ecl.ecl as ecl

g = ecl.EclGrid("data/eclipse/case/ECLIPSE")
r = ecl.EclRegion(g, False)

ll = g.get_xyz(ijk=(0, 0, 0))
ur = g.get_xyz(ijk=(39, 63, 0))

dx = 0.5 * (ur[0] - ll[0])
dy = 0.5 * (ur[1] - ll[1])

x0 = ll[0] + dx * 0.5
y0 = ll[1] + dy * 0.5
x1 = x0 + dx
y1 = y0 + dy

points = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)]

print "            X ----------------------------------- (%10.3f , %10.3f)" % (
    x1 - x0, y1 - y0)
print "            |                                                 |"
print "            |                                                 |"
print "            |                                                 |"
print "            |                                                 |"
print "            |                                                 |"
print "            |                                                 |"
print "            |                                                 |"
print "            |                                                 |"
print "            |                                                 |"
print "(%10.3f , %10.3f) ---------------------------------- X\n\n" % (x0 - x0,
Exemplo n.º 9
0
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  ERT is distributed in the hope that it will be useful, but WITHOUT ANY
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or
#  FITNESS FOR A PARTICULAR PURPOSE.
#
#  See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
#  for more details.

import datetime
import ert.ecl.ecl as ecl

# 1: We need the name of the GRID/EGRID file and the init file. Pass
#    these two filenames to the EclGrav() constructor.
grid = ecl.EclGrid("data/eclipse/grav/TROLL.EGRID")
init_file = ecl.EclFile("data/eclipse/grav/TROLL.INIT")
grav = ecl.EclGrav(grid, init_file)

# 2: We load the restart files for the times we are interested in,
#    this can be done in two different ways:
#
#    a) In the case of non unified restart files you can just use the
#       EclFile() constructor to load the whole file:
#
#              restart1 = ecl.EclFile("ECLIPSE.X0078")
#
#    b) You can use the ecl.EclFile.restart_block() method to load
#       only one block from a unified restart file. In that case you
#       must use 'report_step = nnn' to specifiy which report_step you
#       are interested in. Alternatively you can use 'dtime =