BlackoilWellModel: move updateNetworkPressures to generic class

This commit is contained in:
Arne Morten Kvarving
2021-06-07 12:20:49 +02:00
parent 172d344ab2
commit 811afb854b
4 changed files with 38 additions and 36 deletions

View File

@@ -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);

View File

@@ -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);
}
}
}
}
}

View File

@@ -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.
/*

View File

@@ -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>::