def test_slgof_hypo(swl, sorg, sgcr, h): """Shotgun-testing of slgof""" gasoil = GasOil(swl=swl, sorg=sorg, sgcr=sgcr, h=h) gasoil.add_corey_gas() gasoil.add_corey_oil() assert gasoil.selfcheck() slgof = gasoil.slgof_df() check_table(slgof) # Eclipse 100 requirement from manual: assert np.isclose(slgof["sl"].values[0], gasoil.swl + gasoil.sorg) # Eclipse 100 requirement from manual: assert np.isclose(slgof["sl"].values[-1], 1.0) slgof_str = gasoil.SLGOF() assert isinstance(slgof_str, str) assert slgof_str
def test_numerical_problems(swl, sorg, sgcr): """Test fine-tuned numerics for slgof, this function should trigger the code path in slgof_df() where slgof_sl_mismatch is small. Note: The code path taken may depend on hardware/OS etc. """ # Because we cut away some saturation points due to SWINTEGERS, we easily # end in a situation where the wrong saturation point of to "equal" ones # is removed (because in SLGOF, sg is flipped to sl) # Unrounded, this represents a numerical difficulty, when h is low enough, # but there is special code in slgof_df() to workaround this. gasoil = GasOil(swl=swl, sorg=sorg, sgcr=sgcr, h=0.001) gasoil.add_corey_gas() gasoil.add_corey_oil() assert gasoil.selfcheck() slgof = gasoil.slgof_df() assert np.isclose(slgof["SL"].values[0], gasoil.swl + gasoil.sorg) assert np.isclose(slgof["SL"].values[-1], 1.0) check_table(slgof)
def test_gasoil_slgof(): """Test fine-tuned numerics for slgof""" # Parameter set found by hypothesis swl = 0.029950000000000105 sorg = 0.0 sgcr = 0.01994999999999992 # Because we cut away some saturation points due to SWINTEGERS, we easily # end in a situation where the wrong saturation point of to "equal" ones # is removed (because in SLGOF, sg is flipped to sl) # Unrounded, this represents a numerical difficulty, when h is low enough, # but there is special code in slgof_df() to workaround this. gasoil = GasOil(swl=swl, sorg=sorg, sgcr=sgcr, h=0.001) gasoil.add_corey_gas() gasoil.add_corey_oil() assert gasoil.selfcheck() slgof = gasoil.slgof_df() assert np.isclose(slgof["sl"].values[0], gasoil.swl + gasoil.sorg) assert np.isclose(slgof["sl"].values[-1], 1.0) check_table(slgof)