mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
BlackoilWellModel: move updateNetworkPressures to generic class
This commit is contained in:
@@ -314,7 +314,6 @@ namespace Opm {
|
||||
std::optional<int> last_run_wellpi_{};
|
||||
|
||||
std::unique_ptr<RateConverterType> rateConverter_{};
|
||||
std::unique_ptr<VFPProperties> vfp_properties_{};
|
||||
|
||||
SimulatorReportSingle last_report_{};
|
||||
|
||||
@@ -348,8 +347,6 @@ namespace Opm {
|
||||
// xw to update Well State
|
||||
void recoverWellSolutionAndUpdateWellState(const BVector& x);
|
||||
|
||||
void updateNetworkPressures();
|
||||
|
||||
// setting the well_solutions_ based on well_state.
|
||||
void updatePrimaryVariables(DeferredLogger& deferred_logger);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <opm/simulators/utils/DeferredLogger.hpp>
|
||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||
#include <opm/simulators/wells/VFPProperties.hpp>
|
||||
#include <opm/simulators/wells/WellGroupHelpers.hpp>
|
||||
#include <opm/simulators/wells/WellState.hpp>
|
||||
|
||||
@@ -1572,4 +1573,36 @@ inferLocalShutWells()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BlackoilWellModelGeneric::
|
||||
updateNetworkPressures(const int reportStepIdx)
|
||||
{
|
||||
// Get the network and return if inactive.
|
||||
const auto& network = schedule()[reportStepIdx].network();
|
||||
if (!network.active()) {
|
||||
return;
|
||||
}
|
||||
node_pressures_ = WellGroupHelpers::computeNetworkPressures(network,
|
||||
this->wellState(),
|
||||
this->groupState(),
|
||||
*(vfp_properties_->getProd()),
|
||||
schedule(),
|
||||
reportStepIdx);
|
||||
|
||||
// Set the thp limits of wells
|
||||
for (auto& well : well_container_generic_) {
|
||||
// Producers only, since we so far only support the
|
||||
// "extended" network model (properties defined by
|
||||
// BRANPROP and NODEPROP) which only applies to producers.
|
||||
if (well->isProducer()) {
|
||||
const auto it = node_pressures_.find(well->wellEcl().groupName());
|
||||
if (it != node_pressures_.end()) {
|
||||
// The well belongs to a group with has a network pressure constraint,
|
||||
// set the dynamic THP constraint of the well accordingly.
|
||||
well->setDynamicThpLimit(it->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ class EclipseState;
|
||||
class Group;
|
||||
class RestartValue;
|
||||
class Schedule;
|
||||
class VFPProperties;
|
||||
class WellState;
|
||||
|
||||
/// Class for handling the blackoil well model.
|
||||
@@ -234,6 +235,8 @@ protected:
|
||||
|
||||
bool wasDynamicallyShutThisTimeStep(const int well_index) const;
|
||||
|
||||
void updateNetworkPressures(const int reportStepIdx);
|
||||
|
||||
void updateWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellState);
|
||||
@@ -352,6 +355,7 @@ protected:
|
||||
|
||||
WellTestState wellTestState_{};
|
||||
std::unique_ptr<GuideRate> guideRate_;
|
||||
std::unique_ptr<VFPProperties> vfp_properties_{};
|
||||
std::map<std::string, double> node_pressures_; // Storing network pressures for output.
|
||||
|
||||
/*
|
||||
|
||||
@@ -1132,7 +1132,7 @@ namespace Opm {
|
||||
const int iterationIdx = ebosSimulator_.model().newtonMethod().numIterations();
|
||||
updateAndCommunicateGroupData(episodeIdx, iterationIdx);
|
||||
|
||||
updateNetworkPressures();
|
||||
updateNetworkPressures(episodeIdx);
|
||||
|
||||
std::set<std::string> switched_wells;
|
||||
std::set<std::string> switched_groups;
|
||||
@@ -1174,38 +1174,6 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updateNetworkPressures()
|
||||
{
|
||||
// Get the network and return if inactive.
|
||||
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||
const auto& network = schedule()[reportStepIdx].network();
|
||||
if (!network.active()) {
|
||||
return;
|
||||
}
|
||||
node_pressures_ = WellGroupHelpers::computeNetworkPressures(network, this->wellState(), this->groupState(), *(vfp_properties_->getProd()), schedule(), reportStepIdx);
|
||||
|
||||
// Set the thp limits of wells
|
||||
for (auto& well : well_container_) {
|
||||
// Producers only, since we so far only support the
|
||||
// "extended" network model (properties defined by
|
||||
// BRANPROP and NODEPROP) which only applies to producers.
|
||||
if (well->isProducer()) {
|
||||
const auto it = node_pressures_.find(well->wellEcl().groupName());
|
||||
if (it != node_pressures_.end()) {
|
||||
// The well belongs to a group with has a network pressure constraint,
|
||||
// set the dynamic THP constraint of the well accordingly.
|
||||
well->setDynamicThpLimit(it->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
|
||||
Reference in New Issue
Block a user