Exemple #1
0
 def setup_method(self, method):
     # Some Rock instances.
     # The permeability will be changed in tests.
     self.rock2 = Rock(cartGrid([4, 5]), perm=5, poro=1)
     self.nc2 = 4 * 5
     self.rock3 = Rock(cartGrid([3, 4, 5]), perm=5, poro=1)
     self.nc3 = 3 * 4 * 5
Exemple #2
0
 def test_gravity_column(self):
     G = gridprocessing.cartGrid([1, 1, 30], [1, 1, 30])
     bc = BoundaryCondition().addPressureSide(G, "top", 1000000)
     assert bc.face[0, 0] == 120
     assert bc.type[0, 0] == "pressure"
     assert bc.value[0, 0] == 1000000
     assert bc.sat is None
Exemple #3
0
 def test_poreVolume_no_ntg(self):
     G = gridprocessing.cartGrid([3, 3, 1], [9, 9, 3])
     rock = Rock(G, perm=0.1, poro=0.5)
     gridprocessing.computeGeometry(G)
     pv_r = poreVolume(G, rock)
     assert np.array_equal(pv_r,
                           13.5 * np.array([[1, 1, 1, 1, 1, 1, 1, 1, 1]]).T)
Exemple #4
0
 def test_expandToCell(self):
     # 1d arrays are used a lot in PRST, but in this case
     # it is better to use a 2d array, since there are
     # fewer special cases.
     G = gridprocessing.cartGrid([5, 5, 5])
     rock = Rock(G, perm=0.1, poro=1)
     assert rock.perm.ndim == 2
     assert rock.perm.shape[0] == 5 * 5 * 5
     assert rock.perm.shape[1] == 1
Exemple #5
0
    def test_BC_attribute_shapes(self):
        # Assert column arrays
        ix = np.array([[120, 121]]).T
        bc = BoundaryCondition(ix, "pressure", 500)
        assert bc.face.shape[0] == 2
        assert bc.face.shape[1] == 1
        print(bc.type)
        assert bc.type.shape[0] == 2
        assert bc.type.shape[1] == 1
        assert bc.value.shape[0] == 2
        assert bc.value.shape[1] == 1

        G = cartGrid([2, 2, 2])
        bc = BoundaryCondition()
        bc.addPressureSide(G, "top", 100)
        assert bc.face.shape[0] == 4
        assert bc.face.shape[1] == 1
        assert bc.type.shape[0] == 4
        assert bc.type.shape[1] == 1
        assert bc.value.shape[0] == 4
        assert bc.value.shape[1] == 1
    def test_gravityColumn(self):
        import numpy as np

        import prst
        import prst.incomp as incomp
        import prst.gridprocessing as gridprocessing
        import prst.utils as utils
        import prst.params as params
        import prst.solvers as solvers
        from prst.utils.units import centi, poise, kilogram, meter, bar, darcy

        prst.gravity_reset()
        G = gridprocessing.cartGrid([1, 1, 30], [1, 1, 30])
        gridprocessing.computeGeometry(G)
        rock = params.rock.Rock(G, perm=0.1*darcy, poro=1)
        fluid = incomp.fluid.SingleFluid(viscosity=1*centi*poise,
                                         density=1014*kilogram/meter**3)
        bc = params.wells_and_bc.BoundaryCondition()
        bc.addPressureSide(G, "top", 100*bar)
        T = solvers.computeTrans(G, rock)
        resSol = solvers.initResSol(G, p0=0.0)
        psol = incomp.incompTPFA(resSol, G, T, fluid, bc=bc)

        # Load MRST results and compare solution pressure, flux, saturation,
        # facePressure.
        matfile = getpath("test_example_gravityColumn/sol.mat")
        msol = loadmat(matfile, squeeze_me=True, struct_as_record=False)["sol"]
        msol_pressure = np.atleast_2d(msol.pressure).transpose()
        msol_flux = np.atleast_2d(msol.flux).transpose()
        msol_s = np.atleast_2d(msol.s).transpose()
        msol_facePressure = np.atleast_2d(msol.facePressure).transpose()

        assert np.allclose(psol.pressure, msol_pressure, rtol=1e-11)
        assert np.allclose(psol.flux, msol_flux, rtol=1e-11)
        assert np.allclose(psol.s, msol_s, rtol=1e-11)
        assert np.allclose(psol.facePressure, msol_facePressure, rtol=1e-11)
Exemple #7
0
 def test_porosity_required(self):
     # default porosity is 1
     G = gridprocessing.cartGrid([3, 3, 3])
     with pytest.raises(TypeError):
         rock = Rock(G, perm=0.1)
Exemple #8
0
 def test_init(self):
     G = gridprocessing.cartGrid([10, 10, 10])
     rock = Rock(G, perm=1, poro=1)