Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "dummy" water phase to compositional fluid system #4410

Merged
merged 11 commits into from
Feb 13, 2025

Conversation

svenn-t
Copy link
Contributor

@svenn-t svenn-t commented Jan 8, 2025

The compositional fluid system is expanded to three phases where the water phase is a "dummy"/immiscible phase. Water phase properties are given through PVT functions the same way as in the black oil fluid system.

@svenn-t svenn-t marked this pull request as ready for review January 9, 2025 11:34
@totto82 totto82 requested a review from GitPaean January 14, 2025 14:16
@GitPaean
Copy link
Member

Thanks for the work. I will look into the PRs soon.

@GitPaean
Copy link
Member

jenkins build this opm-simulators=5851 please

@svenn-t
Copy link
Contributor Author

svenn-t commented Jan 16, 2025

After discussion with @totto82 we agreed to have both two-phase and three-phase versions of the compositional fluid system. So I will make this and the opm-simulators PR drafts again and to make the necessary changes.

@svenn-t svenn-t marked this pull request as draft January 16, 2025 10:39
@GitPaean
Copy link
Member

After discussion with @totto82 we agreed to have both two-phase and three-phase versions of the compositional fluid system. So I will make this and the opm-simulators PR drafts again and to make the necessary changes.

I agree and it is appreciated. And depending the testing example you have, you can create the flowexp_comp executable for that specific number of component only first.

Still thinking how to avoid too many exectubales to compile but it can be for later optimization.

@svenn-t svenn-t force-pushed the dummy_water_compositional branch from 1316ad5 to fb16da4 Compare January 20, 2025 11:57
@svenn-t
Copy link
Contributor Author

svenn-t commented Jan 20, 2025

I have updated this PR and OPM/opm-simulators#5851 to have both two- and three-phase versions of the compositional simulator. I did make new executables for two-phase versions of the simulators, and which version that will be run is dependent on if WATER is present in RUNSPEC or not.

@svenn-t svenn-t marked this pull request as ready for review January 20, 2025 12:15
@svenn-t svenn-t force-pushed the dummy_water_compositional branch from fb16da4 to 3bcaf72 Compare January 21, 2025 12:49
@totto82
Copy link
Member

totto82 commented Jan 23, 2025

jenkins build this opm-simulators=5851 please

@svenn-t svenn-t force-pushed the dummy_water_compositional branch from e5dc750 to 086d0ac Compare February 3, 2025 09:32
@GitPaean
Copy link
Member

GitPaean commented Feb 4, 2025

jenkins build this opm-simulators=5851 please

@svenn-t svenn-t force-pushed the dummy_water_compositional branch from 086d0ac to 25e3951 Compare February 5, 2025 07:35
@GitPaean
Copy link
Member

GitPaean commented Feb 5, 2025

jenkins build this opm-simulators=5851 please

@GitPaean
Copy link
Member

GitPaean commented Feb 5, 2025

Same here, well done PR. I will also invite @akva2 to have a look.

@GitPaean GitPaean requested a review from akva2 February 5, 2025 15:06
Copy link
Member

@akva2 akva2 left a comment

Choose a reason for hiding this comment

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

Looks good. This certainly corresponds better to downstream expectation. One minor comment.

* \brief Set the pressure-volume-saturation (PVT) relations for the water phase.
*/
static void setWaterPvt(std::shared_ptr<WaterPvt> pvtObj)
{ waterPvt_ = pvtObj; }
Copy link
Member

Choose a reason for hiding this comment

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

std::move to avoid reference work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks for the comment!

FluidSystem::init();
using WaterPvt = typename FluidSystem::WaterPvt;
std::shared_ptr<WaterPvt> waterPvt;
FluidSystem::setWaterPvt(std::move(waterPvt));
Copy link
Member

Choose a reason for hiding this comment

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

move should be on the inside.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks for the comment!

@@ -861,7 +863,7 @@ class PTFlash

// getting the secondary Jocobian matrix
constexpr size_t num_equations = numMisciblePhases * numMiscibleComponents + 1;
constexpr size_t secondary_num_pv = numComponents + 1; // pressure, z for all the components
constexpr size_t secondary_num_pv = numComponents + (waterEnabled ? 2 : 1); // pressure, z for all the components
Copy link
Member

Choose a reason for hiding this comment

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

I can see it wrong, but water phase does not affect the flash calculation and I do not see that we are doing anything related to the derivative No. numComponents + 1 in the following code.

Copy link
Member

Choose a reason for hiding this comment

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

@svenn-t , please fix this and we will get ready to get the PR in. The deviation can be addressed in a separate PR.

Copy link
Contributor Author

@svenn-t svenn-t Feb 11, 2025

Choose a reason for hiding this comment

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

I'm not so familiar with the what is happening in updateDerivativesTwoPhase_(), but I just added 1 to the second_num_pv variable if waterEnabled is true to include the additional primary variable we have in the three-phase case (which is Sw). Is that wrong or are you saying that there are no derivatives wrt to Sw in any case so adding 1 is unnecessary?

Copy link
Member

Choose a reason for hiding this comment

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

It is the difficult part when we developed this, but we will understand better with time.

I believe that we do not need it since Sw is not in the flash calculation at all. And also, from the code, I do not see we are touching the derivative index No. numComponents + 1 at all. And it did not make any difference if we remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I understand, thanks for the explanation. I have reverted the changes back to the original code.

@GitPaean
Copy link
Member

jenkins build this opm-simulators=5851 please

@GitPaean
Copy link
Member

With the approval and jenkins approves, I am getting the PR in now. Thanks for the contribution.

@GitPaean GitPaean merged commit c40d81c into OPM:master Feb 13, 2025
1 check 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.

None yet

4 participants