Add parameter --nupcol_group_rate_tolerance to be able to set the relative tolerance. Default is 0.001

This commit is contained in:
Tor Harald Sandve
2024-11-12 13:45:23 +01:00
parent 7639450ce1
commit 71614ea5b0
5 changed files with 20 additions and 5 deletions

View File

@@ -102,6 +102,8 @@ BlackoilModelParameters<Scalar>::BlackoilModelParameters()
convergence_monitoring_ = Parameters::Get<Parameters::ConvergenceMonitoring>();
convergence_monitoring_cutoff_ = Parameters::Get<Parameters::ConvergenceMonitoringCutOff>();
convergence_monitoring_decay_factor_ = Parameters::Get<Parameters::ConvergenceMonitoringDecayFactor<Scalar>>();
nupcol_group_rate_tolerance_ = Parameters::Get<Parameters::NupcolGroupRateTolerance<Scalar>>();
}
template<class Scalar>
@@ -251,6 +253,9 @@ void BlackoilModelParameters<Scalar>::registerParameters()
Parameters::Register<Parameters::ConvergenceMonitoringDecayFactor<Scalar>>
("Decay factor for convergence monitoring");
Parameters::Register<Parameters::NupcolGroupRateTolerance<Scalar>>
("Tolerance for acceptable changes in VREP/RAIN group rates");
Parameters::Hide<Parameters::DebugEmitCellPartition>();
// if openMP is available, determine the number threads per process automatically.

View File

@@ -152,6 +152,9 @@ struct ConvergenceMonitoringCutOff { static constexpr int value = 6; };
template<class Scalar>
struct ConvergenceMonitoringDecayFactor { static constexpr Scalar value = 0.75; };
template<class Scalar>
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();

View File

@@ -1180,6 +1180,7 @@ template<class Scalar>
void BlackoilWellModelGeneric<Scalar>::
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) {

View File

@@ -377,6 +377,7 @@ protected:
void updateAndCommunicateGroupData(const int reportStepIdx,
const int iterationIdx,
const Scalar tol_nupcol,
DeferredLogger& deferred_logger);
void inferLocalShutWells();

View File

@@ -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<typename TypeTag>