mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-22 15:33:29 -06:00
Maximum allowed oscillation for groups part 1
This commit is contained in:
parent
b6f23f6fe5
commit
73a28a7abb
@ -562,7 +562,7 @@ bool BlackoilWellModelConstraints<Scalar>::
|
||||
updateGroupIndividualControl(const Group& group,
|
||||
const int reportStepIdx,
|
||||
std::map<std::pair<std::string,Phase>,std::string>& switched_inj,
|
||||
std::map<std::string, std::string>& switched_prod,
|
||||
std::map<std::string, std::vector<std::string>>& switched_prod,
|
||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||
GroupState<Scalar>& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
@ -612,7 +612,7 @@ updateGroupIndividualControl(const Group& group,
|
||||
group_state, deferred_logger);
|
||||
|
||||
if(changed) {
|
||||
switched_prod.insert_or_assign(group.name(),
|
||||
switched_prod[group.name()].push_back(
|
||||
Group::ProductionCMode2String(changed_this.first));
|
||||
WellGroupHelpers<Scalar>::updateWellRatesFromGroupTargetScale(changed_this.second,
|
||||
group,
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
bool updateGroupIndividualControl(const Group& group,
|
||||
const int reportStepIdx,
|
||||
std::map<std::pair<std::string,Phase>,std::string>& switched_inj,
|
||||
std::map<std::string, std::string>& switched_prod,
|
||||
std::map<std::string, std::vector<std::string>>& switched_prod,
|
||||
std::map<std::string, std::pair<std::string, std::string>>& closed_offending_wells,
|
||||
GroupState<Scalar>& group_state,
|
||||
WellState<Scalar>& well_state,
|
||||
|
@ -714,8 +714,7 @@ checkGroupHigherConstraints(const Group& group,
|
||||
deferred_logger);
|
||||
|
||||
if (changed) {
|
||||
switched_prod_groups_.insert_or_assign(group.name(),
|
||||
Group::ProductionCMode2String(Group::ProductionCMode::FLD));
|
||||
switched_prod_groups_[group.name()].push_back(Group::ProductionCMode2String(Group::ProductionCMode::FLD));
|
||||
WellGroupHelpers<Scalar>::updateWellRatesFromGroupTargetScale(scaling_factor,
|
||||
group,
|
||||
schedule(),
|
||||
|
@ -598,7 +598,7 @@ protected:
|
||||
bool wellStructureChangedDynamically_{false};
|
||||
|
||||
// Store maps of group name and new group controls for output
|
||||
std::map<std::string, std::string> switched_prod_groups_;
|
||||
std::map<std::string, std::vector<std::string>> switched_prod_groups_;
|
||||
std::map<std::pair<std::string, Phase>, std::string> switched_inj_groups_;
|
||||
// Store map of group name and close offending well for output
|
||||
std::map<std::string, std::pair<std::string, std::string>> closed_offending_wells_;
|
||||
|
@ -752,11 +752,11 @@ namespace Opm {
|
||||
for (const auto& [name, to] : this->switched_prod_groups_) {
|
||||
const Group::ProductionCMode& oldControl = this->prevWGState().group_state.production_control(name);
|
||||
std::string from = Group::ProductionCMode2String(oldControl);
|
||||
if (to != from) {
|
||||
if (to.back() != from) {
|
||||
std::string msg = " Production Group " + name
|
||||
+ " control mode changed from ";
|
||||
msg += from;
|
||||
msg += " to " + to;
|
||||
msg += " to " + to.back();
|
||||
local_deferredLogger.info(msg);
|
||||
}
|
||||
}
|
||||
@ -2236,10 +2236,14 @@ namespace Opm {
|
||||
if (changed_well_to_group) {
|
||||
updateAndCommunicate(episodeIdx, iterationIdx, deferred_logger);
|
||||
changed_well_group = true;
|
||||
simulator_.gridView().comm());
|
||||
}
|
||||
|
||||
// Check individual well constraints and communicate.
|
||||
bool changed_well_individual = false;
|
||||
changed_well_to_group = comm.sum(static_cast<int>(changed_well_to_group));
|
||||
if (changed_well_to_group) {
|
||||
updateAndCommunicate(episodeIdx, iterationIdx, deferred_logger);
|
||||
changed_well_group = true;
|
||||
}
|
||||
{
|
||||
// For MS Wells a linear solve is performed below and the matrix might be singular.
|
||||
// We need to communicate the exception thrown to the others and rethrow.
|
||||
@ -2262,7 +2266,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
// update wsolvent fraction for REIN wells
|
||||
const Group& fieldGroup = this->schedule().getGroup("FIELD", episodeIdx);
|
||||
//const Group& fieldGroup = this->schedule().getGroup("FIELD", episodeIdx);
|
||||
this->updateWsolvent(fieldGroup, episodeIdx, this->nupcolWellState());
|
||||
|
||||
return { changed_well_group, more_network_update };
|
||||
@ -2471,6 +2475,16 @@ namespace Opm {
|
||||
const int reportStepIdx,
|
||||
const int iterationIdx)
|
||||
{
|
||||
|
||||
if (this->switched_prod_groups_.count(group.name()) > 0) {
|
||||
for (const auto& key : this->switched_prod_groups_[group.name()]) {
|
||||
if (std::count(this->switched_prod_groups_[group.name()].begin(), this->switched_prod_groups_[group.name()].end(), key) >= 3) {
|
||||
std::cout << "group control osccilating " << group.name() << " keep at " << key << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool changed = false;
|
||||
bool changed_hc = this->checkGroupHigherConstraints( group, deferred_logger, reportStepIdx);
|
||||
if (changed_hc) {
|
||||
|
@ -332,7 +332,7 @@ public:
|
||||
last_valid_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||
nupcol_wgstate_ = WGState<double>::serializationTestObject(dummy);
|
||||
last_glift_opt_time_ = 5.0;
|
||||
switched_prod_groups_ = {{"test4", "test5"}};
|
||||
switched_prod_groups_ = {{"test4", {"test5", "test6"}}};
|
||||
switched_inj_groups_ = {{{"test4", Phase::SOLVENT}, "test5"}};
|
||||
closed_offending_wells_ = {{"test4", {"test5", "test6"}}};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user