Skip to content

Fix substep log line for reservoir coupling#7031

Open
hakonhagland wants to merge 1 commit into
OPM:masterfrom
hakonhagland:timestep_log2
Open

Fix substep log line for reservoir coupling#7031
hakonhagland wants to merge 1 commit into
OPM:masterfrom
hakonhagland:timestep_log2

Conversation

@hakonhagland
Copy link
Copy Markdown
Contributor

@hakonhagland hakonhagland commented May 4, 2026

In a reservoir-coupling run, the per-substep Starting time step N, stepsize ... days, at day X/Y line emitted by detail::logTimer reset N to 0 on every sync chunk and showed Y as the end of the chunk instead of the end of the report step. The same problem applied to the debug output of AdaptiveSimulatorTimer::report().

Example — TSYNC, 31-day report step starting Oct 1.
Before:

Starting time step 0, stepsize 1 days, at day 0/1,  date = 01-Oct-2018
Starting time step 0, stepsize 3 days, at day 1/4,  date = 02-Oct-2018
Starting time step 0, stepsize 9 days, at day 4/13, date = 05-Oct-2018
Starting time step 0, stepsize 18 days, at day 13/31, date = 14-Oct-2018

After:

Starting time step 0, stepsize 1 days, at day 0/31, date = 01-Oct-2018
Starting time step 1, stepsize 3 days, at day 1/31, date = 02-Oct-2018
Starting time step 2, stepsize 9 days, at day 4/31, date = 05-Oct-2018
Starting time step 3, stepsize 18 days, at day 13/31, date = 14-Oct-2018

Root cause

runStepReservoirCouplingMaster_ and runStepReservoirCouplingSlave_ construct a fresh AdaptiveSimulatorTimer for every sync chunk, so the timer's current_step_ restarts at 0 and total_time_ spans only the chunk. The non-coupled path (runStepOriginal_) constructs one timer per report step and is unaffected, which is why the bug only showed up in rescoup runs.

Fix

Add a small "report step view" to AdaptiveSimulatorTimer — three new optional members (report_step_start_time_, report_step_total_time_, report_step_substep_offset_) plus matching accessors (reportStepStartTime(), reportStepTotalTime(), reportStepSubstepNum()) that fall through to the per-timer fields when unset. The two rescoup outer loops set the view on each per-chunk timer and accumulate the substep offset across chunks. detail::logTimer and AdaptiveSimulatorTimer::report() switch to the new accessors.

Behavior matrix

Mode Master log Slave logs
TSYNC (default) Fixed — incrementing counter, report-step-end denominator Fixed
RSYNC (--rescoup-sync-at-report-steps=true) Unchanged (was already correct because chunk == report step) Unchanged
Non-coupled (runStepOriginal_) Byte-identical to before n/a

Defaults preserve existing semantics, so the non-rescoup output is unchanged.

In a reservoir-coupling run the per-substep "Starting time step N,
... at day X/Y" line emitted by detail::logTimer reset N to 0 on
every sync chunk and showed Y as the end of the chunk instead of
the end of the report step. The same problem applied to the debug
output of AdaptiveSimulatorTimer::report().

The cause: runStepReservoirCouplingMaster_ and
runStepReservoirCouplingSlave_ construct a fresh
AdaptiveSimulatorTimer for every sync chunk, so current_step_
restarts at 0 and total_time_ spans only the chunk. The non-rescoup
path constructs one timer per report step and is unaffected.

Add a small "report step view" to AdaptiveSimulatorTimer
(report_step_start_time_, report_step_total_time_,
report_step_substep_offset_) with accessors that fall through to
the per-timer fields when unset. The two rescoup outer loops set
the view on each per-chunk timer and accumulate the substep offset
across chunks. logTimer and report() switch to the new accessors.

Defaults preserve existing semantics, so the non-coupled path's
output is byte-identical and RSYNC-mode rescoup runs (where the
chunk already coincides with the report step) are unchanged.
TSYNC-mode runs now show an incrementing counter and the
report-step-end denominator on both master and slave.
@hakonhagland hakonhagland added the manual:irrelevant This PR is a minor fix and should not appear in the manual label May 4, 2026
@hakonhagland
Copy link
Copy Markdown
Contributor Author

jenkins build this serial please

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.

1 participant