Merge pull request #3607 from totto82/operHist

Check operabiliy for wells under history
This commit is contained in:
Tor Harald Sandve 2021-10-19 09:03:34 +02:00 committed by GitHub
commit 5717a95cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 38 deletions

View File

@ -587,14 +587,14 @@ namespace Opm {
// Close all consistently failing wells. // Close all consistently failing wells.
int num_shut_wells = 0; int num_shut_wells = 0;
for (const auto& well : failing_wells) { for (const auto& well : failing_wells) {
bool was_shut = solver.model().wellModel().forceShutWellByNameIfPredictionMode(well, substepTimer.simulationTimeElapsed()); bool was_shut = solver.model().wellModel().forceShutWellByName(well, substepTimer.simulationTimeElapsed());
if (was_shut) { if (was_shut) {
++num_shut_wells; ++num_shut_wells;
} }
} }
if (num_shut_wells == 0) { if (num_shut_wells == 0) {
// None of the problematic wells were prediction wells, // None of the problematic wells were shut.
// so none were shut. We must fall back to chopping again. // We must fall back to chopping again.
chopTimestep(); chopTimestep();
} else { } else {
substepTimer.provideTimeStepEstimate(dt); substepTimer.provideTimeStepEstimate(dt);

View File

@ -1586,18 +1586,16 @@ hasTHPConstraints() const
bool bool
BlackoilWellModelGeneric:: BlackoilWellModelGeneric::
forceShutWellByNameIfPredictionMode(const std::string& wellname, forceShutWellByName(const std::string& wellname,
const double simulation_time) const double simulation_time)
{ {
// Only add the well to the closed list on the // Only add the well to the closed list on the
// process that owns it. // process that owns it.
int well_was_shut = 0; int well_was_shut = 0;
for (const auto& well : well_container_generic_) { for (const auto& well : well_container_generic_) {
if (well->name() == wellname && !well->wellIsStopped()) { if (well->name() == wellname && !well->wellIsStopped()) {
if (well->underPredictionMode()) { wellTestState().close_well(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
wellTestState().close_well(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time); well_was_shut = 1;
well_was_shut = 1;
}
break; break;
} }
} }

View File

@ -157,10 +157,10 @@ public:
/// Return true if any well has a THP constraint. /// Return true if any well has a THP constraint.
bool hasTHPConstraints() const; bool hasTHPConstraints() const;
/// Shut down any single well, but only if it is in prediction mode. /// Shut down any single well
/// Returns true if the well was actually found and shut. /// Returns true if the well was actually found and shut.
bool forceShutWellByNameIfPredictionMode(const std::string& wellname, bool forceShutWellByName(const std::string& wellname,
const double simulation_time); const double simulation_time);
protected: protected:

View File

@ -332,7 +332,6 @@ protected:
bool solveWellForTesting(const Simulator& ebosSimulator, WellState& well_state, const GroupState& group_state, bool solveWellForTesting(const Simulator& ebosSimulator, WellState& well_state, const GroupState& group_state,
DeferredLogger& deferred_logger); DeferredLogger& deferred_logger);
bool shutUnsolvableWells() const;
}; };
} }

View File

@ -811,13 +811,6 @@ updateWellTestState(const SingleWellState& ws,
WellTestState& wellTestState, WellTestState& wellTestState,
DeferredLogger& deferred_logger) const DeferredLogger& deferred_logger) const
{ {
// Based on current understanding, only under prediction mode, we need to shut well due to various
// reasons or limits. With more knowlage or testing cases later, this might need to be corrected.
if (!underPredictionMode() ) {
return;
}
// updating well test state based on physical (THP/BHP) limits. // updating well test state based on physical (THP/BHP) limits.
updateWellTestStatePhysical(simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger); updateWellTestStatePhysical(simulationTime, writeMessageToOPMLog, wellTestState, deferred_logger);

View File

@ -478,7 +478,7 @@ namespace Opm
// unsolvable wells are treated as not operable and will not be solved for in this iteration. // unsolvable wells are treated as not operable and will not be solved for in this iteration.
if (!converged) { if (!converged) {
if (this->shutUnsolvableWells()) if (param_.shut_unsolvable_wells_)
this->operability_status_.solvable = false; this->operability_status_.solvable = false;
} }
} }
@ -551,10 +551,6 @@ namespace Opm
return; return;
} }
if (!this->underPredictionMode() ) {
return;
}
if (this->wellIsStopped() && !changed_to_stopped_this_step_) { if (this->wellIsStopped() && !changed_to_stopped_this_step_) {
return; return;
} }
@ -563,19 +559,6 @@ namespace Opm
} }
template<typename TypeTag>
bool
WellInterface<TypeTag>::
shutUnsolvableWells() const
{
bool shut_unsolvable_wells = param_.shut_unsolvable_wells_;
// the well operability system currently works only for producers in prediction mode
return shut_unsolvable_wells && this->underPredictionMode();
}
template<typename TypeTag> template<typename TypeTag>
void void