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 getWellInfo(self): """ @rtype: WellInfo """ if EclWellTest.__well_info 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 = WellInfo(grid, rst_file) return EclWellTest.__well_info
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("Statoil/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_construction(self): grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID") rst_path_1 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0011") rst_path_2 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0022") rst_path_3 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0035") rst_path_4 = self.createTestPath("Statoil/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 test_construction(self): grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID") rst_path_1 = self.createTestPath( "Statoil/ECLIPSE/Gurbat/ECLIPSE.X0011") rst_path_2 = self.createTestPath( "Statoil/ECLIPSE/Gurbat/ECLIPSE.X0022") rst_path_3 = self.createTestPath( "Statoil/ECLIPSE/Gurbat/ECLIPSE.X0035") rst_path_4 = self.createTestPath( "Statoil/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])