Ejemplo n.º 1
0
def test_comments():
    """Test that the outputters include endpoints in comments"""
    wateroil = WaterOil(h=0.3)
    wateroil.add_corey_water()
    wateroil.add_corey_oil()
    swfn = wateroil.SWFN()
    assert "--" in swfn
    assert "pyscal: " in swfn  # part of version string
    assert "swirr=0" in swfn
    assert "swcr=0" in swfn
    assert "swl=0" in swfn
    assert "sorw=0" in swfn
    assert "nw=2" in swfn
    assert "krwend=1" in swfn
    assert "Corey" in swfn
    assert "krw = krow @ sw=0.5" in swfn
    assert "Zero capillary pressure" in swfn
    assert "SW" in swfn
    assert "KRW" in swfn
    assert "KROW" not in swfn
    assert "PC" in swfn

    swof = wateroil.SWOF()
    assert "--" in swof
    assert "pyscal: " in swof  # part of version string
    assert "swirr=0" in swof
    assert "swcr=0" in swof
    assert "swl=0" in swof
    assert "sorw=0" in swof
    assert "nw=2" in swof
    assert "now=2" in swof
    assert "krwend=1" in swof
    assert "Corey" in swof
    assert "krw = krow @ sw=0.5" in swof
    assert "Zero capillary pressure" in swof
    assert "SW" in swof
    assert "KRW" in swof
    assert "KROW" in swof
    assert "PC" in swof
Ejemplo n.º 2
0
def test_simple_j_petro():
    """Simple test of the simple J petrophysical function correlation"""
    wateroil = WaterOil(swl=0)
    with pytest.raises(ValueError, match="swl must be larger than zero"):
        wateroil.add_simple_J_petro(a=1, b=-2)

    wateroil = WaterOil(swl=0.01)
    wateroil.add_simple_J_petro(a=1, b=-2)
    check_table(wateroil.table)
    assert wateroil.pccomment
    assert "etrophysic" in wateroil.pccomment

    # Zero gravity:
    wateroil.add_simple_J_petro(a=1, b=-2, g=0)
    assert wateroil.table["PC"].unique() == 0.0

    # Numerical test from sample numbers calculated independently in different tool:
    wateroil = WaterOil(swl=0.05, h=0.025)
    wateroil.add_simple_J_petro(a=1.45,
                                b=-0.285,
                                drho=143,
                                g=9.81,
                                perm_ref=15,
                                poro_ref=0.27)
    float_df_checker(wateroil.table, "SW", 0.1, "PC", 22.36746)
    assert "Simplified" in wateroil.pccomment
    assert "etrophysic" in wateroil.pccomment
    wateroil.add_corey_oil()
    wateroil.add_corey_water()
    swof = wateroil.SWOF()
    assert isinstance(swof, str)
    assert swof
    sat_table_str_ok(swof)
    sat_table_str_ok(wateroil.SWFN())

    with pytest.raises(ValueError, match="positive b"):
        wateroil = WaterOil(swl=0.01)
        wateroil.add_simple_J_petro(a=1, b=2)