diff --git a/opm/simulators/flow/BlackoilModelParameters.cpp b/opm/simulators/flow/BlackoilModelParameters.cpp index 95b26ff0b..d070b55b5 100644 --- a/opm/simulators/flow/BlackoilModelParameters.cpp +++ b/opm/simulators/flow/BlackoilModelParameters.cpp @@ -102,6 +102,8 @@ BlackoilModelParameters::BlackoilModelParameters() convergence_monitoring_ = Parameters::Get(); convergence_monitoring_cutoff_ = Parameters::Get(); convergence_monitoring_decay_factor_ = Parameters::Get>(); + + nupcol_group_rate_tolerance_ = Parameters::Get>(); } template @@ -251,6 +253,9 @@ void BlackoilModelParameters::registerParameters() Parameters::Register> ("Decay factor for convergence monitoring"); + Parameters::Register> + ("Tolerance for acceptable changes in VREP/RAIN group rates"); + Parameters::Hide(); // if openMP is available, determine the number threads per process automatically. diff --git a/opm/simulators/flow/BlackoilModelParameters.hpp b/opm/simulators/flow/BlackoilModelParameters.hpp index d654a6fa5..528eca22e 100644 --- a/opm/simulators/flow/BlackoilModelParameters.hpp +++ b/opm/simulators/flow/BlackoilModelParameters.hpp @@ -152,6 +152,9 @@ struct ConvergenceMonitoringCutOff { static constexpr int value = 6; }; template struct ConvergenceMonitoringDecayFactor { static constexpr Scalar value = 0.75; }; +template +struct NupcolGroupRateTolerance { static constexpr Scalar value = 0.001; }; + } // namespace Opm::Parameters namespace Opm { @@ -315,6 +318,10 @@ public: /// Decay factor used in convergence monitoring Scalar convergence_monitoring_decay_factor_; + // Relative tolerance of group rates (VREP, REIN) + // If violated the nupcol wellstate is updated + Scalar nupcol_group_rate_tolerance_; + /// Construct from user parameters or defaults. BlackoilModelParameters(); diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index d531f84aa..76ffefa7c 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -1180,6 +1180,7 @@ template void BlackoilWellModelGeneric:: updateAndCommunicateGroupData(const int reportStepIdx, const int iterationIdx, + const Scalar tol_nupcol, DeferredLogger& deferred_logger) { const Group& fieldGroup = schedule().getGroup("FIELD", reportStepIdx); @@ -1192,7 +1193,6 @@ updateAndCommunicateGroupData(const int reportStepIdx, if (iterationIdx <= nupcol) { this->updateNupcolWGState(); } else { - Scalar tol_nupcol = 0.01; for (const auto& gr_name : schedule().groupNames(reportStepIdx)) { const Phase all[] = { Phase::WATER, Phase::OIL, Phase::GAS }; for (Phase phase : all) { diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.hpp b/opm/simulators/wells/BlackoilWellModelGeneric.hpp index 874aba637..7da99c24b 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.hpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.hpp @@ -377,6 +377,7 @@ protected: void updateAndCommunicateGroupData(const int reportStepIdx, const int iterationIdx, + const Scalar tol_nupcol, DeferredLogger& deferred_logger); void inferLocalShutWells(); diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 9860eb1ef..86233da62 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -472,7 +472,9 @@ namespace Opm { const int reportStepIdx = simulator_.episodeIndex(); this->updateAndCommunicateGroupData(reportStepIdx, - simulator_.model().newtonMethod().numIterations(), local_deferredLogger); + simulator_.model().newtonMethod().numIterations(), + param_.nupcol_group_rate_tolerance_, + local_deferredLogger); this->wellState().updateWellsDefaultALQ(this->schedule(), reportStepIdx, this->summaryState()); this->wellState().gliftTimeStepInit(); @@ -2176,7 +2178,7 @@ namespace Opm { const int iterationIdx = simulator_.model().newtonMethod().numIterations(); const auto& comm = simulator_.vanguard().grid().comm(); - this->updateAndCommunicateGroupData(episodeIdx, iterationIdx, deferred_logger); + this->updateAndCommunicateGroupData(episodeIdx, iterationIdx, param_.nupcol_group_rate_tolerance_, deferred_logger); // network related bool more_network_update = false; @@ -2430,7 +2432,7 @@ namespace Opm { const int iterationIdx, DeferredLogger& deferred_logger) { - this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, deferred_logger); + this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, param_.nupcol_group_rate_tolerance_, deferred_logger); // updateWellStateWithTarget might throw for multisegment wells hence we // have a parallel try catch here to thrown on all processes. @@ -2442,7 +2444,7 @@ namespace Opm { } OPM_END_PARALLEL_TRY_CATCH("BlackoilWellModel::updateAndCommunicate failed: ", simulator_.gridView().comm()) - this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, deferred_logger); + this->updateAndCommunicateGroupData(reportStepIdx, iterationIdx, param_.nupcol_group_rate_tolerance_, deferred_logger); } template