Exemple #1
0
    def testRect(self):
        a1 = 1.0
        a2 = 2.0
        a3 = 3.0
        grid = ecl.EclGrid.create_rectangular((9, 9, 9), (a1, a2, a3))
        grid.save_EGRID("/tmp/rect.EGRID")
        grid2 = ecl.EclGrid("/tmp/rect.EGRID")
        self.addFile("/tmp/rect.EGRID")
        self.assertTrue(grid)
        self.assertTrue(grid2)

        (x, y, z) = grid.get_xyz(ijk=(4, 4, 4))
        self.assertTrue(
            approx_equalv([x, y, z], [4.5 * a1, 4.5 * a2, 4.5 * a3]))

        v = grid.cell_volume(ijk=(4, 4, 4))
        self.assertTrue(approx_equal(v, a1 * a2 * a3))

        z = grid.depth(ijk=(4, 4, 4))
        self.assertTrue(approx_equal(z, 4.5 * a3))

        g1 = grid.global_index(ijk=(2, 2, 2))
        g2 = grid.global_index(ijk=(4, 4, 4))
        (dx, dy, dz) = grid.distance(g2, g1)
        self.assertTrue(approx_equalv([dx, dy, dz], [2 * a1, 2 * a2, 2 * a3]))

        self.assertTrue(
            grid.cell_contains(2.5 * a1, 2.5 * a2, 2.5 * a3, ijk=(2, 2, 2)))

        ijk = grid.find_cell(1.5 * a1, 2.5 * a2, 3.5 * a3)
        self.assertTrue(approx_equalv(ijk, [1, 2, 3]))
Exemple #2
0
    def testRect(self):
        a1 = 1.0
        a2 = 2.0
        a3 = 3.0
        grid = ecl.EclGrid.create_rectangular((9,9,9) , (a1,a2,a3))
        grid.save_EGRID( "/tmp/rect.EGRID" )
        grid2 = ecl.EclGrid( "/tmp/rect.EGRID")
        self.addFile( "/tmp/rect.EGRID" )
        self.assertTrue( grid )
        self.assertTrue( grid2 )
        
        (x,y,z) = grid.get_xyz( ijk=(4,4,4) )
        self.assertTrue( approx_equalv( [x,y,z],[4.5 * a1,4.5*a2,4.5*a3] ))

        v = grid.cell_volume( ijk=(4,4,4) )
        self.assertTrue( approx_equal( v , a1*a2*a3 ))

        z = grid.depth( ijk = (4,4,4 ))
        self.assertTrue( approx_equal( z , 4.5*a3 ))

        g1 = grid.global_index( ijk = (2,2,2) )
        g2 = grid.global_index( ijk = (4,4,4) )
        (dx,dy,dz) = grid.distance( g2 , g1 )
        self.assertTrue( approx_equalv([dx,dy,dz],[2*a1,2*a2,2*a3] ) )

        self.assertTrue( grid.cell_contains(2.5*a1 , 2.5*a2, 2.5*a3 , ijk=(2,2,2)))

        ijk = grid.find_cell( 1.5*a1 , 2.5*a2, 3.5*a3 )
        self.assertTrue( approx_equalv( ijk , [1 , 2 , 3]))
Exemple #3
0
    def test_last( self ):
        sum = self.sum
        last = sum.get_last("FOPT")
        self.assertTrue( approx_equal( last.value , 38006336.0 ))
        self.assertTrue( approx_equal( last.days , 1826.0 ))
        self.assertEqual( last.date , datetime.datetime( 2004 , 12 , 31, 0,0,0))

        self.assertTrue( approx_equal( sum.get_last_value("FGPT") , 6605249024.0)) 
Exemple #4
0
    def test_last(self):
        sum = self.sum
        last = sum.get_last("FOPT")
        self.assertTrue(approx_equal(last.value, 38006336.0))
        self.assertTrue(approx_equal(last.days, 1826.0))
        self.assertEqual(last.date, datetime.datetime(2004, 12, 31, 0, 0, 0))

        self.assertTrue(approx_equal(sum.get_last_value("FGPT"), 6605249024.0))
Exemple #5
0
 def test_interp(self):
     sum = self.sum
     self.assertTrue( approx_equal( sum.get_interp( "WWCT:OP_3" , days = 750 ) , 0.11719122))
     self.assertTrue( approx_equal( sum.get_interp( "WWCT:OP_3" , date = datetime.date( 2004,1,1)) , 0.603358387947 ))
     
     v = sum.get_interp_vector( "WOPT:OP_1" , days_list = [100 , 200 , 400 , 800] )
     self.assertTrue( approx_equalv( [805817.11875 , 1614955.34677419 , 3289267.67857143 , 6493021.6218035 ] , v))
     
     v = sum.get_interp_vector( "WGPT:OP_2" , date_list = [datetime.date(2002,1,1) , datetime.date(2003,1,1) , datetime.date(2004 , 1 , 1)])
     self.assertTrue( approx_equalv( v ,  [ 8.20773632e+08  , 9.68444032e+08  , 1.02515213e+09]) )
Exemple #6
0
    def test_dates( self ):
        sum = self.sum
        d = sum.dates

        self.assertEqual( len(d) , 63 )
        self.assertEqual( d[25] , datetime.datetime( 2001 , 12 , 1 , 0 , 0 , 0))
        self.assertEqual( sum.iget_date( 25 ) , datetime.datetime( 2001 , 12 , 1 , 0 , 0 , 0))
        
        mpl_dates = sum.mpl_dates
        self.assertTrue( approx_equal( mpl_dates[25] , 730820 ))
        
        days = sum.days
        self.assertTrue( approx_equal( days[50] , 1461 ))
Exemple #7
0
    def test_report(self):
        sum = self.sum
        self.assertEqual( sum.get_report( date = datetime.date( 2000,10,1) ) , 10)
        self.assertEqual( sum.get_report( date = datetime.date( 2000,10,3) ) , -1)
        self.assertEqual( sum.get_report( date = datetime.date( 1980,10,3) ) , -1)
        self.assertEqual( sum.get_report( date = datetime.date( 2012,10,3) ) , -1)

        self.assertEqual( sum.get_report( days = 91 ) , 3)
        self.assertEqual( sum.get_report( days = 92 ) , -1)
        self.assertTrue( approx_equal( sum.get_interp( "FOPT" , days = 91 ) , sum.get_from_report( "FOPT" , 3 )) )

        self.assertEqual( sum.first_report , 1 )
        self.assertEqual( sum.last_report  , 62 )

        self.assertEqual( sum.get_report_time( 10 ) , datetime.date( 2000 , 10 , 1))
        self.assertTrue(  approx_equal( sum.get_from_report( "FOPT" , 10 ) , 6.67447e+06) )
Exemple #8
0
    def test_dates( self ):
        sum = self.sum
        d = sum.dates

        self.assertEqual( d[0]  , datetime.datetime( 2000 , 1 , 1 , 0 , 0 , 0))
        self.assertEqual( d[62] , datetime.datetime( 2004 , 12 , 31 , 0 , 0 , 0))
        self.assertEqual( len(d) , 63 )
        self.assertEqual( d[25] , datetime.datetime( 2001 , 12 , 1 , 0 , 0 , 0))
        self.assertEqual( sum.iget_date( 25 ) , datetime.datetime( 2001 , 12 , 1 , 0 , 0 , 0))
        
        mpl_dates = sum.mpl_dates
        self.assertTrue( approx_equal( mpl_dates[25] , 730820 ))
        
        days = sum.days
        self.assertTrue( approx_equal( days[50] , 1461 ))

        self.assertEqual( sum.start_time , datetime.datetime( 2000 , 1 , 1 , 0 , 0 , 0))
        self.assertEqual( sum.end_time , datetime.datetime( 2004 , 12 , 31 , 0 , 0 , 0))
        self.assertTrue( sum.check_sim_time(datetime.datetime( 2004 , 12 , 31 , 0 , 0 , 0)))
Exemple #9
0
    def test_report(self):
        sum = self.sum
        self.assertEqual(sum.get_report(date=datetime.date(2000, 10, 1)), 10)
        self.assertEqual(sum.get_report(date=datetime.date(2000, 10, 3)), -1)
        self.assertEqual(sum.get_report(date=datetime.date(1980, 10, 3)), -1)
        self.assertEqual(sum.get_report(date=datetime.date(2012, 10, 3)), -1)

        self.assertEqual(sum.get_report(days=91), 3)
        self.assertEqual(sum.get_report(days=92), -1)
        self.assertTrue(
            approx_equal(sum.get_interp("FOPT", days=91),
                         sum.get_from_report("FOPT", 3)))

        self.assertEqual(sum.first_report, 1)
        self.assertEqual(sum.last_report, 62)

        self.assertEqual(sum.get_report_time(10), datetime.date(2000, 10, 1))
        self.assertTrue(
            approx_equal(sum.get_from_report("FOPT", 10), 6.67447e+06))
