-
Notifications
You must be signed in to change notification settings - Fork 114
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
Conversation
Thanks for the work. I will look into the PRs soon. |
jenkins build this opm-simulators=5851 please |
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. |
1316ad5
to
fb16da4
Compare
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 |
fb16da4
to
3bcaf72
Compare
jenkins build this opm-simulators=5851 please |
e5dc750
to
086d0ac
Compare
jenkins build this opm-simulators=5851 please |
Water/oil/gas phase indices are permutated in compositional fluid systems.
086d0ac
to
25e3951
Compare
jenkins build this opm-simulators=5851 please |
Same here, well done PR. I will also invite @akva2 to have a look. |
There was a problem hiding this 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; } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
tests/material/test_fluidsystems.cpp
Outdated
FluidSystem::init(); | ||
using WaterPvt = typename FluidSystem::WaterPvt; | ||
std::shared_ptr<WaterPvt> waterPvt; | ||
FluidSystem::setWaterPvt(std::move(waterPvt)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
jenkins build this opm-simulators=5851 please |
With the approval and jenkins approves, I am getting the PR in now. Thanks for the contribution. |
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.