Reservoir Coupling: Fix sync of group data to only occur on first substep#6704
Merged
Conversation
Contributor
Author
|
jenkins build this please |
Contributor
Author
|
jenkins build this serial please |
2f794c9 to
5722562
Compare
Contributor
Author
|
jenkins build this please |
Contributor
Author
|
jenkins build this serial please |
1 similar comment
Member
|
jenkins build this serial please |
blattms
approved these changes
Jan 8, 2026
Member
blattms
left a comment
There was a problem hiding this comment.
Approved.
Just running jenkins again as the data is gone already.
The master-slave synchronization code in beginTimeStep() was executing on every internal substep within a "sync" timestep. This is incorrect because: 1. The SubStepIteration loop typically splits a sync timestep into multiple smaller internal substeps for numerical stability 2. After the first internal substep, master and slaves are at different simulation times and cannot exchange data correctly 3. Repeated sync attempts would cause deadlocks or incorrect data This fix adds an isFirstSubstepOfSyncTimestep flag to track whether we are at the start of a coordinated "sync" timestep. The flag is: - Set to true before each SubStepIteration::run() call - Cleared to false after the first runSubStep_() returns
5722562 to
fe6b508
Compare
Contributor
Author
|
jenkins build this please |
1 similar comment
Member
|
jenkins build this please |
akva2
reviewed
Jan 19, 2026
| /// @return Reference to the potentials data for the specified group | ||
| const Potentials& getSlaveGroupPotentials(const std::string &master_group_name) const; | ||
|
|
||
| /// @brief Check if this is the first substep of within a "sync" timestep. |
| std::size_t slave_idx, const std::vector<ProductionGroupTarget>& production_targets | ||
| ) const; | ||
|
|
||
| /// @brief Set whether this is the first substep of within a "sync" timestep. |
| /// Injection data for each slave group (map key: master group name) | ||
| std::map<std::string, std::vector<SlaveGroupInjectionData>> slave_group_injection_data_; | ||
|
|
||
| /// Flag to track if this is the first substep of within a "sync" timestep. |
| /// @return MPI communicator handle for communication with the master process | ||
| MPI_Comm getSlaveMasterComm() const { return this->slave_.getMasterComm(); } | ||
|
|
||
| /// @brief Check if this is the first substep of within a "sync" timestep. |
| /// @note Must be called before the master attempts to receive injection data | ||
| void sendInjectionDataToMaster(const std::vector<SlaveGroupInjectionData> &injection_data) const; | ||
|
|
||
| /// @brief Set whether this is the first substep of within a "sync" timestep. |
|
|
||
| /// Reference to the parent ReservoirCouplingSlave object | ||
| ReservoirCouplingSlave<Scalar> &slave_; | ||
| // Flag to track if this is the first substep of within a "sync" timestep. |
| current_time + current_step_length, step_end_time | ||
| ); | ||
| // Mark this as the first substep of the "sync" timestep. This flag controls | ||
| // whether master-slave data exchange should occur in beginTimeStep() in the well model.. |
| current_time + timestep, step_end_time | ||
| ); | ||
| // Mark this as the first substep of the "sync" timestep. This flag controls | ||
| // whether master-slave data exchange should occur in beginTimeStep() in the well model.. |
Contributor
Author
|
jenkins build this please |
Contributor
Author
|
@akva2 Thanks for the review, I have added a commit to address the comments. |
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.
The master-slave group data synchronization code in
BlackoilWellModel::beginTimeStep()was executing on every internal substep within a larger "sync" timestep (as assigned by the master process so as not to overshoot any slavereport dates). This is incorrect because:
SubStepIterationloop typically splits a sync timestep into multiple smaller internal substeps for numerical stability. And/or a timestep might be chopped in case of convergence problems.This fix adds an
isFirstSubstepOfSyncTimestep()flag to track whether we are at the start of a coordinated "sync" timestep. The flag is:SubStepIteration::run()callrunSubStep_()returns.