Exemple #10
0
 def RFTCell(self):
     i = 10
     j = 8
     k = 100
     depth = 100
     pressure = 65
     swat = 0.56
     sgas = 0.10
     cell = ecl.EclRFTCell.new( i , j , k , depth , pressure , swat , sgas )
     
     self.assertTrue( i == cell.get_i() )
     self.assertTrue( j == cell.get_j() )
     self.assertTrue( k == cell.get_k() )
     
     self.assertTrue( approx_equal( pressure , cell.pressure) )
     self.assertTrue( approx_equal( depth    , cell.depth ))
     self.assertTrue( approx_equal( swat     , cell.swat) )
     self.assertTrue( approx_equal( sgas     , cell.sgas ))
     self.assertTrue( approx_equal( 1 - (sgas + swat)  , cell.soil ))
Exemple #11
0
    def test_dates(self):
        sum = self.sum
        d = sum.dates

        self.assertEqual(d[0], datetime.datetime(2000, 1, 1, 0, 0, 0))
        self.assertEqual(d[62], datetime.datetime(2004, 12, 31, 0, 0, 0))
        self.assertEqual(len(d), 63)
        self.assertEqual(d[25], datetime.datetime(2001, 12, 1, 0, 0, 0))
        self.assertEqual(sum.iget_date(25),
                         datetime.datetime(2001, 12, 1, 0, 0, 0))

        mpl_dates = sum.mpl_dates
        self.assertTrue(approx_equal(mpl_dates[25], 730820))

        days = sum.days
        self.assertTrue(approx_equal(days[50], 1461))

        self.assertEqual(sum.start_time,
                         datetime.datetime(2000, 1, 1, 0, 0, 0))
        self.assertEqual(sum.end_time,
                         datetime.datetime(2004, 12, 31, 0, 0, 0))
        self.assertTrue(
            sum.check_sim_time(datetime.datetime(2004, 12, 31, 0, 0, 0)))
Exemple #12
0
    def test_interp(self):
        sum = self.sum
        self.assertTrue(
            approx_equal(sum.get_interp("WWCT:OP_3", days=750), 0.11719122))
        self.assertTrue(
            approx_equal(
                sum.get_interp("WWCT:OP_3", date=datetime.date(2004, 1, 1)),
                0.603358387947))

        v = sum.get_interp_vector("WOPT:OP_1", days_list=[100, 200, 400, 800])
        self.assertTrue(
            approx_equalv([
                805817.11875, 1614955.34677419, 3289267.67857143,
                6493021.6218035
            ], v))

        v = sum.get_interp_vector("WGPT:OP_2",
                                  date_list=[
                                      datetime.date(2002, 1, 1),
                                      datetime.date(2003, 1, 1),
                                      datetime.date(2004, 1, 1)
                                  ])
        self.assertTrue(
            approx_equalv(v, [8.20773632e+08, 9.68444032e+08, 1.02515213e+09]))
Exemple #13
0
    def PLTCell(self):
        i = 2
        j = 16
        k = 100
        depth = 100
        pressure = 65
        orat = 0.78
        grat = 88
        wrat = 97213
        conn_start = 214
        conn_end = 400
        flowrate = 111
        oil_flowrate = 12
        gas_flowrate = 132
        water_flowrate = 13344

        cell = ecl.EclPLTCell.new( i , j , k , depth , pressure , orat , grat , wrat , conn_start , conn_end, flowrate , oil_flowrate , gas_flowrate , water_flowrate)
                                   
        
        self.assertTrue( i == cell.get_i() )
        self.assertTrue( j == cell.get_j() )
        self.assertTrue( k == cell.get_k() )
        
        self.assertTrue( cell.get_i() + 1 == cell.i )
        self.assertTrue( cell.get_j() + 1 == cell.j )
        self.assertTrue( cell.get_k() + 1 == cell.k )
        
        
        self.assertTrue( approx_equal( pressure , cell.pressure) )
        self.assertTrue( approx_equal( depth    , cell.depth ))
        self.assertTrue( approx_equal( orat     , cell.orat) )
        self.assertTrue( approx_equal( grat     , cell.grat ))
        self.assertTrue( approx_equal( wrat     , cell.wrat ))

        self.assertTrue( approx_equal( conn_start , cell.conn_start) )
        self.assertTrue( approx_equal( conn_end   , cell.conn_end) )
        self.assertTrue( approx_equal( flowrate           , cell.flowrate      ))
        self.assertTrue( approx_equal( oil_flowrate       , cell.oil_flowrate  ))
        self.assertTrue( approx_equal( gas_flowrate       , cell.gas_flowrate  ))
        self.assertTrue( approx_equal( water_flowrate     , cell.water_flowrate))