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)
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)
class TestProps(unittest.TestCase): def assertClose(self, expected, observed, epsilon=1e-08): diff = abs(expected - observed) err_msg = '|%g - %g| = %g > %g' % (expected, observed, diff, epsilon) self.assertTrue(diff <= epsilon, msg=err_msg) def setUp(self): parser = Parser() deck = parser.parse(test_path('spe3/SPE3CASE1.DATA')) self.spe3 = EclipseState(deck) self.props = self.spe3.props() def test_contains(self): p = self.props self.assertTrue('PORO' in p) self.assertFalse('NONO' in p) self.assertTrue('PORV' in p) # auto generated def test_getitem(self): p = self.props poro = p['PORO'] self.assertEqual(324, len(poro)) self.assertEqual(0.13, poro[0]) self.assertTrue('PERMX' in p) px = p['PERMX'] print(len(px)) self.assertEqual(324, len(px)) def test_permx_values(self): def md2si(md): #millidarcy->SI return md * 1e-3 * 9.869233e-13 e3dp = self.props grid = self.spe3.grid() permx = e3dp['PERMX'] print('set(PERMX) = %s' % set(permx)) # 130mD, 40mD, 20mD, and 150mD, respectively, top to bottom darcys = {0: md2si(130), 1: md2si(40), 2: md2si(20), 3: md2si(150)} for i in range(grid.nx): for j in range(grid.ny): for k in range(grid.nz): g_idx = grid.globalIndex(i, j, k) perm = permx[g_idx] darcy = darcys[k] self.assertClose(darcy, perm) def test_volume(self): e3dp = self.props grid = self.spe3.grid() for i in range(grid.nx): for j in range(grid.ny): for k in range(grid.nz): g_idx = grid.globalIndex(i, j, k) exp = 293.3 * 293.3 * 30 # cubicfeet = 73 078.6084 cubic meter exp *= (12 * 0.0254)**3 # cubic feet to cubic meter if k == 0: self.assertClose(exp, grid.getCellVolume(g_idx)) self.assertEqual(grid.getCellVolume(g_idx), grid.getCellVolume(i, j, k))