def test_creation(self): ecl_sum = EclSum.writer("TEST", datetime(2010, 1, 1), 10, 10, 10) ecl_sum.addVariable("FOPT") ecl_sum.addVariable("FOPR") smspec = ecl_sum.cNamespace().get_smspec(ecl_sum) test_data = [(1, 0, 10), (1, 1, 20), (1, 2, 30), (2, 0, 40)] for report_step, mini_step, sim_days in test_data: ecl_sum_tstep = EclSumTStep(report_step, mini_step, sim_days, smspec) self.assertEqual(ecl_sum_tstep.getSimDays(), sim_days) self.assertEqual(ecl_sum_tstep.getReport(), report_step) self.assertEqual(ecl_sum_tstep.getMiniStep(), mini_step) self.assertTrue("FOPT" in ecl_sum_tstep) self.assertTrue("FOPR" in ecl_sum_tstep) self.assertFalse("WWCT" in ecl_sum_tstep) random_float = random.random() ecl_sum_tstep["FOPT"] = random_float ecl_sum_tstep["FOPR"] = random_float + 1 self.assertAlmostEqual(random_float, ecl_sum_tstep["FOPT"], places=5) self.assertAlmostEqual(random_float + 1, ecl_sum_tstep["FOPR"], places=5) with self.assertRaises(KeyError): ecl_sum_tstep["FROPR"] = 2 with self.assertRaises(KeyError): value = ecl_sum_tstep["FROPR"]
def test_writer(self): writer = EclSum.writer("CASE" , datetime.date( 2000 , 1 , 1) , 10 , 10 , 5) self.assertIsInstance(self.ecl_sum, EclSum) writer.addVariable( "FOPT" ) self.assertTrue( writer.has_key( "FOPT" )) writer.addTStep( 1 , 100 )
def runSimulator(simulator, history_simulator, time_step_count): """ @rtype: EclSum """ ecl_sum = EclSum.writer("SNAKE_OIL_FIELD", datetime(2010, 1, 1), 10, 10, 10) ecl_sum.addVariable("FOPT") ecl_sum.addVariable("FOPR") ecl_sum.addVariable("FGPT") ecl_sum.addVariable("FGPR") ecl_sum.addVariable("FWPT") ecl_sum.addVariable("FWPR") ecl_sum.addVariable("FGOR") ecl_sum.addVariable("FWCT") ecl_sum.addVariable("FOPTH") ecl_sum.addVariable("FOPRH") ecl_sum.addVariable("FGPTH") ecl_sum.addVariable("FGPRH") ecl_sum.addVariable("FWPTH") ecl_sum.addVariable("FWPRH") ecl_sum.addVariable("FGORH") ecl_sum.addVariable("FWCTH") ecl_sum.addVariable("WOPR", wgname="OP1") ecl_sum.addVariable("WOPR", wgname="OP2") ecl_sum.addVariable("WWPR", wgname="OP1") ecl_sum.addVariable("WWPR", wgname="OP2") ecl_sum.addVariable("WGPR", wgname="OP1") ecl_sum.addVariable("WGPR", wgname="OP2") ecl_sum.addVariable("WGOR", wgname="OP1") ecl_sum.addVariable("WGOR", wgname="OP2") ecl_sum.addVariable("WWCT", wgname="OP1") ecl_sum.addVariable("WWCT", wgname="OP2") ecl_sum.addVariable("WOPRH", wgname="OP1") ecl_sum.addVariable("WOPRH", wgname="OP2") ecl_sum.addVariable("WWPRH", wgname="OP1") ecl_sum.addVariable("WWPRH", wgname="OP2") ecl_sum.addVariable("WGPRH", wgname="OP1") ecl_sum.addVariable("WGPRH", wgname="OP2") ecl_sum.addVariable("WGORH", wgname="OP1") ecl_sum.addVariable("WGORH", wgname="OP2") ecl_sum.addVariable("WWCTH", wgname="OP1") ecl_sum.addVariable("WWCTH", wgname="OP2") ecl_sum.addVariable("BPR", num=globalIndex(5, 5, 5)) ecl_sum.addVariable("BPR", num=globalIndex(1, 3, 8)) time_map = [] mini_step_count = 10 total_step_count = time_step_count * mini_step_count for report_step in range(time_step_count): for mini_step in range(mini_step_count): t_step = ecl_sum.addTStep(report_step + 1, sim_days=report_step * mini_step_count + mini_step) time_map.append(t_step.getSimTime().datetime().strftime("%d/%m/%Y")) simulator.step(scale=1.0 / total_step_count) history_simulator.step(scale=1.0 / total_step_count) t_step["FOPR"] = simulator.fopr() t_step["FOPT"] = simulator.fopt() t_step["FGPR"] = simulator.fgpr() t_step["FGPT"] = simulator.fgpt() t_step["FWPR"] = simulator.fwpr() t_step["FWPT"] = simulator.fwpt() t_step["FGOR"] = simulator.fgor() t_step["FWCT"] = simulator.fwct() t_step["WOPR:OP1"] = simulator.opr("OP1") t_step["WOPR:OP2"] = simulator.opr("OP2") t_step["WGPR:OP1"] = simulator.gpr("OP1") t_step["WGPR:OP2"] = simulator.gpr("OP2") t_step["WWPR:OP1"] = simulator.wpr("OP1") t_step["WWPR:OP2"] = simulator.wpr("OP2") t_step["WGOR:OP1"] = simulator.gor("OP1") t_step["WGOR:OP2"] = simulator.gor("OP2") t_step["WWCT:OP1"] = simulator.wct("OP1") t_step["WWCT:OP2"] = simulator.wct("OP2") t_step["BPR:5,5,5"] = simulator.bpr("5,5,5") t_step["BPR:1,3,8"] = simulator.bpr("1,3,8") t_step["FOPRH"] = history_simulator.fopr() t_step["FOPTH"] = history_simulator.fopt() t_step["FGPRH"] = history_simulator.fgpr() t_step["FGPTH"] = history_simulator.fgpt() t_step["FWPRH"] = history_simulator.fwpr() t_step["FWPTH"] = history_simulator.fwpt() t_step["FGORH"] = history_simulator.fgor() t_step["FWCTH"] = history_simulator.fwct() t_step["WOPRH:OP1"] = history_simulator.opr("OP1") t_step["WOPRH:OP2"] = history_simulator.opr("OP2") t_step["WGPRH:OP1"] = history_simulator.gpr("OP1") t_step["WGPRH:OP2"] = history_simulator.gpr("OP2") t_step["WWPRH:OP1"] = history_simulator.wpr("OP1") t_step["WWPRH:OP2"] = history_simulator.wpr("OP2") t_step["WGORH:OP1"] = history_simulator.gor("OP1") t_step["WGORH:OP2"] = history_simulator.gor("OP2") t_step["WWCTH:OP1"] = history_simulator.wct("OP1") t_step["WWCTH:OP2"] = history_simulator.wct("OP2") return ecl_sum, time_map
def runSimulator(simulator, history_simulator, time_step_count): """ @rtype: EclSum """ ecl_sum = EclSum.writer("SNAKE_OIL_FIELD", datetime(2010, 1, 1), 10, 10, 10) ecl_sum.addVariable('FOPT', unit="SM3") ecl_sum.addVariable('FOPR', unit="SM3/DAY") ecl_sum.addVariable('FGPT', unit="SM3") ecl_sum.addVariable('FGPR', unit="SM3/DAY") ecl_sum.addVariable('FWPT', unit="SM3") ecl_sum.addVariable('FWPR', unit="SM3/DAY") ecl_sum.addVariable('FGOR', unit="SM3/SM3") ecl_sum.addVariable('FWCT', unit="SM3/SM3") ecl_sum.addVariable('FOIP', unit="SM3") ecl_sum.addVariable('FGIP', unit="SM3") ecl_sum.addVariable('FWIP', unit="SM3") ecl_sum.addVariable('FOPTH', unit="SM3") ecl_sum.addVariable('FOPRH', unit="SM3/DAY") ecl_sum.addVariable('FGPTH', unit="SM3") ecl_sum.addVariable('FGPRH', unit="SM3/DAY") ecl_sum.addVariable('FWPTH', unit="SM3") ecl_sum.addVariable('FWPRH', unit="SM3/DAY") ecl_sum.addVariable('FGORH', unit="SM3/SM3") ecl_sum.addVariable('FWCTH', unit="SM3/SM3") ecl_sum.addVariable('FOIPH', unit="SM3") ecl_sum.addVariable('FGIPH', unit="SM3") ecl_sum.addVariable('FWIPH', unit="SM3") ecl_sum.addVariable('WOPR', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WOPR', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WWPR', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WWPR', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGPR', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WGPR', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGOR', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WGOR', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('WWCT', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WWCT', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('WOPRH', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WOPRH', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WWPRH', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WWPRH', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGPRH', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WGPRH', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGORH', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WGORH', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('WWCTH', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WWCTH', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('BPR', num=globalIndex(5, 5, 5), unit="BARSA") ecl_sum.addVariable('BPR', num=globalIndex(1, 3, 8), unit="BARSA") time_map = [] mini_step_count = 10 total_step_count = time_step_count * mini_step_count for report_step in range(time_step_count): for mini_step in range(mini_step_count): t_step = ecl_sum.addTStep(report_step + 1, sim_days=report_step * mini_step_count + mini_step) time_map.append( t_step.getSimTime().datetime().strftime("%d/%m/%Y")) simulator.step(scale=1.0 / total_step_count) history_simulator.step(scale=1.0 / total_step_count) t_step['FOPR'] = simulator.fopr() t_step['FOPT'] = simulator.fopt() t_step['FGPR'] = simulator.fgpr() t_step['FGPT'] = simulator.fgpt() t_step['FWPR'] = simulator.fwpr() t_step['FWPT'] = simulator.fwpt() t_step['FGOR'] = simulator.fgor() t_step['FWCT'] = simulator.fwct() t_step['FOIP'] = simulator.foip() t_step['FGIP'] = simulator.fgip() t_step['FWIP'] = simulator.fwip() t_step['WOPR:OP1'] = simulator.opr('OP1') t_step['WOPR:OP2'] = simulator.opr('OP2') t_step['WGPR:OP1'] = simulator.gpr('OP1') t_step['WGPR:OP2'] = simulator.gpr('OP2') t_step['WWPR:OP1'] = simulator.wpr('OP1') t_step['WWPR:OP2'] = simulator.wpr('OP2') t_step['WGOR:OP1'] = simulator.gor('OP1') t_step['WGOR:OP2'] = simulator.gor('OP2') t_step['WWCT:OP1'] = simulator.wct('OP1') t_step['WWCT:OP2'] = simulator.wct('OP2') t_step['BPR:5,5,5'] = simulator.bpr('5,5,5') t_step['BPR:1,3,8'] = simulator.bpr('1,3,8') t_step['FOPRH'] = history_simulator.fopr() t_step['FOPTH'] = history_simulator.fopt() t_step['FGPRH'] = history_simulator.fgpr() t_step['FGPTH'] = history_simulator.fgpt() t_step['FWPRH'] = history_simulator.fwpr() t_step['FWPTH'] = history_simulator.fwpt() t_step['FGORH'] = history_simulator.fgor() t_step['FWCTH'] = history_simulator.fwct() t_step['FOIPH'] = history_simulator.foip() t_step['FGIPH'] = history_simulator.fgip() t_step['FWIPH'] = history_simulator.fwip() t_step['WOPRH:OP1'] = history_simulator.opr('OP1') t_step['WOPRH:OP2'] = history_simulator.opr('OP2') t_step['WGPRH:OP1'] = history_simulator.gpr('OP1') t_step['WGPRH:OP2'] = history_simulator.gpr('OP2') t_step['WWPRH:OP1'] = history_simulator.wpr('OP1') t_step['WWPRH:OP2'] = history_simulator.wpr('OP2') t_step['WGORH:OP1'] = history_simulator.gor('OP1') t_step['WGORH:OP2'] = history_simulator.gor('OP2') t_step['WWCTH:OP1'] = history_simulator.wct('OP1') t_step['WWCTH:OP2'] = history_simulator.wct('OP2') return ecl_sum, time_map
def runSimulator(simulator, history_simulator, time_step_count): """ @rtype: EclSum """ ecl_sum = EclSum.writer("SNAKE_OIL_FIELD", datetime(2010, 1, 1), 10, 10, 10) ecl_sum.addVariable('FOPT', unit="SM3") ecl_sum.addVariable('FOPR', unit="SM3/DAY") ecl_sum.addVariable('FGPT', unit="SM3") ecl_sum.addVariable('FGPR', unit="SM3/DAY") ecl_sum.addVariable('FWPT', unit="SM3") ecl_sum.addVariable('FWPR', unit="SM3/DAY") ecl_sum.addVariable('FGOR', unit="SM3/SM3") ecl_sum.addVariable('FWCT', unit="SM3/SM3") ecl_sum.addVariable('FOIP', unit="SM3") ecl_sum.addVariable('FGIP', unit="SM3") ecl_sum.addVariable('FWIP', unit="SM3") ecl_sum.addVariable('FOPTH', unit="SM3") ecl_sum.addVariable('FOPRH', unit="SM3/DAY") ecl_sum.addVariable('FGPTH', unit="SM3") ecl_sum.addVariable('FGPRH', unit="SM3/DAY") ecl_sum.addVariable('FWPTH', unit="SM3") ecl_sum.addVariable('FWPRH', unit="SM3/DAY") ecl_sum.addVariable('FGORH', unit="SM3/SM3") ecl_sum.addVariable('FWCTH', unit="SM3/SM3") ecl_sum.addVariable('FOIPH', unit="SM3") ecl_sum.addVariable('FGIPH', unit="SM3") ecl_sum.addVariable('FWIPH', unit="SM3") ecl_sum.addVariable('WOPR', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WOPR', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WWPR', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WWPR', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGPR', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WGPR', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGOR', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WGOR', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('WWCT', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WWCT', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('WOPRH', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WOPRH', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WWPRH', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WWPRH', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGPRH', wgname='OP1', unit="SM3/DAY") ecl_sum.addVariable('WGPRH', wgname='OP2', unit="SM3/DAY") ecl_sum.addVariable('WGORH', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WGORH', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('WWCTH', wgname='OP1', unit="SM3/SM3") ecl_sum.addVariable('WWCTH', wgname='OP2', unit="SM3/SM3") ecl_sum.addVariable('BPR', num=globalIndex(5, 5, 5), unit="BARSA") ecl_sum.addVariable('BPR', num=globalIndex(1, 3, 8), unit="BARSA") time_map = [] mini_step_count = 10 total_step_count = time_step_count * mini_step_count for report_step in range(time_step_count): for mini_step in range(mini_step_count): t_step = ecl_sum.addTStep(report_step + 1, sim_days=report_step * mini_step_count + mini_step) time_map.append(t_step.getSimTime().datetime().strftime("%d/%m/%Y")) simulator.step(scale=1.0 / total_step_count) history_simulator.step(scale=1.0 / total_step_count) t_step['FOPR'] = simulator.fopr() t_step['FOPT'] = simulator.fopt() t_step['FGPR'] = simulator.fgpr() t_step['FGPT'] = simulator.fgpt() t_step['FWPR'] = simulator.fwpr() t_step['FWPT'] = simulator.fwpt() t_step['FGOR'] = simulator.fgor() t_step['FWCT'] = simulator.fwct() t_step['FOIP'] = simulator.foip() t_step['FGIP'] = simulator.fgip() t_step['FWIP'] = simulator.fwip() t_step['WOPR:OP1'] = simulator.opr('OP1') t_step['WOPR:OP2'] = simulator.opr('OP2') t_step['WGPR:OP1'] = simulator.gpr('OP1') t_step['WGPR:OP2'] = simulator.gpr('OP2') t_step['WWPR:OP1'] = simulator.wpr('OP1') t_step['WWPR:OP2'] = simulator.wpr('OP2') t_step['WGOR:OP1'] = simulator.gor('OP1') t_step['WGOR:OP2'] = simulator.gor('OP2') t_step['WWCT:OP1'] = simulator.wct('OP1') t_step['WWCT:OP2'] = simulator.wct('OP2') t_step['BPR:5,5,5'] = simulator.bpr('5,5,5') t_step['BPR:1,3,8'] = simulator.bpr('1,3,8') t_step['FOPRH'] = history_simulator.fopr() t_step['FOPTH'] = history_simulator.fopt() t_step['FGPRH'] = history_simulator.fgpr() t_step['FGPTH'] = history_simulator.fgpt() t_step['FWPRH'] = history_simulator.fwpr() t_step['FWPTH'] = history_simulator.fwpt() t_step['FGORH'] = history_simulator.fgor() t_step['FWCTH'] = history_simulator.fwct() t_step['FOIPH'] = history_simulator.foip() t_step['FGIPH'] = history_simulator.fgip() t_step['FWIPH'] = history_simulator.fwip() t_step['WOPRH:OP1'] = history_simulator.opr('OP1') t_step['WOPRH:OP2'] = history_simulator.opr('OP2') t_step['WGPRH:OP1'] = history_simulator.gpr('OP1') t_step['WGPRH:OP2'] = history_simulator.gpr('OP2') t_step['WWPRH:OP1'] = history_simulator.wpr('OP1') t_step['WWPRH:OP2'] = history_simulator.wpr('OP2') t_step['WGORH:OP1'] = history_simulator.gor('OP1') t_step['WGORH:OP2'] = history_simulator.gor('OP2') t_step['WWCTH:OP1'] = history_simulator.wct('OP1') t_step['WWCTH:OP2'] = history_simulator.wct('OP2') return ecl_sum, time_map