diff --git a/opm/simulators/flow/rescoup/ReservoirCouplingMaster.cpp b/opm/simulators/flow/rescoup/ReservoirCouplingMaster.cpp index 0809302ff3..3bfc4d448b 100644 --- a/opm/simulators/flow/rescoup/ReservoirCouplingMaster.cpp +++ b/opm/simulators/flow/rescoup/ReservoirCouplingMaster.cpp @@ -31,6 +31,8 @@ #include #include +#include +#include #include #include @@ -57,9 +59,18 @@ ReservoirCouplingMaster( schedule_{schedule}, argc_{argc}, argv_{argv}, - logger_{comm} + logger_{comm}, + sync_at_report_steps_{Parameters::Get()} { 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)" + )); + } } // ------------------ diff --git a/opm/simulators/flow/rescoup/ReservoirCouplingMaster.hpp b/opm/simulators/flow/rescoup/ReservoirCouplingMaster.hpp index f3448ba4dc..23ff46a765 100644 --- a/opm/simulators/flow/rescoup/ReservoirCouplingMaster.hpp +++ b/opm/simulators/flow/rescoup/ReservoirCouplingMaster.hpp @@ -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& master_group_map); @@ -232,6 +237,10 @@ private: std::unique_ptr> report_step_data_{nullptr}; // Handles time stepping for the master and slaves std::unique_ptr> 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 diff --git a/opm/simulators/timestepping/EclTimeSteppingParams.cpp b/opm/simulators/timestepping/EclTimeSteppingParams.cpp index 7a1e3c8dbe..349c247213 100644 --- a/opm/simulators/timestepping/EclTimeSteppingParams.cpp +++ b/opm/simulators/timestepping/EclTimeSteppingParams.cpp @@ -34,6 +34,11 @@ void registerEclTimeSteppingParameters() { Parameters::Register ("Honor some aspects of the TUNING keyword."); + Parameters::Register + ("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> ("The factor time steps are elongated after a successful substep"); Parameters::Register> diff --git a/opm/simulators/timestepping/EclTimeSteppingParams.hpp b/opm/simulators/timestepping/EclTimeSteppingParams.hpp index 12ee327c30..dc663e7c19 100644 --- a/opm/simulators/timestepping/EclTimeSteppingParams.hpp +++ b/opm/simulators/timestepping/EclTimeSteppingParams.hpp @@ -26,6 +26,9 @@ namespace Opm::Parameters { struct EnableTuning { static constexpr bool value = false; }; + +struct RescoupSyncAtReportSteps { static constexpr bool value = false; }; + template struct SolverGrowthFactor { static constexpr Scalar value = 2.0; };