From 9fab2eac952d56394fc2bdb912c27a2471c75f57 Mon Sep 17 00:00:00 2001 From: Steinar Foss Date: Fri, 24 Aug 2018 15:11:21 +0200 Subject: [PATCH] Split statoil grid test (#458) Split test: test_grid_statoil split into 4 tests. --- python/tests/ecl_tests/CMakeLists.txt | 6 ++ python/tests/ecl_tests/test_grid_statoil.py | 70 ------------------ .../ecl_tests/test_grid_statoil_coarse.py | 42 +++++++++++ .../tests/ecl_tests/test_grid_statoil_dual.py | 71 +++++++++++++++++++ .../ecl_tests/test_grid_statoil_large_case.py | 29 ++++++++ 5 files changed, 148 insertions(+), 70 deletions(-) create mode 100644 python/tests/ecl_tests/test_grid_statoil_coarse.py create mode 100644 python/tests/ecl_tests/test_grid_statoil_dual.py create mode 100644 python/tests/ecl_tests/test_grid_statoil_large_case.py diff --git a/python/tests/ecl_tests/CMakeLists.txt b/python/tests/ecl_tests/CMakeLists.txt index ea6a3d2673..6ff21aea33 100644 --- a/python/tests/ecl_tests/CMakeLists.txt +++ b/python/tests/ecl_tests/CMakeLists.txt @@ -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 @@ -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) diff --git a/python/tests/ecl_tests/test_grid_statoil.py b/python/tests/ecl_tests/test_grid_statoil.py index 04ee50a6c6..a925b6ac0b 100755 --- a/python/tests/ecl_tests/test_grid_statoil.py +++ b/python/tests/ecl_tests/test_grid_statoil.py @@ -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): @@ -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") @@ -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"), diff --git a/python/tests/ecl_tests/test_grid_statoil_coarse.py b/python/tests/ecl_tests/test_grid_statoil_coarse.py new file mode 100644 index 0000000000..11f94ebc90 --- /dev/null +++ b/python/tests/ecl_tests/test_grid_statoil_coarse.py @@ -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 +# 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) diff --git a/python/tests/ecl_tests/test_grid_statoil_dual.py b/python/tests/ecl_tests/test_grid_statoil_dual.py new file mode 100644 index 0000000000..eeb907c075 --- /dev/null +++ b/python/tests/ecl_tests/test_grid_statoil_dual.py @@ -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 +# 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)) diff --git a/python/tests/ecl_tests/test_grid_statoil_large_case.py b/python/tests/ecl_tests/test_grid_statoil_large_case.py new file mode 100644 index 0000000000..09b4b366df --- /dev/null +++ b/python/tests/ecl_tests/test_grid_statoil_large_case.py @@ -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 +# 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 )