Esempio n. 1
0
    def setUpClass(cls):
        parser = Parser()
        cls.deck_cpa  = parser.parse(test_path('data/CORNERPOINT_ACTNUM.DATA'))
        cls.cp_state = EclipseState(cls.deck_cpa)

        cls.deck_spe3 = parser.parse(test_path('spe3/SPE3CASE1.DATA'))
        cls.state    = EclipseState(cls.deck_spe3)
        cls.schedule  = Schedule(cls.deck_spe3, cls.state)
        cls.summary_config = SummaryConfig(cls.deck_spe3, cls.state, cls.schedule)
Esempio n. 2
0
    def test_jfunc(self):
        # jf["FLAG"]         = WATER; # set in deck
        # jf["DIRECTION"]    = XY;    # default
        # jf["ALPHA_FACTOR"] = 0.5    # default
        # jf["BETA_FACTOR"]  = 0.5    # default
        # jf["OIL_WATER"]    = 21.0   # set in deck
        # jf["GAS_OIL"]      = -1.0   # N/A

        parser = Parser()
        deck = parser.parse(test_path('data/JFUNC.DATA'))
        js = EclipseState(deck)
        self.assertEqual('JFUNC TEST', js.title)
        jf = js.jfunc()
        print(jf)
        self.assertEqual(jf['FLAG'], 'WATER')
        self.assertEqual(jf['DIRECTION'], 'XY')
        self.assertFalse('GAS_OIL' in jf)
        self.assertTrue('OIL_WATER' in jf)
        self.assertEqual(jf['OIL_WATER'], 21.0)
        self.assertEqual(jf["ALPHA_FACTOR"], 0.5)  # default
        self.assertEqual(jf["BETA_FACTOR"], 0.5)  # default

        jfunc_gas = """
DIMENS
 10 10 10 /
ENDSCALE
/
GRID
DX
1000*0.25 /
DY
1000*0.25 /
DZ
1000*0.25 /
TOPS
100*0.25 /
PORO
  1000*0.15 /
JFUNC
  GAS * 13.0 0.6 0.7 Z /
PROPS\nREGIONS
"""
        deck2 = parser.parse_string(jfunc_gas)
        js_gas = EclipseState(deck2)
        jf = js_gas.jfunc()
        self.assertEqual(jf['FLAG'], 'GAS')
        self.assertEqual(jf['DIRECTION'], 'Z')
        self.assertTrue('GAS_OIL' in jf)
        self.assertFalse('OIL_WATER' in jf)
        self.assertEqual(jf['GAS_OIL'], 13.0)
        self.assertEqual(jf["ALPHA_FACTOR"], 0.6)  # default
        self.assertEqual(jf["BETA_FACTOR"], 0.7)  # default
Esempio n. 3
0
 def setUpClass(cls):
     deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
     print("Creating state")
     cls.state = EclipseState(deck)
     print("State OK")
     cls.sch = Schedule(deck, cls.state)
     cls.timesteps = cls.sch.timesteps
Esempio n. 4
0
    def test_all(self):
        with pushd(self.data_dir):
            self.deck = Parser().parse('SPE1CASE1.DATA')
            state = EclipseState(self.deck)
            self.schedule = Schedule(self.deck, state)
            summary_config = SummaryConfig(self.deck, state, self.schedule)
            self.unit_system = self.deck.active_unit_system()

            self.assertTrue('PROD' in self.schedule)
            self.assertTrue('INJ' in self.schedule)
            self.assertEqual(dt.datetime(2015, 1, 1), self.schedule.start)
            self.assertEqual(dt.datetime(2016, 1, 1), self.schedule.end)
            self.sim = BlackOilSimulator(self.deck, state, self.schedule,
                                         summary_config)
            tsteps = self.schedule.timesteps
            self.assertEqual(dt.datetime(2015, 1, 1), tsteps[0])
            last_step = len(tsteps) - 1
            self.assertEqual(dt.datetime(2016, 1, 1), tsteps[last_step])
            self.sim.step_init()
            report_step = 4
            self.sim.advance(report_step=report_step)
            well_name = "PROD"
            prod = self.schedule.get_well(well_name, 2)
            self.assertEqual(prod.status(), "OPEN")
            #schedule.shut_well("PROD", 3)
            #prod = schedule.get_well("PROD", 3)
            #self.assertEqual(prod.status(), "SHUT")
            self.subtest_modify_prod_weltarg_dynamically(
                well_name, report_step)
            self.sim.step()
            report_step = self.sim.current_step()
            well_name = "INJ"
            self.subtest_modify_inj_weltarg_dynamically(well_name, report_step)
            self.sim.advance(report_step=last_step)
            self.sim.step_cleanup()
