Add --rescoup-sync-at-report-steps CLI flag

Add a new boolean parameter `RescoupSyncAtReportSteps` (default `false`)
to the time-stepping parameter set, registered with a developer-facing
description.  Read it in the `ReservoirCouplingMaster` constructor,
store it as a member, expose it via a `syncAtReportSteps()` getter, and
log the chosen mode once at simulation start.

This is a no-op precursor for the upcoming change to the master's outer
sync loop.  The flag is read and made available, but no code consults
it yet, so behavior is unchanged on both values.

Future use: when `true`, the master will sync with its slaves at slave
report-step boundaries (the current OPM behavior).  When `false`, the
master will sync at every master actual time step.
This commit is contained in:
Håkon Hægland committed 2026-04-24 12:33:50 +02:00
1 parent ee85ac5f98
commit 42871af2cd
4 files changed
+29 -1

No files matched your search

@@ -31,6 +31,8 @@
#include <opm/input/eclipse/Schedule/ResCoup/Slaves.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/models/utils/parametersystem.hpp>
#include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
#include <opm/simulators/utils/ParallelCommunication.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
@@ -57,9 +59,18 @@ ReservoirCouplingMaster(
schedule_{schedule},
argc_{argc},
argv_{argv},
logger_{comm}
logger_{comm},
sync_at_report_steps_{Parameters::Get<Parameters::RescoupSyncAtReportSteps>()}
{
this->activation_date_ = this->getMasterActivationDate_();
if (this->comm_.rank() == 0) {
OpmLog::info(fmt::format(
"Reservoir coupling: master synchronizes with slaves at {}.",
this->sync_at_report_steps_
? "report-step boundaries (RSYNC) (--rescoup-sync-at-report-steps=true)"
: "every master time step (TSYNC) (--rescoup-sync-at-report-steps=false)"
));
}
}
// ------------------
@@ -164,6 +164,11 @@ public:
void setSlaveNextReportTimeOffset(int index, double offset);
void setSlaveStartDate(int index, std::time_t date) { this->slave_start_dates_[index] = date; }
bool slaveIsActivated(int index) const { return this->slave_activation_status_[index] != 0; }
/// @brief Whether the master syncs with slaves at slave report-step boundaries
/// (true) or at every master actual time step (false, default CLI flag value).
/// @details Set from the --rescoup-sync-at-report-steps CLI flag in the
/// constructor. See `Parameters::RescoupSyncAtReportSteps`.
bool syncAtReportSteps() const { return this->sync_at_report_steps_; }
void updateMasterGroupNameOrderMap(
const std::string& slave_name, const std::map<std::string, std::size_t>& master_group_map);
@@ -232,6 +237,10 @@ private:
std::unique_ptr<ReservoirCouplingMasterReportStep<Scalar>> report_step_data_{nullptr};
// Handles time stepping for the master and slaves
std::unique_ptr<ReservoirCouplingTimeStepper<Scalar>> time_stepper_{nullptr};
// CLI flag --rescoup-sync-at-report-steps. When true, the master syncs with
// its slaves at report-step boundaries (RSYNC). When false
// (default), it syncs at every master time step (TSYNC).
bool sync_at_report_steps_{false};
};
} // namespace Opm
@@ -34,6 +34,11 @@ void registerEclTimeSteppingParameters()
{
Parameters::Register<Parameters::EnableTuning>
("Honor some aspects of the TUNING keyword.");
Parameters::Register<Parameters::RescoupSyncAtReportSteps>
("Developer flag for reservoir coupling. If true, the master "
"synchronizes with its slaves at slave report-step boundaries. "
"If false (default), the master synchronizes at every master actual time step. "
"Has no effect in non-rescoup runs.");
Parameters::Register<Parameters::SolverGrowthFactor<Scalar>>
("The factor time steps are elongated after a successful substep");
Parameters::Register<Parameters::SolverMaxGrowth<Scalar>>
@@ -26,6 +26,9 @@
namespace Opm::Parameters {
struct EnableTuning { static constexpr bool value = false; };
struct RescoupSyncAtReportSteps { static constexpr bool value = false; };
template<class Scalar>
struct SolverGrowthFactor { static constexpr Scalar value = 2.0; };