mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-14 16:13:27 -06:00
moving function needRebalanceNetwork to BlackoilWellModelGeneric
This commit is contained in:
parent
05795c0bb1
commit
926228401a
@ -372,9 +372,6 @@ namespace Opm {
|
||||
// the reservoir should stay static during this solution procedure.
|
||||
void balanceNetwork(DeferredLogger& deferred_logger);
|
||||
|
||||
// TODO: funciton can go to BlackoilWellModelGeneric?
|
||||
bool needRebalanceNetwork() const;
|
||||
|
||||
// used to better efficiency of calcuation
|
||||
mutable BVector scaleAddRes_{};
|
||||
|
||||
|
@ -906,6 +906,30 @@ hasTHPConstraints() const
|
||||
return BlackoilWellModelConstraints(*this).hasTHPConstraints();
|
||||
}
|
||||
|
||||
bool
|
||||
BlackoilWellModelGeneric::
|
||||
needRebalanceNetwork(const int report_step) const
|
||||
{
|
||||
const auto& network = schedule()[report_step].network();
|
||||
if (!network.active()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool network_rebalance_necessary = false;
|
||||
for (const auto& well : well_container_generic_) {
|
||||
const auto& events = this->wellState().well(well->indexOfWell()).events;
|
||||
const bool is_partof_network = network.has_node(well->wellEcl().groupName());
|
||||
// TODO: we might find more relevant events to be included here
|
||||
if (is_partof_network && events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE)) {
|
||||
network_rebalance_necessary = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
network_rebalance_necessary = comm_.max(network_rebalance_necessary);
|
||||
|
||||
return network_rebalance_necessary;
|
||||
}
|
||||
|
||||
bool
|
||||
BlackoilWellModelGeneric::
|
||||
forceShutWellByName(const std::string& wellname,
|
||||
|
@ -158,6 +158,9 @@ public:
|
||||
/// Return true if any well has a THP constraint.
|
||||
bool hasTHPConstraints() const;
|
||||
|
||||
/// Whether it is necessary to re-balance network
|
||||
bool needRebalanceNetwork(const int report_step) const;
|
||||
|
||||
/// Shut down any single well
|
||||
/// Returns true if the well was actually found and shut.
|
||||
bool forceShutWellByName(const std::string& wellname,
|
||||
|
@ -1802,39 +1802,12 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
bool
|
||||
BlackoilWellModel<TypeTag>::
|
||||
needRebalanceNetwork() const
|
||||
{
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
const auto& network = schedule()[reportStepIdx].network();
|
||||
if (!network.active()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool network_rebalance_necessary = false;
|
||||
for (const auto& well : well_container_) {
|
||||
const auto& events = this->wellState().well(well->indexOfWell()).events;
|
||||
const bool is_partof_network = network.has_node(well->wellEcl().groupName());
|
||||
// TODO: we might find more relevant events to be included here
|
||||
if (is_partof_network && events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE)) {
|
||||
network_rebalance_necessary = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
network_rebalance_necessary = comm_.max(network_rebalance_necessary);
|
||||
|
||||
return network_rebalance_necessary;
|
||||
}
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
prepareTimeStep(DeferredLogger& deferred_logger)
|
||||
{
|
||||
const bool network_rebalance_necessary = this->needRebalanceNetwork();
|
||||
const bool network_rebalance_necessary = this->needRebalanceNetwork(ebosSimulator_.episodeIndex());
|
||||
|
||||
for (const auto& well : well_container_) {
|
||||
auto& events = this->wellState().well(well->indexOfWell()).events;
|
||||
|
Loading…
Reference in New Issue
Block a user