Skip to content

Conversation

@totto82
Copy link
Member

@totto82 totto82 commented Nov 19, 2025

No description provided.

@totto82 totto82 requested a review from hakonhagland November 19, 2025 09:28
@totto82
Copy link
Member Author

totto82 commented Nov 19, 2025

jenkins build this failure_report please

@totto82 totto82 added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Nov 19, 2025
@hakonhagland
Copy link
Contributor

hakonhagland commented Nov 19, 2025

@totto82 I see you ran jenkins with "failure_report". Where can I view this report? Or maybe there is no report when all tests pass?

@hakonhagland
Copy link
Contributor

@totto82 Is there any test case that will trigger the GLIFTOPT item 3 fix?

@akva2
Copy link
Member

akva2 commented Nov 19, 2025

no failures, no report.

@totto82
Copy link
Member Author

totto82 commented Nov 21, 2025

I added a new commit where a similar limiting of the gas phase is done during the optimization.

@totto82
Copy link
Member Author

totto82 commented Nov 21, 2025

jenkins build this failure_report please

1 similar comment
@totto82
Copy link
Member Author

totto82 commented Nov 26, 2025

jenkins build this failure_report please

@totto82
Copy link
Member Author

totto82 commented Nov 26, 2025

Is there any test case that will trigger the GLIFTOPT item 3 fix?

I have extended the glift1 test to test this explicitly.

num_wells_changed = simulator.vanguard().gridView().comm().sum(num_wells_changed);

if (num_wells_changed > 0) {
updateWellPotentials(simulator, well_container, node_pressures, wellState, deferred_logger);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will only updates potentials for network nodes, right? Maybe add a comment about why potentials for other nodes are not updated? And why all network nodes need to be updated (and not only those that was changed)

Copy link
Member Author

Choose a reason for hiding this comment

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

I have removed this and instead store the well potentials during gaslift to avoid re-computing the well potentials again.


if (controls.hasControl(Well::ProducerCMode::ORAT) && oil_rate > static_cast<Scalar>(controls.oil_rate)) {
water_rate *= (static_cast<Scalar>(controls.oil_rate) / oil_rate);
gas_rate *= (static_cast<Scalar>(controls.oil_rate) / oil_rate);
Copy link
Contributor

@hakonhagland hakonhagland Nov 26, 2025

Choose a reason for hiding this comment

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

  1. It seems unlikely that oil_rate will be zero since it is known to be greater than controls.oil_rate, but if controls.oil_rate ~= 0 it could in theory become very small. Should we check for this before scaling? 2) We could also add a comment about why this scaling is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since oil_rate > controls.oil_rate >= 0 I think controls.oil_rate / oil_rate should be safe.

const int gas_pos = pu.canonicalToActivePhaseIdx(IndexTraits::gasPhaseIdx);
well_pot[gas_pos] = state->gasRate();
const bool isThp = (ws.production_cmode == Well::ProducerCMode::THP);
if (isThp) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment why we only want to update potentials for THP controlled wells

Copy link
Member Author

Choose a reason for hiding this comment

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

the gasRate() from state is only equal the potential for THP wells. With the update in the last commit we now store the well potential as well as the rate to make sure we can update the well potential for all wells during gaslift optimization.

alq_opt = std::nullopt;

return {alq_opt, limited};
return {alq_opt, limited && increase };
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand why we need && increase here

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment

Copy link
Contributor

@hakonhagland hakonhagland left a comment

Choose a reason for hiding this comment

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

This PR looks very good. The added test cases and will definitely be very valuable in the future. I will approve this after the comments have been addressed.

@totto82
Copy link
Member Author

totto82 commented Dec 1, 2025

jenkins build this failure_report please

if (limited && checkALQequal_(orig_alq, alq))
alq_opt = std::nullopt;

// alq_is_limited is used to check if we can increase the alq or not
Copy link
Contributor

@hakonhagland hakonhagland Dec 1, 2025

Choose a reason for hiding this comment

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

alq_is_limited is used to check if we can increase the alq or not

Isn't it also used to check if we can decrease ALQ?

Copy link
Member Author

Choose a reason for hiding this comment

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

The way I read checkRateAlreadyLimited_ where isAlqIsLimited() is used, it only do_check if increase is true. But maybe I missed something. I can do some more checking.

Copy link
Contributor

@hakonhagland hakonhagland Dec 2, 2025

Choose a reason for hiding this comment

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

If both *current_increase and increase are false, see line 197 it should do the check, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are, of course, right. With the current code, we may be in a situation where alq_is_limited = true and alq = alq_max, but we still want to be able to decrease it. I will provide a proper fix.

@totto82
Copy link
Member Author

totto82 commented Dec 2, 2025

jenkins build this failure_report please

@totto82
Copy link
Member Author

totto82 commented Dec 3, 2025

jenkins build this failure_report please

@totto82
Copy link
Member Author

totto82 commented Dec 3, 2025

Thanks for the reviews.

@totto82 totto82 merged commit 57c31cb into OPM:master Dec 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants