diff --git a/docs/scripts/check_swatinit.rst b/docs/scripts/check_swatinit.rst index 24f4983a6..a935cdfb1 100644 --- a/docs/scripts/check_swatinit.rst +++ b/docs/scripts/check_swatinit.rst @@ -71,13 +71,15 @@ are: significant volumes, revise the modelling. ``SWATINIT_1`` - When SWATINIT is 1 above the contact, Eclipse will ignore SWATINIT in the cell - and not touch the capillary pressure function. This will typically result in extra - hydrocarbons added to the model for a normal capillary pressure function. This - could be ok as long as the porosities and/or permeabilities of these cells are - small. If it is not, you should look into if there are upscaling issues for - this cell. In situations with nonzero item #9 in EQUIL, this can also occur - below the contact. + When SWATINIT is 1 above the contact, Eclipse will ignore SWATINIT in the + cell and not touch the capillary pressure function. This will typically + result in extra hydrocarbons added to the model for a normal capillary + pressure function. This could be ok as long as the porosities and/or + permeabilities of these cells are small. If it is not, you should look into + if there are upscaling issues for this cell. In situations with nonzero item + #9 in EQUIL, this can also occur below the contact. If SWU is included in the + model and less than 1, cells where SWATINIT is equal or larger than SWU will + also be flagged as SWATINIT_1 as the behaviour is the same. ``HC_BELOW_FWL`` If SWATINIT is less than 1 below the contact provided in EQUIL, Eclipse will @@ -96,12 +98,24 @@ are: SWATINIT was 1 in the water zone, and SWAT is set to 1. -Example text output -------------------- +Text output from check_swatinit +------------------------------- + +When run interactively in a terminal on an Eclipse case, check_swatinit will +print a text output summarizing the results from flagging each cell into +distinct QC categories. The table below sums the water volume changes from +SWATINIT to SWAT for each QC category, in terms of *reservoir* volumes, i.e. no +conversion to surface conditions. The percentages are with respect the +SWATINIT_WVOL (i.e. the water volume that SWATINIT requested). + +To the right in the output, the corresponding hydrocarbon porevolumes under +*reservoir* conditions are given. The number 66.571 is SWATINIT_WVOL +substracted from PORV, and then the percentages below are the volumetric change +in water volume with respect to this hydrocarbon pore volume. .. code-block:: console - $ check_swatinit DROGON.DATA + $ check_swatinit DROGON-EXAMPLE.DATA VOLUME 3203.1103 Mrm3 PORV 571.1770 Mrm3 SWATINIT_WVOL 504.6057 Mrm3 HC: 66.571 Mrm3 @@ -123,6 +137,23 @@ Example text output 1 1 22.626438 0.136527 +The maximal values tables then gives the maximum capillary pressure as present +in the input SWOF/SWFN table (the number PCOW_MAX) for each SATNUM. The number +PPCW in the next table is the corresponding number after Eclipse has scaled the +capillary pressure, and you can find here that PPCW = PCOW_MAX * PC_SCALING. In +the ideal case (no error from upscaling etc), PC_SCALING would be 1 in all +cells. Since PC_SCALING is less than 1 it means that capillary pressure had to +be downscaled by at least a factor ~10 in every cell, meaning that the +capillary pressure input curve should be revisited. + +Use also the scatter plot through the ``--plot`` option to get an impression +of which capillary pressures ranges are present in your reservoir model. + +More often, PC_SCALING and PPCW will be large, with scaling larger than 1. +Still, this table only prints the maximal values, and if severe PC_SCALING only +occurs in a few cells, it could still be acceptable. + + Outputted CSV file ------------------ @@ -159,15 +190,15 @@ Example plots :width: 70% A waterfall chart illustrating what contributes to the change from SWATINIT - to SWAT. This plot is obtained by adding the ``--volplot`` command line option. - The numbers inside the plot is the percentage change in terms of reservoir - volumes, blue numbers are with respect to SWATINIT_WVOL and green numbers - are with respect to initial hydrocarbon volumes. + to SWAT. This plot is obtained by adding the ``--volplot`` command line + option. The numbers inside the plot are the percentage changes in terms of + reservoir volumes, blue numbers are with respect to SWATINIT_WVOL and green + numbers are with respect to initial hydrocarbon volumes. .. figure:: images/check_swatinit_scatter.png :align: center - :width: 90% + :width: 98% A panel of reservoir properties versus depth, coloured by the QC_FLAG, for a specific EQLNUM. Use the command line option ``--plot`` together with diff --git a/docs/scripts/images/check_swatinit_scatter.png b/docs/scripts/images/check_swatinit_scatter.png index 16a17c1f5..64fa10e94 100644 Binary files a/docs/scripts/images/check_swatinit_scatter.png and b/docs/scripts/images/check_swatinit_scatter.png differ diff --git a/docs/scripts/images/check_swatinit_volplot.png b/docs/scripts/images/check_swatinit_volplot.png index 0f27afbc9..e2303871d 100644 Binary files a/docs/scripts/images/check_swatinit_volplot.png and b/docs/scripts/images/check_swatinit_volplot.png differ diff --git a/docs/scripts/images/make_check_swatinit_images.sh b/docs/scripts/images/make_check_swatinit_images.sh new file mode 100644 index 000000000..a8b0c383e --- /dev/null +++ b/docs/scripts/images/make_check_swatinit_images.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +check_swatinit ../../../tests/data/reek/eclipse/model/2_R001_REEK-0.DATA \ + --volplotfile check_swatinit_volplot.png + +# Sorry, this csv-file is not under version control: +check_swatinit ~/drogon.csv --plotfile check_swatinit_scatter.png \ + --eqlnum 4 diff --git a/setup.cfg b/setup.cfg index 43973dcf2..0f94f5eb0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -26,6 +26,7 @@ addopts = markers = integration: marks a test as an integration test + plot: marks a test as interactive, plots will flash to the screen [tool:pylint] # Module docstrings are not required, there are other means of documenting at diff --git a/src/subscript/check_swatinit/check_swatinit.py b/src/subscript/check_swatinit/check_swatinit.py index 643c4dffe..7268f1c58 100644 --- a/src/subscript/check_swatinit/check_swatinit.py +++ b/src/subscript/check_swatinit/check_swatinit.py @@ -69,7 +69,7 @@ def main(): if args.output != "": logger.info("Exporting CSV to %s", args.output) - qc_frame.to_csv(args.output, index=False) + reorder_dframe_for_nonnans(qc_frame).to_csv(args.output, index=False) if "SWATINIT" not in qc_frame: print("Model did not use SWATINIT") @@ -84,7 +84,15 @@ def main(): print() print(human_report_pc_scaling(qc_frame)) - if args.eqlnum not in qc_frame["EQLNUM"].values: + if args.volplot or args.volplotfile: + plotter.wvol_waterfall(qc_vols) + if args.volplot: + pyplot.show() + if args.volplotfile: + print(f"Dumping volume plot to {args.volplotfile}") + pyplot.savefig(args.volplotfile) + + if (args.plotfile or args.plot) and args.eqlnum not in qc_frame["EQLNUM"].values: sys.exit(f"Error: EQLNUM {args.eqlnum} does not exist in grid. No plotting.") if args.plot or args.plotfile: plotter.plot_qc_panels(qc_frame[qc_frame["EQLNUM"] == args.eqlnum]) @@ -94,14 +102,6 @@ def main(): print(f"Dumping plot to {args.plotfile}") pyplot.savefig(args.plotfile) - if args.volplot or args.volplotfile: - plotter.wvol_waterfall(qc_vols) - if args.volplot: - pyplot.show() - if args.volplotfile: - print(f"Dumping volume plot to {args.volplotfile}") - pyplot.savefig(args.volplotfile) - def check_applicability(eclfiles): """Check that the input is relevant for usage with check_swatinit. This @@ -140,6 +140,17 @@ def check_applicability(eclfiles): ) +def reorder_dframe_for_nonnans(dframe): + """Reorder a dataframe so that rows with less NaN comes first, this + will aid data analysis application to deduce correct datatypes for + columns""" + null_count = "__NULL_COUNT__" + dframe[null_count] = dframe.isnull().sum(axis=1) + return ( + dframe.sort_values(null_count).drop(null_count, axis=1).reset_index(drop=True) + ) + + def human_report_qc_vols(qc_vols): """Produce a string with a human report for volumes @@ -195,12 +206,14 @@ def human_report_pc_scaling(qc_frame): string = "" string += "Maximal values:\n" string += "---------------\n" - string += str(qc_frame.groupby("SATNUM").max()[["PCOW_MAX"]]) + string += qc_frame.groupby("SATNUM").max()[["PCOW_MAX"]].to_string() string += "\n" - string += str(qc_frame.groupby(["EQLNUM", "SATNUM"]).max()[["PPCW", "PC_SCALING"]]) + string += ( + qc_frame.groupby(["EQLNUM", "SATNUM"]).max()[["PPCW", "PC_SCALING"]].to_string() + ) string += "\n\n" - string += "EQUIL initialization option #9):\n" - string += str(qc_frame.groupby("EQLNUM").max()[["OIP_INIT"]].astype(int)) + string += "EQUIL initialization option #9:\n" + string += qc_frame.groupby("EQLNUM").max()[["OIP_INIT"]].astype(int).to_string() return string @@ -227,6 +240,7 @@ def make_qc_gridframe(eclfiles): "PCW", "PPCW", "SWL", + "SWU", # It is a feature request to process this "SWLPC", # Extract in case it is there, but it is not supported yet. ], rstdates="first", @@ -243,6 +257,9 @@ def make_qc_gridframe(eclfiles): logger.warning("Consider adding FILLEPS to the PROPS section") grid_df["SWL"] = 0.0 + if "SWU" in grid_df and (grid_df["SWU"] - 1).abs().sum() > 0: + logger.warning("SWU is less than 1, not yet supported by check_swatinit") + if "SWLPC" in grid_df and (grid_df["SWL"] - grid_df["SWLPC"]).abs().sum() > 0: raise ValueError("SWLPC is in the data, but not supported by check_swatinit") @@ -510,6 +527,14 @@ def compute_pc(qc_frame, satfunc_df): else: contact = "GWC" + # When SWATINIT=SWL=SWAT, PPCW as reported by Eclipse is the + # same as PCOW_MAX, and we cannot use it to compute PC, remove it: + if "SWL" in qc_frame: + p_cap[ + np.isclose(qc_frame["SWAT"], qc_frame["SWL"]) + & np.isclose(qc_frame["PC_SCALING"], 1) + ] = np.nan + if "QC_FLAG" in qc_frame: p_cap[ (qc_frame["QC_FLAG"] == __SWATINIT_1__) @@ -562,11 +587,7 @@ def merge_equil(grid_df, equil_df): assert ( not pd.isnull(equil_df).any().any() ), f"BUG: NaNs in equil dataframe:\n{equil_df}" - grid_df = grid_df.merge( - equil_df, - on="EQLNUM", - how="left", - ) + grid_df = grid_df.merge(equil_df, on="EQLNUM", how="left") return grid_df @@ -626,6 +647,19 @@ def get_parser(): default="", help="Output filename for CSV that can be used for QC in other tools", ) + parser.add_argument( + "--volplot", + action="store_true", + help=( + "Display a waterfall chart with the water " + "saturation volumes from SWATINIT to SWAT" + ), + ) + parser.add_argument( + "--volplotfile", + type=str, + help="PNG filename for where to dump a waterfall chart.", + ) parser.add_argument( "--plot", action="store_true", @@ -634,6 +668,9 @@ def get_parser(): "region, use together with the --eqlnum option" ), ) + parser.add_argument( + "--plotfile", type=str, help="PNG filename for where to dump a QC plot." + ) parser.add_argument( "--eqlnum", type=int, @@ -643,22 +680,6 @@ def get_parser(): "Does not affect CSV output" ), ) - parser.add_argument( - "--plotfile", type=str, help="PNG filename for where to dump a QC plot." - ) - parser.add_argument( - "--volplot", - action="store_true", - help=( - "Display a waterfall chart with the water " - "saturation volumes from SWATINIT to SWAT" - ), - ) - parser.add_argument( - "--volplotfile", - type=str, - help="PNG filename for where to dump a waterfall chart.", - ) return parser diff --git a/src/subscript/check_swatinit/plotter.py b/src/subscript/check_swatinit/plotter.py index abcbb97b6..4a9e5bd90 100644 --- a/src/subscript/check_swatinit/plotter.py +++ b/src/subscript/check_swatinit/plotter.py @@ -7,12 +7,26 @@ from subscript.check_swatinit.constants import ( __FINE_EQUIL__, __HC_BELOW_FWL__, + __PC_SCALED__, __PPCWMAX__, __SWATINIT_1__, __SWL_TRUNC__, + __WATER__, ) +SNS_PAL = seaborn.color_palette("tab10") +QC_PALETTE = { + __FINE_EQUIL__: SNS_PAL[8], + __HC_BELOW_FWL__: SNS_PAL[5], + __PC_SCALED__: SNS_PAL[2], + __PPCWMAX__: SNS_PAL[9], + __SWATINIT_1__: SNS_PAL[6], + __SWL_TRUNC__: SNS_PAL[3], + __WATER__: SNS_PAL[0], +} + + def plot_qc_panels(qc_frame, eqlnum=None, show=False): """Make a plotting panel (multiple plots) on cell-based dataframe. @@ -73,7 +87,9 @@ def swat_depth(qc_frame, axis=None, hue="QC_FLAG"): """Make a SWAT vs depth plot on current axis""" if axis is None: axis = pyplot.gca() - seaborn.scatterplot(x="SWAT", y="Z", data=qc_frame, hue=hue, alpha=0.5) + seaborn.scatterplot( + x="SWAT", y="Z", data=qc_frame, hue=hue, palette=QC_PALETTE, alpha=0.5 + ) bottom, _ = pyplot.ylim() pyplot.ylim(bottom, visual_depth(qc_frame)) axis.invert_yaxis() @@ -84,7 +100,9 @@ def swatinit_depth(qc_frame, axis=None, hue="QC_FLAG"): """Make a swatinit vs depth plot on current axis""" if axis is None: axis = pyplot.gca() - seaborn.scatterplot(x="SWATINIT", y="Z", data=qc_frame, hue=hue, alpha=0.5) + seaborn.scatterplot( + x="SWATINIT", y="Z", data=qc_frame, hue=hue, palette=QC_PALETTE, alpha=0.5 + ) bottom, _ = pyplot.ylim() pyplot.ylim(bottom, visual_depth(qc_frame)) axis.invert_yaxis() @@ -95,7 +113,9 @@ def pressure_depth(qc_frame, axis=None, hue="QC_FLAG"): """Make a pressure vs. depth plot on current axis""" if axis is None: axis = pyplot.gca() - seaborn.scatterplot(x="PRESSURE", y="Z", data=qc_frame, hue=hue, alpha=0.5) + seaborn.scatterplot( + x="PRESSURE", y="Z", data=qc_frame, hue=hue, palette=QC_PALETTE, alpha=0.5 + ) bottom, _ = pyplot.ylim() pyplot.ylim(bottom, visual_depth(qc_frame)) axis.invert_yaxis() @@ -106,7 +126,9 @@ def pc_depth(qc_frame, axis=None, hue="QC_FLAG"): """Make a pc vs depth plot on current axis""" if axis is None: axis = pyplot.gca() - seaborn.scatterplot(x="PC", y="Z", data=qc_frame, hue=hue, alpha=0.5) + seaborn.scatterplot( + x="PC", y="Z", data=qc_frame, hue=hue, palette=QC_PALETTE, alpha=0.5 + ) bottom, _ = pyplot.ylim() pyplot.ylim(bottom, visual_depth(qc_frame)) axis.invert_yaxis() @@ -163,25 +185,32 @@ def wvol_waterfall(qc_vols): step[1::3] = np.nan blank.loc["SWAT_WVOL"] = 0 - fig = trans.plot(kind="bar", stacked=True, legend=None, bottom=blank) + fig = trans.plot(kind="bar", alpha=0.7, stacked=True, legend=None, bottom=blank) fig.plot(step.index, step.values, "k") pyplot.gcf().subplots_adjust(bottom=0.25) - span = blank.max() - blank[1:-1].min() + blanktrans = blank.values + trans["volume"].values + span = blank.max() - blanktrans[1:-1].min() + + if np.isclose(span, 0.0): + span = blank.max() # Calculate percent changed relative to SWATINIT_WVOL for number, qc_flag in enumerate(index[1:]): change = qc_vols[qc_flag] / qc_vols["SWATINIT_WVOL"] pyplot.gca().annotate( f"{change*100:3.2f}%", - (number + 1, blank[number + 1] + qc_vols[qc_flag] + span / 20), + ( + number + 1, + blanktrans[number] + max(0, qc_vols[qc_flag]) + span / 20, + ), horizontalalignment="center", color="C0", ) hc_change = -qc_vols[qc_flag] / swatinit_hcvol pyplot.gca().annotate( f"{hc_change*100:3.2f}%", - (number + 1, blank[number + 1] + qc_vols[qc_flag] + 4 * span / 20), + (number + 1, blanktrans[number] + max(0, qc_vols[qc_flag]) + 4 * span / 20), horizontalalignment="center", color="C2", ) @@ -202,5 +231,5 @@ def wvol_waterfall(qc_vols): color="C2", ) - pyplot.ylim((blank[1:-1].min() - span, blank.max() + span)) + pyplot.ylim((max(0.0, blank[1:-1].min() - span), blank.max() + span)) pyplot.xticks(rotation=45) diff --git a/tests/conftest.py b/tests/conftest.py index 6cab7f6d0..0c9990fb1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,3 +9,22 @@ def path_to_subscript(): """path to installed subscript module.""" return path.dirname(subscript.__file__) + + +def pytest_addoption(parser): + parser.addoption( + "--plot", + action="store_true", + default=False, + help="run tests that display plots to the screen", + ) + + +def pytest_collection_modifyitems(config, items): + if config.getoption("--plot"): + # Do not skip tests when --plot is supplied on pytest command line + return + skip_plot = pytest.mark.skip(reason="need --plot option to run") + for item in items: + if "plot" in item.keywords: + item.add_marker(skip_plot) diff --git a/tests/test_check_swatinit.py b/tests/test_check_swatinit.py index b144335e1..e4453ac25 100644 --- a/tests/test_check_swatinit.py +++ b/tests/test_check_swatinit.py @@ -1,6 +1,8 @@ import subprocess from pathlib import Path +from matplotlib import pyplot + import numpy as np import pandas as pd @@ -17,12 +19,15 @@ __WATER__, _evaluate_pc, compute_pc, + main, merge_equil, qc_flag, qc_volumes, - main, + reorder_dframe_for_nonnans, ) +from subscript.check_swatinit.plotter import wvol_waterfall + REEK_DATAFILE = ( Path(__file__).absolute().parent / "data" @@ -407,6 +412,13 @@ def test_merge_equil(gridlist, equillist, expected): SATFUNC_DF, np.nan, ), + # When SWATINIT=SWL=SWAT, the PPCW reported by Eclipse is incorrect (it is equal + # to PCOW_MAX), and computed PC should not be there: + ( + [{"SATNUM": 1, "SWATINIT": 0.1, "SWAT": 0.1, "SWL": 0.1, "PC_SCALING": 1}], + SATFUNC_DF, + np.nan, + ), ], ) def test_compute_pc(propslist, satfunc_df, expected_pc): @@ -430,6 +442,182 @@ def test_compute_pc(propslist, satfunc_df, expected_pc): assert pc_series.values[0] == expected_pc +def test_eqlnum2(tmpdir, mocker): + """What if a model does not have EQLNUM=1 cells present""" + tmpdir.chdir() + pd.DataFrame( + [ + # This dataframe is a minimum dataset for check_swatinit + # to run. + { + "EQLNUM": 2, + "Z": 1000, + "SWATINIT": 0.9, + "PORV": 100, + "SWAT": 0.8, + "VOLUME": 80, + "QC_FLAG": __PC_SCALED__, + "SATNUM": 2, + "PCOW_MAX": 2, + "PPCW": 4, + "PC_SCALING": 2, + "OIP_INIT": 0, + } + ] + ).to_csv("foo.csv") + + # Should not error: + mocker.patch("sys.argv", ["check_swatinit", "foo.csv"]) + main() + + # But default plotting should error: + mocker.patch("sys.argv", ["check_swatinit", "foo.csv", "--plot"]) + with pytest.raises(SystemExit, match="EQLNUM 1 does not exist in grid"): + main() + + +@pytest.mark.parametrize( + "inputrows, expected", + [ + ([{}], [{}]), + ([{"FOO": 1}], [{"FOO": 1}]), + ([{"FOO": np.nan}], [{"FOO": np.nan}]), + ([{"FOO": np.nan}, {"FOO": 1}], [{"FOO": 1}, {"FOO": np.nan}]), + ( + [{"FOO": 2, "PC": np.nan}, {"FOO": 1, "PC": 2}], + [{"FOO": 1, "PC": 2}, {"FOO": 2, "PC": np.nan}], + ), + ], +) +def test_reorder_dframe_for_nonnans(inputrows, expected): + """Test that rows with less NaNs will be prioritized through the reorder function""" + pd.testing.assert_frame_equal( + reorder_dframe_for_nonnans(pd.DataFrame(inputrows)), pd.DataFrame(expected) + ) + + +@pytest.mark.plot +def test_volplot_negative_bars(): + qc_frame = pd.DataFrame( + [ + # This dataframe is a minimum dataset for check_swatinit + # to run. + { + "EQLNUM": 1, + "Z": 1000, + "SWATINIT": 0.9, + "PORV": 100, + "SWAT": 0.8, + "VOLUME": 80, + "QC_FLAG": __SWL_TRUNC__, + "SATNUM": 1, + "PCOW_MAX": 2, + "PPCW": 4, + "PC_SCALING": 2, + "OIP_INIT": 0, + } + ] + ) + + wvol_waterfall(qc_volumes(qc_frame)) + + print("Verify that all annotations are visible") + pyplot.show() + + +@pytest.mark.plot +def test_volplot_zerospan(): + # Test when there is no difference from SWATINIT to SWAT: + qc_frame = pd.DataFrame( + [ + { + "EQLNUM": 1, + "Z": 1000, + "SWATINIT": 0.9, + "PORV": 100000, + "SWAT": 0.9, + "VOLUME": 80, + "QC_FLAG": __SWL_TRUNC__, + "SATNUM": 1, + "PCOW_MAX": 2, + "PPCW": 4, + "PC_SCALING": 2, + "OIP_INIT": 0, + } + ] + ) + wvol_waterfall(qc_volumes(qc_frame)) + + print("Verify that all annotations are visible and placed wisely") + pyplot.show() + + +@pytest.mark.plot +def test_volplot_largenegative(): + qc_frame = pd.DataFrame( + [ + { + "EQLNUM": 1, + "Z": 1000, + "SWATINIT": 0.9, + "PORV": 100000, + "SWAT": 0.2, + "VOLUME": 80, + "QC_FLAG": __SWL_TRUNC__, + "SATNUM": 1, + "PCOW_MAX": 2, + "PPCW": 4, + "PC_SCALING": 2, + "OIP_INIT": 0, + } + ] + ) + wvol_waterfall(qc_volumes(qc_frame)) + + print("Verify that all annotations are visible and placed wisely") + pyplot.show() + + +@pytest.mark.plot +def test_volplot_manynegative(): + qc_frame = pd.DataFrame( + [ + { + "EQLNUM": 1, + "Z": 1000, + "SWATINIT": 0.9, + "PORV": 100000, + "SWAT": 0.2, + "VOLUME": 80, + "QC_FLAG": __SWL_TRUNC__, + "SATNUM": 1, + "PCOW_MAX": 2, + "PPCW": 4, + "PC_SCALING": 2, + "OIP_INIT": 0, + }, + { + "EQLNUM": 1, + "Z": 1000, + "SWATINIT": 0.9, + "PORV": 100000, + "SWAT": 0.2, + "VOLUME": 80, + "QC_FLAG": __SWATINIT_1__, + "SATNUM": 1, + "PCOW_MAX": 2, + "PPCW": 4, + "PC_SCALING": 2, + "OIP_INIT": 0, + }, + ] + ) + wvol_waterfall(qc_volumes(qc_frame)) + + print("Verify that y limits in particular are correct") + pyplot.show() + + def test_reek(tmpdir, mocker): """Test that we can run on the Reek dataset with no crashes, and with plotting to file""" diff --git a/tests/test_check_swatinit_simulators.py b/tests/test_check_swatinit_simulators.py index 77e1632e0..add6e67b3 100644 --- a/tests/test_check_swatinit_simulators.py +++ b/tests/test_check_swatinit_simulators.py @@ -352,18 +352,15 @@ def test_swatinit_1_far_above_contact(simulator, tmpdir): # PPCW is the input Pc: assert np.isclose(qc_frame["PPCW"][0], 3.0) - # The capillary pressure can't be computed though (should not - # set it to zero when we are above the contact) - assert np.isnan(qc_frame["PC"][0]) - assert np.isclose(qc_vols[__SWATINIT_1__], (1 - 1) * qc_frame["PORV"]) else: - assert np.isclose(qc_frame["PC"][0], 3.0) # E100 ignores SWATINIT and sets the saturation to SWL: assert np.isclose(qc_frame["SWAT"][0], 0.1) assert np.isclose(qc_frame["PPCW"][0], 3.0) # Negative number means water is lost: assert np.isclose(qc_vols[__SWATINIT_1__], -(1 - 0.1) * qc_frame["PORV"]) + # Not possible to compute PC, it should be Nan: + assert np.isnan(qc_frame["PC"][0]) # Bigger reservoir model, so that OWC is within the grid, should # not make a difference: