Merge pull request #5642 from steink/Revert-5613

Revert #5613 but keep as option
This commit is contained in:
Atgeirr Flø Rasmussen 2024-10-03 14:06:24 +02:00 committed by GitHub
commit 84e6ed6493
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 9 deletions

View File

@ -72,6 +72,7 @@ BlackoilModelParameters<Scalar>::BlackoilModelParameters()
use_average_density_ms_wells_ = Parameters::Get<Parameters::UseAverageDensityMsWells>();
local_well_solver_control_switching_ = Parameters::Get<Parameters::LocalWellSolveControlSwitching>();
use_implicit_ipr_ = Parameters::Get<Parameters::UseImplicitIpr>();
check_group_constraints_inner_well_iterations_ = Parameters::Get<Parameters::CheckGroupConstraintsInnerWellIterations>();
nonlinear_solver_ = Parameters::Get<Parameters::NonlinearSolver>();
const auto approach = Parameters::Get<Parameters::LocalSolveApproach>();
if (approach == "jacobi") {
@ -195,6 +196,8 @@ void BlackoilModelParameters<Scalar>::registerParameters()
("Allow control switching during local well solutions");
Parameters::Register<Parameters::UseImplicitIpr>
("Compute implict IPR for stability checks and stable solution search");
Parameters::Register<Parameters::CheckGroupConstraintsInnerWellIterations>
("Allow checking of group constraints during inner well iterations");
Parameters::Register<Parameters::NetworkMaxStrictIterations>
("Maximum iterations in network solver before relaxing tolerance");
Parameters::Register<Parameters::NetworkMaxIterations>

View File

@ -115,6 +115,7 @@ struct MaximumNumberOfWellSwitches { static constexpr int value = 3; };
struct UseAverageDensityMsWells { static constexpr bool value = false; };
struct LocalWellSolveControlSwitching { static constexpr bool value = true; };
struct UseImplicitIpr { static constexpr bool value = true; };
struct CheckGroupConstraintsInnerWellIterations { static constexpr bool value = true; };
// Network solver parameters
struct NetworkMaxStrictIterations { static constexpr int value = 100; };
@ -260,6 +261,9 @@ public:
/// Whether to use implicit IPR for thp stability checks and solution search
bool use_implicit_ipr_;
/// Whether to allow checking/changing to group controls during inner well iterations
bool check_group_constraints_inner_well_iterations_;
/// Maximum number of iterations in the network solver before relaxing tolerance
int network_max_strict_iterations_;

View File

@ -279,6 +279,7 @@ namespace Opm
const bool fixed_status)
{
const auto& summary_state = simulator.vanguard().summaryState();
const auto& schedule = simulator.vanguard().schedule();
auto& ws = well_state.well(this->index_of_well_);
std::string from;
if (this->isInjector()) {
@ -300,18 +301,17 @@ namespace Opm
} else {
bool changed = false;
if (!fixed_control) {
// We don't allow changing to group controls here since this may lead to inconsistencies
// in the group handling which in turn may result in excessive back and forth switching.
// If we are to allow this change, one needs to make sure all necessary information propagates
// properly, but for now, we simply disallow it. The commented code below is kept for future reference
// Changing to group controls here may lead to inconsistencies in the group handling which in turn
// may result in excessive back and forth switching. However, we currently allow this by default.
// The switch check_group_constraints_inner_well_iterations_ is a temporary solution.
// const bool hasGroupControl = this->isInjector() ? inj_controls.hasControl(Well::InjectorCMode::GRUP) :
// prod_controls.hasControl(Well::ProducerCMode::GRUP);
const bool hasGroupControl = this->isInjector() ? inj_controls.hasControl(Well::InjectorCMode::GRUP) :
prod_controls.hasControl(Well::ProducerCMode::GRUP);
changed = this->checkIndividualConstraints(ws, summary_state, deferred_logger, inj_controls, prod_controls);
// if (hasGroupControl) {
// changed = changed || this->checkGroupConstraints(well_state, group_state, schedule, summary_state,deferred_logger);
// }
if (hasGroupControl && param_.check_group_constraints_inner_well_iterations_) {
changed = changed || this->checkGroupConstraints(well_state, group_state, schedule, summary_state,deferred_logger);
}
if (changed) {
const bool thp_controlled = this->isInjector() ? ws.injection_cmode == Well::InjectorCMode::THP :