mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add bool return value to forceShutWellByNameIfPredictionMode().
Returns true if the well requested was actually shut.
This commit is contained in:
@@ -239,7 +239,8 @@ namespace Opm {
|
||||
bool hasTHPConstraints() const;
|
||||
|
||||
/// Shut down any single well, but only if it is in prediction mode.
|
||||
void forceShutWellByNameIfPredictionMode(const std::string& wellname, const double simulation_time);
|
||||
/// Returns true if the well was actually found and shut.
|
||||
bool forceShutWellByNameIfPredictionMode(const std::string& wellname, const double simulation_time);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -133,30 +133,37 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
/// Return true if any well has a THP constraint.
|
||||
/// Return true if the well was found and shut.
|
||||
template<typename TypeTag>
|
||||
void
|
||||
bool
|
||||
BlackoilWellModel<TypeTag>::
|
||||
forceShutWellByNameIfPredictionMode(const std::string& wellname,
|
||||
const double simulation_time)
|
||||
{
|
||||
// Only add the well to the closed list on the
|
||||
// process that owns it.
|
||||
int well_was_shut = 0;
|
||||
for (const auto& well : well_container_) {
|
||||
if (well->name() == wellname) {
|
||||
if (well->underPredictionMode()) {
|
||||
wellTestState_.addClosedWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
|
||||
well_was_shut = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Communicate across processes if a well was shut.
|
||||
well_was_shut = ebosSimulator_.vanguard().grid().comm().max(well_was_shut);
|
||||
|
||||
// Only log a message on the output rank.
|
||||
if (terminal_output_) {
|
||||
if (terminal_output_ && well_was_shut) {
|
||||
const std::string msg = "Well " + wellname
|
||||
+ " will be shut because it cannot get converged.";
|
||||
OpmLog::info(msg);
|
||||
}
|
||||
|
||||
return (well_was_shut == 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user