def test_no_such_well(self): grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID") rst_path1 = self.createTestPath("nosuch/path/ECLIPSE.X001") rst_path2 = self.createTestPath("nosuch/path/ECLIPSE.X002") grid = EclGrid(grid_path) with self.assertRaises(IOError): _ = WellInfo(grid, rst_path1) with self.assertRaises(IOError): _ = WellInfo(grid, [rst_path1, rst_path2])
def test_load_broken_direction(self): grid_path = self.createTestPath( "Statoil/ECLIPSE/icon-invalid-value/R6_HM2016B_FFP_BASE.EGRID") rst_path = self.createTestPath( "Statoil/ECLIPSE/icon-invalid-value/R6_HM2016B_FFP_BASE.UNRST") grid = EclGrid(grid_path) well_info = WellInfo(grid, rst_path)
def checkWell(self, rst_file): segment_length = [ 2660, 20, 121, 1347.916, 20.585, 56.249, 115.503, 106.978, 47.124, 279.529, 128.534, 165.33, 59.97, 936.719, ] well_info = WellInfo( self.getGrid(), self.createTestPath( os.path.join("Equinor/ECLIPSE/Troll/Ref2014", rst_file) ), ) well_time_line = well_info["F4BYH"] for well_state in well_time_line: self.assertTrue(well_state.isMultiSegmentWell()) self.assertTrue(well_state.hasSegmentData()) for index, length in enumerate(segment_length): segment = well_state.igetSegment(index) self.assertFloatEqual(segment.length(), length)
def test_rates(self): grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID") rst_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST") sum_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.SMSPEC") grid = EclGrid(grid_path) well_info = WellInfo(grid, rst_path) sum = EclSum(sum_path) for wtl in well_info: for well_state in wtl: # print "%03d %g %g " % (R , well_state.oilRate(), sum.get_from_report( "WOPR:%s" % well , R)) if wtl.getName() == "OP_4": pass # print well_state.oilRate(), well_state.waterRate(), well_state.gasRate(), well_state.volumeRate() # print well_state.oilRateSI(), well_state.waterRateSI(), well_state.gasRateSI(), well_state.volumeRateSI() self.assertEqual(well_state.oilRate(), well_state.oilRateSI()) self.assertEqual(well_state.waterRate(), well_state.waterRateSI()) self.assertEqual(well_state.gasRate(), well_state.gasRateSI()) self.assertEqual(well_state.volumeRate(), well_state.volumeRateSI()) # print sum.get_from_report("WOPR:%s" % wtl.getName(), 1) # print sum.get_from_report( "WWPR:%s" % wtl.getName(), 30 ) for conn in well_state.globalConnections(): # print conn.gasRate(), conn.waterRate(), conn.oilRate() # print conn.gasRateSI(), conn.waterRateSI(), conn.oilRateSI() self.assertEqual(conn.gasRate(), conn.gasRateSI()) self.assertEqual(conn.waterRate(), conn.waterRateSI()) self.assertEqual(conn.oilRate(), conn.oilRateSI()) self.assertEqual(conn.volumeRate(), conn.volumeRateSI())
def test_construction(self): grid_path = self.createTestPath("Equinor/ECLIPSE/Gurbat/ECLIPSE.EGRID") rst_path_1 = self.createTestPath("Equinor/ECLIPSE/Gurbat/ECLIPSE.X0011") rst_path_2 = self.createTestPath("Equinor/ECLIPSE/Gurbat/ECLIPSE.X0022") rst_path_3 = self.createTestPath("Equinor/ECLIPSE/Gurbat/ECLIPSE.X0035") rst_path_4 = self.createTestPath("Equinor/ECLIPSE/Gurbat/ECLIPSE.X0061") grid = EclGrid(grid_path) def checkWellInfo(well_info, well_count, report_step_count): self.assertEqual(len(well_info), well_count) for index, well_time_line in enumerate(well_info): self.assertEqual(len(well_time_line), report_step_count[index]) well_info = WellInfo(grid, rst_path_1) checkWellInfo(well_info, well_count=5, report_step_count=[1, 1, 1, 1, 1]) well_info = WellInfo(grid, EclFile(rst_path_1)) checkWellInfo(well_info, well_count=5, report_step_count=[1, 1, 1, 1, 1]) well_info = WellInfo(grid, [rst_path_1, rst_path_2, rst_path_3]) checkWellInfo(well_info, well_count=8, report_step_count=[3, 3, 3, 3, 3, 2, 2, 2]) well_info = WellInfo(grid, [EclFile(rst_path_1), EclFile(rst_path_2), rst_path_3, EclFile(rst_path_4)]) checkWellInfo(well_info, well_count=8, report_step_count=[4, 4, 4, 4, 4, 3, 3, 3]) well_info = WellInfo(grid) well_info.addWellFile(rst_path_1, True) checkWellInfo(well_info, well_count=5, report_step_count=[1, 1, 1, 1, 1]) well_info.addWellFile(EclFile(rst_path_2), True) checkWellInfo(well_info, well_count=8, report_step_count=[2, 2, 2, 2, 2, 1, 1, 1]) well_info.addWellFile(EclFile(rst_path_3), True) checkWellInfo(well_info, well_count=8, report_step_count=[3, 3, 3, 3, 3, 2, 2, 2]) well_info.addWellFile(rst_path_4, True) checkWellInfo(well_info, well_count=8, report_step_count=[4, 4, 4, 4, 4, 3, 3, 3])
def getWellInfo(self): """ @rtype: WellInfo """ if EclWellTest.__well_info is None: grid_path = self.createTestPath("Equinor/ECLIPSE/Troll/MSW/T07-4A-W2012-16-F3.EGRID") rst_path_1 = self.createTestPath("Equinor/ECLIPSE/Troll/MSW/T07-4A-W2012-16-F3.X0135") grid = EclGrid(grid_path) rst_file = EclFile(rst_path_1, EclFileFlagEnum.ECL_FILE_CLOSE_STREAM) EclWellTest.__well_info = WellInfo(grid, rst_file) return EclWellTest.__well_info
def getWellInfoWithNoWellSegments(self): """ @rtype: WellInfo """ if EclWellTest.__well_info_with_no_well_segments is None: grid_path = self.createTestPath("Statoil/ECLIPSE/Troll/MSW/T07-4A-W2012-16-F3.EGRID") rst_path_1 = self.createTestPath("Statoil/ECLIPSE/Troll/MSW/T07-4A-W2012-16-F3.X0135") grid = EclGrid(grid_path) rst_file = EclFile(rst_path_1, EclFileFlagEnum.ECL_FILE_CLOSE_STREAM) EclWellTest.__well_info_with_no_well_segments = WellInfo(grid, rst_file, False) return EclWellTest.__well_info_with_no_well_segments
def __init__( self, input_case: Union[Path, str], perforation_handling_strategy: str = "bottom_point", ): super().__init__() self._input_case: Path = Path(input_case) self._eclsum = EclSum(str(self._input_case)) self._grid = EclGrid(str(self._input_case.with_suffix(".EGRID"))) self._restart = EclFile(str(self._input_case.with_suffix(".UNRST"))) self._wells = WellInfo( self._grid, rst_file=self._restart, load_segment_information=True ) self._perforation_handling_strategy: str = perforation_handling_strategy
def test_missing_icon(self): well_info_ICON0 = WellInfo(self.grid, self.rst_file_ICON0) well_info_ICON1 = WellInfo(self.grid, self.rst_file_ICON1) self.check_connections(well_info_ICON0, False) self.check_connections(well_info_ICON1, True)