Skip to content

Log local switching #6145

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

totto82
Copy link
Member

@totto82 totto82 commented Apr 4, 2025

In the master, we don't log control switching during local solves, which could lead to changing controls without or with the wrong output in the terminal. The log also detects oscillations, and controls may oscillate significantly during the local solves. I added a safeguard to restrict only changing controls for iter>nupcol and the local solves, but we may need a more robust solution. I tagged this with release since it is a bug fix, but I also made it a draft as it requires more testing.

UPDATE: After some thinking and testing, I suggest starting to count oscillations only after NUPCOL iterations. After NUPCOL iterations, the control target is fixed, and we should, in principle, experience fewer oscillations. With this change, we less frequently end up with the "wrong" control, while the "cost" of stagnating simulations due to infinite oscillations is still avoided. The current issue in master that we don't log control changes during local switching (leading to missing log information to terminal and .PRT) is still fixed in the PR.

@totto82 totto82 added this to the Release 2025.04 milestone Apr 4, 2025
@totto82
Copy link
Member Author

totto82 commented Apr 4, 2025

jenkins build this please

const int iterationIdx = simulator.model().newtonMethod().numIterations();
const int episodeIdx = simulator.episodeIndex();
const int nupcol = schedule[episodeIdx].nupcol();
if ( (oscillating && iterationIdx > nupcol)|| this->wellUnderZeroRateTarget(simulator, well_state, deferred_logger) || !(this->well_ecl_.getStatus() == WellStatus::OPEN)) {
Copy link
Member

@vkip vkip Apr 4, 2025

Choose a reason for hiding this comment

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

>= nupcol?

Copy link
Member Author

Choose a reason for hiding this comment

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

In updateWellControl(..) it is iterationIdx >nupcol. This makes it consistent. But I don't know if waiting one iteration is on purpose or not.

Copy link
Member

Choose a reason for hiding this comment

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

You mean what was introduced in #5753? Since we start counting iterations from 0 I believe we should use >= unless there is a clear (and documented) reason to do so.

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 I made #5773, I assume > is a bug, I will update both instances to >= and retest.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. Can be discussed if it is a bug, but prior to #6100 it was a mix between >= and >, and better to be consistent. Apparently I missed the one in updateWellControls in that PR..

@totto82 totto82 force-pushed the log_local_switching branch from 4b1c6a2 to 37634a2 Compare April 4, 2025 13:14
@totto82
Copy link
Member Author

totto82 commented Apr 4, 2025

jenkins build this failure_report please

@totto82 totto82 changed the title WIP Log local switching Log local switching Apr 4, 2025
@totto82 totto82 force-pushed the log_local_switching branch from 37634a2 to 34075be Compare April 14, 2025 11:01
@totto82
Copy link
Member Author

totto82 commented Apr 14, 2025

jenkins build this failure_report please

@totto82
Copy link
Member Author

totto82 commented Apr 22, 2025

I don't think the logging issue fixed in this PR is severe enough to delay the release, so I removed the release flag.

@totto82 totto82 removed this from the Release 2025.04 milestone Apr 22, 2025
@totto82 totto82 marked this pull request as ready for review April 22, 2025 08:01
@totto82
Copy link
Member Author

totto82 commented Apr 24, 2025

jenkins build this failure_report please

@totto82 totto82 requested a review from GitPaean April 24, 2025 08:27
The log is used for output and checking for oscillations

only count the swithcing after NUPCOL
@totto82 totto82 force-pushed the log_local_switching branch from 34075be to dc2f963 Compare April 24, 2025 12:05
@totto82
Copy link
Member Author

totto82 commented Apr 24, 2025

jenkins build this failure_report please

@GitPaean
Copy link
Member

It looks like mpi.compareECLFiles_flow+WVFPEXP-02 needs some attention and investigation.

image

@totto82
Copy link
Member Author

totto82 commented Apr 25, 2025

It looks like mpi.compareECLFiles_flow+WVFPEXP-02 needs some attention and investigation

OP-1 switches to GRUP in master the 1 Jly 2025. This is due to oscillation in the master and looks wrong.

image

.

@GitPaean
Copy link
Member

It looks like mpi.compareECLFiles_flow+WVFPEXP-02 needs some attention and investigation

OP-1 switches to GRUP in master the 1 Jly 2025. This is due to oscillation in the master and looks wrong.

image

.

Sure. I read the result wrong and thought the blue line is the new results somehow. I will look at the PR later today.

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.

3 participants