Reservoir coupling: Add end-of-sync-step slave-to-master data exchange#6978
Merged
totto82 merged 1 commit intoOPM:masterfrom Apr 10, 2026
Merged
Reservoir coupling: Add end-of-sync-step slave-to-master data exchange#6978totto82 merged 1 commit intoOPM:masterfrom
totto82 merged 1 commit intoOPM:masterfrom
Conversation
After the master's first substep, block until all slaves have completed their sync step and sent production/injection data. This ensures evalSummaryState() and subsequent master substeps have up-to-date slave rates for correct summary output (FOPR, GOPR, etc.). Previously, slave data was only received at beginTimeStep(), which meant the first sync step had no data and subsequent steps used stale rates from the previous sync step. The master sets a needsSlaveDataReceive flag at the start of each sync step. On the first converged substep, timeStepSucceeded() blocks on MPI_Recv until the slaves finish. The slave predicts whether each substep is the last one in the sync step and sends data accordingly.
Contributor
Author
|
jenkins build this please |
Member
|
Thanks. It looks good. The standard approach is to have a dummy reservoir for the master, so then the performance hit will be low. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
evalSummaryState()and all subsequent master substeps have up-to-date slave ratesBackground
The master process writes summary output (FOPR, GOPR, etc.) at every internal substep, but slave production data was previously only received at
beginTimeStep(), reflecting the previous sync step's rates. For the very first sync step, no prior data existed at all, resulting in FOPR=0 for the entire first report step.Approach
The master sets a
needsSlaveDataReceiveflag at the start of each sync step. On the first converged substep'stimeStepSucceeded(), the master blocks onMPI_Recvuntil all slaves have completed their sync step and sent production data. Once received, the data is available forevalSummaryState()(called next inendTimeStep()) and all subsequent master substeps.On the slave side,
maybeUpdateLastSubstepOfSyncTimestep_()predicts before each substep whether it will complete the sync step. If so,timeStepSucceeded()sends the production data. If the prediction is wrong (convergence failure),timeStepSucceeded()is never called, so no MPI mismatch occurs. On retry with a smaller dt, the flag is recomputed correctly.Performance impact
With this change, the master and slave no longer advance fully in parallel within a sync step. Previously the total sync step time was approximately
max(T_master, T_slave). Now it is approximatelyT_slave + T_master_remaining, whereT_master_remainingis the time for the master's remaining substeps after the first.For dummy master grids single grid block, no wells,
T_master_remainingis negligible and the overhead is minimal. For cases where the master is a real reservoir with its own wells, the overhead could be more noticeable.Alternative: Deferred summary writing (future improvement)
A more efficient approach would let master and slave advance in parallel (as before), then have the master retroactively update its summary output with the slave's actual rates at the end of the sync step. This means the master could buffer summary data during substeps and rewrite it with the final slave rates. This would restore
max(T_master, T_slave)parallelism but requires more complex changes to the summary output infrastructure. It could be implemented as a follow-up if the performance overhead of the current approach proves significant.