示例#1
0
def test_factory_gasoil():
    """Test that we can create curves from dictionaries of parameters"""
    pyscal_factory = PyscalFactory()

    # Factory refuses to create incomplete defaulted objects.
    with pytest.raises(ValueError):
        pyscal_factory.create_gas_oil()

    with pytest.raises(TypeError):
        # (this must be a dictionary)
        # pylint: disable=unexpected-keyword-arg
        pyscal_factory.create_gas_oil(swirr=0.01)  # noqa

    with pytest.raises(TypeError):
        pyscal_factory.create_gas_oil(params="swirr 0.01")

    gasoil = pyscal_factory.create_gas_oil(
        dict(swirr=0.01, swl=0.1, sgcr=0.05, tag="Good sand", ng=1, nog=2))
    assert isinstance(gasoil, GasOil)
    assert gasoil.sgcr == 0.05
    assert gasoil.sgro == 0.0
    assert gasoil.swl == 0.1
    assert gasoil.swirr == 0.01
    assert gasoil.tag == "Good sand"
    sgof = gasoil.SGOF()
    sat_table_str_ok(sgof)
    check_table(gasoil.table)
    assert "Corey krg" in sgof
    assert "Corey krog" in sgof
    assert "Zero capillary pressure" in sgof

    gasoil = pyscal_factory.create_gas_oil(
        dict(ng=1.2, nog=2, krgend=0.8, krgmax=0.9, krogend=0.6))
    sgof = gasoil.SGOF()
    sat_table_str_ok(sgof)
    assert "kroend=0.6" in sgof
    assert "krgend=0.8" in sgof
    check_table(gasoil.table)

    gasoil = pyscal_factory.create_gas_oil(dict(ng=1.3, Log=2, Eog=2, Tog=2))
    sgof = gasoil.SGOF()
    check_table(gasoil.table)
    sat_table_str_ok(sgof)
    assert "Corey krg" in sgof
    assert "LET krog" in sgof

    gasoil = pyscal_factory.create_gas_oil(
        dict(Lg=1, Eg=1, Tg=1, Log=2, Eog=2, Tog=2))
    sgof = gasoil.SGOF()
    sat_table_str_ok(sgof)
    check_table(gasoil.table)
    assert "LET krg" in sgof
    assert "LET krog" in sgof
示例#2
0
def test_fast_mode():
    """Test that the fast-flag is passed on to constructed objects

    Each object's own test code tests the actual effects of the fast flag"""
    wateroil = PyscalFactory.create_water_oil({"nw": 2, "now": 2})
    assert not wateroil.fast
    wateroil = PyscalFactory.create_water_oil({"nw": 2, "now": 2}, fast=True)
    assert wateroil.fast

    gasoil = PyscalFactory.create_gas_oil({"ng": 2, "nog": 2})
    assert not gasoil.fast
    gasoil = PyscalFactory.create_gas_oil({"ng": 2, "nog": 2}, fast=True)
    assert gasoil.fast

    gaswater = PyscalFactory.create_gas_water({"nw": 2, "ng": 2})
    assert not gaswater.gasoil.fast
    assert not gaswater.wateroil.fast
    gaswater = PyscalFactory.create_gas_water({"nw": 2, "ng": 2}, fast=True)
    assert gaswater.gasoil.fast
    assert gaswater.wateroil.fast
    assert gaswater.fast

    wateroilgas = PyscalFactory.create_water_oil_gas(
        {"nw": 2, "now": 2, "ng": 2, "nog": 2}, fast=True
    )
    assert wateroilgas.fast
    assert wateroilgas.wateroil.fast
    assert wateroilgas.gasoil.fast

    scalrec = PyscalFactory.create_scal_recommendation(
        {
            "low": {"nw": 2, "now": 2, "ng": 2, "nog": 2},
            "base": {"nw": 2, "now": 2, "ng": 2, "nog": 2},
            "high": {"nw": 2, "now": 2, "ng": 2, "nog": 2},
        },
        fast=True,
    )
    assert scalrec.low.fast
    assert scalrec.base.fast
    assert scalrec.high.fast

    interpolant = scalrec.interpolate(-0.5)
    assert interpolant.fast
示例#3
0
def test_check_deprecated_krowgend(caplog):
    """Up until pyscal 0.5.x, krogend and krowend were parameters
    to the oil curve parametrization for WaterOil and GasOil. From
    pyscal 0.6.0, krogend and krowend are merged to kroend.
    """
    wateroil = PyscalFactory.create_water_oil(dict(swl=0.1, nw=2, now=2, krowend=0.4))
    assert "krowend" in caplog.text
    assert "deprecated" in caplog.text
    assert wateroil.table["krow"].max() == 0.4

    gasoil = PyscalFactory.create_gas_oil(dict(swl=0.1, ng=2, nog=2, krogend=0.4))
    assert "krogend" in caplog.text
    assert "deprecated" in caplog.text
    assert gasoil.table["krog"].max() == 0.4
示例#4
0
def test_factory_go_gascondensate():
    """In gas condensate problems, the sgro and kromax parameters are relevant"""
    pyscal_factory = PyscalFactory()
    gasoil = pyscal_factory.create_gas_oil(
        dict(sgro=0.1,
             sgcr=0.1,
             tag="Good sand",
             ng=1,
             nog=2,
             kroend=0.5,
             kromax=0.9))
    assert isinstance(gasoil, GasOil)
    assert gasoil.sgro == 0.1
    assert gasoil.tag == "Good sand"
    sgof = gasoil.SGOF()
    sat_table_str_ok(sgof)
    check_table(gasoil.table)
    assert "Corey krog" in sgof
    assert "kroend=0.5" in sgof
    assert "kromax=0.9" in sgof
    assert "sgro=0.1" in sgof
示例#5
0
def test_factory_gasoil():
    """Test that we can create curves from dictionaries of parameters"""

    logging.getLogger().setLevel("INFO")

    factory = PyscalFactory()

    with pytest.raises(TypeError):
        # (this must be a dictionary)
        factory.create_gas_oil(swirr=0.01)  # noqa

    go = factory.create_gas_oil(
        dict(swirr=0.01, swl=0.1, sgcr=0.05, tag="Good sand", ng=1, nog=2))
    assert isinstance(go, GasOil)
    assert go.sgcr == 0.05
    assert go.swl == 0.1
    assert go.swirr == 0.01
    assert go.tag == "Good sand"
    sgof = go.SGOF()
    assert "Corey krg" in sgof
    assert "Corey krog" in sgof
    assert "Zero capillary pressure" in sgof

    go = factory.create_gas_oil(
        dict(ng=1.2, nog=2, krgend=0.8, krgmax=0.9, kroend=0.6))
    sgof = go.SGOF()
    assert "kroend=0.6" in sgof
    assert "krgend=0.8" in sgof

    go = factory.create_gas_oil(dict(ng=1.3, Log=2, Eog=2, Tog=2))
    sgof = go.SGOF()
    assert "Corey krg" in sgof
    assert "LET krog" in sgof

    go = factory.create_gas_oil(dict(Lg=1, Eg=1, Tg=1, Log=2, Eog=2, Tog=2))
    sgof = go.SGOF()
    assert "LET krg" in sgof
    assert "LET krog" in sgof