Skip to content

Commit

Permalink
Split statoil grid test (#458)
Browse files Browse the repository at this point in the history
Split test: test_grid_statoil split into 4 tests.
  • Loading branch information
Steinar Foss authored and joakim-hove committed Aug 24, 2018
1 parent 1f05183 commit 9fab2ea
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 70 deletions.
6 changes: 6 additions & 0 deletions python/tests/ecl_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ set(TEST_SOURCES
test_grid.py
test_cell.py
test_grid_statoil.py
test_grid_statoil_coarse.py
test_grid_statoil_dual.py
test_grid_statoil_large_case.py
test_grid_generator.py
test_indexed_read.py
test_ecl_kw_statoil.py
Expand Down Expand Up @@ -77,6 +80,9 @@ addPythonTest(tests.ecl_tests.test_ecl_file_statoil.EclFileStatoilTest)
addPythonTest(tests.ecl_tests.test_grdecl_statoil.GRDECLStatoilTest)
addPythonTest(tests.ecl_tests.test_grdecl.GRDECLTest)
addPythonTest(tests.ecl_tests.test_grid_statoil.GridTest)
addPythonTest(tests.ecl_tests.test_grid_statoil_coarse.GridCoarceTest)
addPythonTest(tests.ecl_tests.test_grid_statoil_dual.GridDualTest)
addPythonTest(tests.ecl_tests.test_grid_statoil_large_case.GridLargeCaseTest)
addPythonTest(tests.ecl_tests.test_ecl_kw_statoil.KWTest)
addPythonTest(tests.ecl_tests.test_ecl_init_file.InitFileTest)
addPythonTest(tests.ecl_tests.test_ecl_restart_file.RestartFileTest)
Expand Down
70 changes: 0 additions & 70 deletions python/tests/ecl_tests/test_grid_statoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,24 +242,6 @@ def test_save(self):
g2 = self.create("test.grdecl")
self.assertTrue(g1.equal(g2))

@skipIf(EclTest.slowTestShouldNotRun(), "Slow test of coarse grid skipped!")
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)


def test_raise_IO_error(self):
with self.assertRaises(IOError):
Expand Down Expand Up @@ -293,52 +275,6 @@ def test_boundingBox(self):
self.assertEqual( bbox , ((3,3) , (7,3) , (7,7) , (3,7)))





@skipIf(EclTest.slowTestShouldNotRun(), "Slow test of dual grid skipped!")
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))


@skipIf(EclTest.slowTestShouldNotRun(), "Slow test of numActive large memory skipped!")
def test_num_active_large_memory(self):
case = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE")
Expand Down Expand Up @@ -391,12 +327,6 @@ def test_volume_kw(self):
self.assertEqual( volume , grid.cell_volume( global_index = global_index ))



def test_large_case(self):
grdecl_file = self.createTestPath("Statoil/ECLIPSE/1.6.0_issueGrdecl/test_aug2016_gridOnly.grdecl")
grid = EclGrid.loadFromGrdecl( grdecl_file )


def test_lgr_get(self):
grid = EclGrid(self.createTestPath("Statoil/ECLIPSE/Troll/MSW_LGR/2BRANCHES-CCEWELLPATH-NEW-SCH-TUNED-AR3.EGRID"))
for (nr,name) in [ ( 104 , "LG003017"),
Expand Down
42 changes: 42 additions & 0 deletions python/tests/ecl_tests/test_grid_statoil_coarse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (C) 2018 Statoil ASA, Norway.
#
# The file 'test_grid_statoil_coarse.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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 math

from ecl.util.test import TestAreaContext
from ecl.grid import EclGrid

from tests import EclTest, statoil_test


@statoil_test()
class GridCoarceTest(EclTest):

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)
71 changes: 71 additions & 0 deletions python/tests/ecl_tests/test_grid_statoil_dual.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Copyright (C) 2018 Statoil ASA, Norway.
#
# The file 'test_grid_statoil_dual.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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 math

from ecl.util.test import TestAreaContext
from ecl.grid import EclGrid

from tests import EclTest, statoil_test

@statoil_test()
class GridDualTest(EclTest):

def egrid_file(self):
return self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID")

def grid_file(self):
return self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.GRID")

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))
29 changes: 29 additions & 0 deletions python/tests/ecl_tests/test_grid_statoil_large_case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (C) 2018 Statoil ASA, Norway.
#
# The file 'test_grid_statoil_large_case.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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 math

from ecl.util.test import TestAreaContext
from ecl.grid import EclGrid

from tests import EclTest, statoil_test


@statoil_test()
class GridLargeCaseTest(EclTest):

def test_large_case(self):
grdecl_file = self.createTestPath("Statoil/ECLIPSE/1.6.0_issueGrdecl/test_aug2016_gridOnly.grdecl")
grid = EclGrid.loadFromGrdecl( grdecl_file )

0 comments on commit 9fab2ea

Please sign in to comment.