mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
BlackoilWellModel: move forceShutWellByNameIfPredictionMode to generic class
This commit is contained in:
parent
54ff1c4c45
commit
ad4b34dc30
@ -261,10 +261,6 @@ namespace Opm {
|
|||||||
// called at the beginning of a report step
|
// called at the beginning of a report step
|
||||||
void beginReportStep(const int time_step);
|
void beginReportStep(const int time_step);
|
||||||
|
|
||||||
/// Shut down any single well, but only if it is in prediction mode.
|
|
||||||
/// Returns true if the well was actually found and shut.
|
|
||||||
bool forceShutWellByNameIfPredictionMode(const std::string& wellname, const double simulation_time);
|
|
||||||
|
|
||||||
void updatePerforationIntensiveQuantities();
|
void updatePerforationIntensiveQuantities();
|
||||||
// it should be able to go to prepareTimeStep(), however, the updateWellControls() and initPrimaryVariablesEvaluation()
|
// it should be able to go to prepareTimeStep(), however, the updateWellControls() and initPrimaryVariablesEvaluation()
|
||||||
// makes it a little more difficult. unless we introduce if (iterationIdx != 0) to avoid doing the above functions
|
// makes it a little more difficult. unless we introduce if (iterationIdx != 0) to avoid doing the above functions
|
||||||
|
@ -1521,4 +1521,35 @@ hasTHPConstraints() const
|
|||||||
return comm_.max(local_result);
|
return comm_.max(local_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
BlackoilWellModelGeneric::
|
||||||
|
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_generic_) {
|
||||||
|
if (well->name() == wellname && !well->wellIsStopped()) {
|
||||||
|
if (well->underPredictionMode()) {
|
||||||
|
wellTestState_.closeWell(wellname, WellTestConfig::Reason::PHYSICAL, simulation_time);
|
||||||
|
well_was_shut = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Communicate across processes if a well was shut.
|
||||||
|
well_was_shut = comm_.max(well_was_shut);
|
||||||
|
|
||||||
|
// Only log a message on the output rank.
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,11 @@ 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.
|
||||||
|
/// Returns true if the well was actually found and shut.
|
||||||
|
bool forceShutWellByNameIfPredictionMode(const std::string& wellname,
|
||||||
|
const double simulation_time);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GroupState& groupState() { return this->active_wgstate_.group_state; }
|
GroupState& groupState() { return this->active_wgstate_.group_state; }
|
||||||
|
|
||||||
|
@ -156,41 +156,6 @@ namespace Opm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Return true if the well was found and shut.
|
|
||||||
template<typename TypeTag>
|
|
||||||
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 && !well->wellIsStopped()) {
|
|
||||||
if (well->underPredictionMode()) {
|
|
||||||
wellTestState_.closeWell(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_ && 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
void
|
||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
|
Loading…
Reference in New Issue
Block a user