Skip to content

Krowgend add to factory water_oil_gas - #471

Merged
bartekvik merged 1 commit into
equinor:mainfrom
bartekvik:endpointsKo
Mar 16, 2026
Merged

Krowgend add to factory water_oil_gas#471
bartekvik merged 1 commit into
equinor:mainfrom
bartekvik:endpointsKo

Conversation

@bartekvik

@bartekvik bartekvik commented Nov 26, 2024

Copy link
Copy Markdown
Collaborator

This pull request proposes a solution for issue #455.

Issue The original issue reported that the current implementation of the WaterOilGas object did not allow for separate values of KROEND for water/oil and oil/gas systems. This is desirable in cases such as gas condensate systems and when oil moves into a gas cap. The issue includes examples and a figure to illustrate the problem.

Proposed solution The proposed solution is to accept both KROGEND (oil/gas) and KROWEND (water/oil) when creating the three-phase WaterOilGas object (create_water_oil_gas() function), then convert these into two separate KROEND and apply them to the respective WaterOil and OilGas objects. Thus, it does not affect anchoring of KROEND to critical and residual saturations. KROEND for WaterOil anchor to SWL, while KROEND GasOil anchor to SGCR=SGRO.
A test has been added to ensure this feature works.
The Pyscal documentation has been updated to include the modeling of wet gas/condensate systems, demonstrating the use of both KROGEND (gas/oil) and KROWEND (water/oil) in a three-phase field scenario.

Example of implemented solution
Figure created using the pull request version of pyscal (#471) show Kro in oil-water system where KROWEND = 1, Kro in gas-oil system KROGEND = 0.25, and KROMAX = 1
krow_krog_new_implementation

PySCAL format file that produce the plot (uses the base case) is attached:
pySCAL_krow_krog_endpoint_for_new_implementation.csv

@bartekvik
bartekvik requested review from alifbe and berland November 26, 2024 12:01
@codecov-commenter

codecov-commenter commented Nov 26, 2024

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.79%. Comparing base (23f2c99) to head (da38600).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #471   +/-   ##
=======================================
  Coverage   98.79%   98.79%           
=======================================
  Files          18       18           
  Lines        2647     2664   +17     
=======================================
+ Hits         2615     2632   +17     
  Misses         32       32           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@berland

berland commented Dec 4, 2024

Copy link
Copy Markdown
Collaborator

Included in this PR there should be a corresonding update to the docs on https://equinor.github.io/pyscal/modelling.html

@bartekvik
bartekvik force-pushed the endpointsKo branch 2 times, most recently from 2ee72a3 to f385e8b Compare August 11, 2025 13:46
@bartekvik

Copy link
Copy Markdown
Collaborator Author

Included in this PR there should be a corresonding update to the docs on https://equinor.github.io/pyscal/modelling.html

Documentation is updated

alifbe
alifbe previously requested changes Sep 5, 2025
Comment thread docs/images/gasoil-cdi2.png
Comment thread docs/pyscal/pyscal.constants.rst Outdated
Comment thread src/pyscal/factory.py Outdated
params_copy["kroend"] = params_copy.pop("krowend")
params_copy.pop("krogend", None)
return params_copy
params_copy = params.copy()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last 3 lines are also present inside the if statement, should be simplified so that the code is not duplicated.
Also the case for kro_endpoint_go.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed and also added a warning when the removing krowend and krogend. also, added a test for correct warning

Comment thread tests/test_factory.py Outdated
to the oil curve parametrization for WaterOil and GasOil. From
pyscal 0.6.0, krogend and krowend are merged to kroend.
After pyscal 0.8 presence of krogend and krowend is a ValueError
After pyscal 0.14 presence krogend and krowend is accepted as

@bartekvik bartekvik Feb 13, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larsevj, still valid version or should it be 0.15?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe be version 0.16 i think.

@bartekvik
bartekvik requested a review from alifbe February 20, 2026 13:21
@alifbe
alifbe dismissed their stale review February 20, 2026 14:01

Already implemented

@berland

berland commented Feb 23, 2026

Copy link
Copy Markdown
Collaborator

It seems most of the PNG files are changed due to a slight change of font, maybe font updates upstream? Can you merge a commit first with only regenerated PNG files, and then rebase this PR? This is to be able to look at changes to the PNGs from this code change only.

Comment thread docs/images/wet-condensate_field_illustration.png
Comment thread docs/make_plots.py Outdated
Comment thread docs/make_plots.py Outdated
Comment thread docs/modelling.rst Outdated
Comment thread docs/modelling.rst Outdated
Comment thread docs/modelling.rst
Comment thread docs/modelling.rst Outdated
Comment thread src/pyscal/factory.py Outdated
Comment thread src/pyscal/factory.py Outdated
Comment thread tests/test_factory.py Outdated
Comment thread tests/test_factory.py Outdated
After pyscal 0.8 presence of krogend and krowend is a ValueError
After pyscal 0.16 presence krogend and krowend is accepted as
parameters for create_wateroilgas, but is still ValueError for
create_water_oil and create_gas_oil is a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentence not finished?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks

@bartekvik

bartekvik commented Mar 3, 2026

Copy link
Copy Markdown
Collaborator Author

It seems most of the PNG files are changed due to a slight change of font, maybe font updates upstream? Can you merge a commit first with only regenerated PNG files, and then rebase this PR? This is to be able to look at changes to the PNGs from this code change only.

@berland will do.
Regarding the fonts; GitHub will execute docs/make_plots.py before calling sphinx-build. Figures generated by make_plots.py are put into folder docs/images:

- name: Build documentation
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == env.DEFAULT_PYTHON_VERSION }}
run: |
python docs/make_plots.py
sphinx-build -b html docs ./build/sphinx/html