Esempio n. 5
0
def parse(fname):
    s = dt.now()
    ps = ParseContext([('PARSE_RANDOM_SLASH', opm.io.action.ignore)])
    deck = Parser().parse(fname, ps)
    es = EclipseState(deck)
    e = dt.now()
    print('Parsing took %s sec' % (e - s).seconds)
    return es
Esempio n. 6
0
    def test_parse_norne(self):
         parse_context = ParseContext( [('PARSE_RANDOM_SLASH', opm.io.action.ignore)] )
         deck = Parser().parse(self.norne_fname, parse_context)
         es = EclipseState( deck )

         self.assertEqual(46, es.grid().nx)
         self.assertEqual(112, es.grid().ny)
         self.assertEqual(22, es.grid().nz)
Esempio n. 7
0
 def setUp(self):
     parser = Parser()
     deck = parser.parse(test_path('spe3/SPE3CASE1.DATA'))
     int_array = np.ones(324)
     actnum_kw = DeckKeyword(parser["ACTNUM"], int_array)
     deck.add(actnum_kw)
     self.spe3 = EclipseState(deck)
     self.props = self.spe3.field_props()
Esempio n. 8
0
    def test_parse_with_multiple_recoveries(self):
        recoveries = [("PARSE_RANDOM_SLASH", opm.io.action.ignore),
                      ("FOO", opm.io.action.warn),
                      ("PARSE_RANDOM_TEXT", opm.io.action.throw)]

        parse_context = ParseContext(recoveries)
        deck = Parser().parse(self.spe3fn, parse_context)
        state = EclipseState(deck)
Esempio n. 9
0
 def test_well_names(self):
     deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
     state = EclipseState(deck)
     sch = Schedule(deck, state)
     wnames = sch.well_names("*")
     self.assertTrue("PROD" in wnames)
     self.assertTrue("INJ" in wnames)
     self.assertEqual(len(wnames), 2)
Esempio n. 10
0
    def test_open_shut(self):
        deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
        state = EclipseState(deck)
        sch = Schedule(deck, state)
        prod = sch.get_well("PROD", 1)
        self.assertEqual(prod.status(), "OPEN")

        sch.shut_well("PROD", 10)
        prod = sch.get_well("PROD", 10)
        self.assertEqual(prod.status(), "SHUT")
Esempio n. 11
0
    def test_getitem(self):
        deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
        state = EclipseState(deck)
        sch = Schedule(deck, state)
        self.assertEqual(len(sch), 176)
        with self.assertRaises(IndexError):
            a = sch[200]

        st100 = sch[100]
        nupcol = st100.nupcol
Esempio n. 12
0
 def test_faults(self):
     self.assertEquals([], self.state.faultNames())
     parser = Parser()
     faultdeck = parser.parse_string(self.FAULTS_DECK)
     faultstate = EclipseState(faultdeck)
     self.assertEqual(['F1', 'F2'], faultstate.faultNames())
     # 'F2'  5  5  1  4   1  4  'X-' / \n"
     f2 = faultstate.faultFaces('F2')
     self.assertTrue((4, 0, 0, 'X-') in f2)
     self.assertFalse((3, 0, 0, 'X-') in f2)
Esempio n. 13
0
def main():
    deck = Parser().parse('../tests/spe3/SPE3CASE1.DATA')
    es = EclipseState(deck)
    sc = Schedule(deck, es)
    wp = sc.get_wells(0)[0] # producer
    wi = sc.get_wells(0)[1] # injector
    print('state:     %s' % es)
    print('schedule:  %s' % sc)
    print('prod well: %s' % wp)
    print('inj  well: %s' % wi)
    for i in range(len(sc.timesteps)):
        if not sc.get_wells(i)[0].isproducer() or sc.get_wells(i)[0].isinjector():
            print('wp is not producer in step %s' % sc.timesteps[i])
        if not sc.get_wells(i)[1].isinjector() or sc.get_wells(i)[1].isproducer():
            print('wi is not injector in step %s' % sc.timesteps[i])
Esempio n. 14
0
 def test_injection_properties(self):
     deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
     state = EclipseState(deck)
     sch = Schedule(deck, state)
     report_step = 4
     well_name = 'INJ'
     prop = sch.get_injection_properties(well_name, report_step)
     self.assertEqual(prop['surf_inj_rate'], 4700.0)  # Mscf/day
     self.assertEqual(prop['resv_inj_rate'], 0.0)  # rb/day
     self.assertEqual(prop['bhp_target'], 4000.0)  # psi
     self.assertEqual(prop['thp_target'], 0.0)
     with self.assertRaises(IndexError):
         prop = sch.get_injection_properties("UNDEF", report_step)
     with self.assertRaises(KeyError):
         prop = sch.get_injection_properties("PROD", report_step)
Esempio n. 15
0
 def test_production_properties(self):
     deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
     state = EclipseState(deck)
     sch = Schedule(deck, state)
     report_step = 4
     well_name = 'PROD'
     prop = sch.get_production_properties(well_name, report_step)
     self.assertEqual(prop['alq_value'], 0.0)
     self.assertEqual(prop['bhp_target'], 500.0)
     self.assertEqual(prop['gas_rate'], 6200.0)
     self.assertEqual(prop['liquid_rate'], 0.0)
     self.assertEqual(prop['oil_rate'], 0.0)
     self.assertEqual(prop['resv_rate'], 0.0)
     self.assertEqual(prop['thp_target'], 0.0)
     self.assertEqual(prop['water_rate'], 0.0)
Esempio n. 16
0
def main():
    deck = parse(join(opmdatadir(), 'norne/NORNE_ATW2013.DATA'))
    es = EclipseState(deck)
    sc = Schedule(deck, es)
    wp = sc.get_wells(100)[20]
    wi = sc.get_wells(100)[19]
    fn = es.faultNames()
    f0 = fn[0]
    fl = es.faultFaces(f0)
    print('state:     %s' % es)
    print('schedule:  %s' % sc)
    print('the grid:  %s' % es.grid())
    print('at timestep 100 (%s)' % sc.timesteps[100])
    print('prod well: %s' % wp)
    print('inj  well: %s' % wi)
    print('pos:       %s' % list(wp.pos()))
    print('fault:     %s' % f0)
    print('           comprised of %d cells' % len(fl))
    swof_krw(es)
Esempio n. 17
0
 def test_all(self):
     with pushd(self.data_dir):
         deck = Parser().parse('SPE1CASE1.DATA')
         state = EclipseState(deck)
         schedule = Schedule(deck, state)
         summary_config = SummaryConfig(deck, state, schedule)
         self.assertTrue('PROD' in schedule)
         self.assertTrue('INJ' in schedule)
         self.assertEqual(dt.datetime(2015, 1, 1), schedule.start)
         self.assertEqual(dt.datetime(2016, 1, 1), schedule.end)
         sim = BlackOilSimulator(deck, state, schedule, summary_config)
         sim.step_init()
         sim.step()
         prod = schedule.get_well("PROD", 2)
         self.assertEqual(prod.status(), "OPEN")
         #schedule.shut_well("PROD", 3)
         #prod = schedule.get_well("PROD", 3)
         #self.assertEqual(prod.status(), "SHUT")
         sim.step()
         sim.step()
Esempio n. 18
0
 def setUp(self):
     parser = Parser()
     deck = parser.parse(test_path('spe3/SPE3CASE1.DATA'))
     self.spe3 = EclipseState(deck)
     self.props = self.spe3.props()
Esempio n. 19
0
 def test_parse_with_recovery(self):
     recovery = [("PARSE_RANDOM_SLASH", opm.io.action.ignore)]
     parse_context = ParseContext(recovery)
     deck = Parser().parse(self.spe3fn, parse_context)
     state = EclipseState(deck)
Esempio n. 20
0
 def test_parse(self):
     deck = Parser().parse(self.spe3fn)
     state = EclipseState(deck)
     self.assertEqual('SPE 3 - CASE 1', state.title)
Esempio n. 21
0
 def setUpClass(cls):
     deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
     state = EclipseState(deck)
     cls.sch = Schedule(deck, state)
     cls.timesteps = cls.sch.timesteps
Esempio n. 22
0
 def test_open_shut(self):
     deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
     state = EclipseState(deck)
     sch = Schedule(deck, state)
Esempio n. 23
0
 def test_restart(self):
     deck = Parser().parse(test_path('spe3/SPE3CASE1.DATA'))
     state = EclipseState(deck)
     sch = Schedule(deck, state)
     rst = sch.restart