The fonts generated locally in this commit will not appear in their original form in the online documentation, because the font setup on the GitHub build server differs from the local configuration. In current documentation the online fonts are different from previous versions.
Suggest to finish #471, but the workflow and structure could/should be changed in a separate PR: images generated automatically should be in docs/images/generated and added to .gitignore so auto‑generated files are not commited. Binary files, could be commited and placed in a separate folder docs/images/static

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a file already in the repo called "gaswater-dci3_paleogas.png". Something is mixed up?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, PNG file missing from #499
#500 should fix this

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this image addition related to this PR?

@bartekvik bartekvik Mar 12, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this PR, this PNG file is missing from #499
#500 should fix this

Comment thread docs/make_plots.py
"gaswater-dci1",
"gasoil-condensate-cid2",
"wateroil-condensate-idc2",
"gaswater-condensate-icd2",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I would expect only three images coming out of this)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, they will

Comment thread docs/modelling.rst Outdated
.. image:: images/wet-condensate_field_illustration.png
:width: 600

Following processes are associated with the regions depicted in the figure above:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inject "The " in front of "following"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread docs/modelling.rst Outdated
-------------------------------------------

.. image:: images/gasoil-cid2.png
This field scenario is for a three-phase Eclipse simulation allowing for condendsate

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write "reservoir simulation" rather than the vendor specific Eclipse simulation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread docs/modelling.rst Outdated
-------------------------------------------

.. image:: images/gasoil-cid2.png
This field scenario is for a three-phase Eclipse simulation allowing for condendsate

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: condendsate -> condensate

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread docs/modelling.rst Outdated
**The processes are described in the following figures:**

Water displacing gas (ICD2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align number of tilde characters with the length of the header (hmm, I thought rstcheck would catch those)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread docs/modelling.rst Outdated


Water displacing oil (IDC2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, align line lengths

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@berland berland left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I have any further comments, approval from me pending the minor last things getting fixed. Good job!

make doc figures

ruff check fix

comic font + docs/pyscal removal

test simplified + test warning

Fix formatting issues noted in review

Add 'The' prefix

Fix minor last typos
@bartekvik
bartekvik merged commit 02ed1af into equinor:main Mar 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants