Skip to content

Commit e6ea039

Browse files
committed
BlackoilWellModel: let network class handle wellTesting update
1 parent 3f228cf commit e6ea039

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

opm/simulators/wells/BlackoilWellModelNetworkGeneric.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,24 @@ initialize(const int report_step)
266266
const auto& network = well_model_.schedule()[report_step].network();
267267
if (network.active() && !node_pressures_.empty()) {
268268
for (auto& well : well_model_.genericWells()) {
269-
// Producers only, since we so far only support the
270-
// "extended" network model (properties defined by
271-
// BRANPROP and NODEPROP) which only applies to producers.
272-
if (well->isProducer()) {
273-
const auto it = this->node_pressures_.find(well->wellEcl().groupName());
274-
if (it != this->node_pressures_.end()) {
275-
// The well belongs to a group which has a network nodal pressure,
276-
// set the dynamic THP constraint based on the network nodal pressure
277-
const Scalar nodal_pressure = it->second;
278-
well->setDynamicThpLimit(nodal_pressure);
279-
}
280-
}
269+
initializeWell(*well);
270+
}
271+
}
272+
}
273+
274+
template<typename Scalar, typename IndexTraits>
275+
void BlackoilWellModelNetworkGeneric<Scalar, IndexTraits>::
276+
initializeWell(WellInterfaceGeneric<Scalar,IndexTraits>& well)
277+
{
278+
// Producers only, since we so far only support the
279+
// "extended" network model (properties defined by
280+
// BRANPROP and NODEPROP) which only applies to producers.
281+
if (well.isProducer() && !node_pressures_.empty()) {
282+
const auto it = this->node_pressures_.find(well.wellEcl().groupName());
283+
if (it != this->node_pressures_.end()) {
284+
// The well belongs to a group which has a network nodal pressure,
285+
// set the dynamic THP constraint based on the network nodal pressure
286+
well.setDynamicThpLimit(it->second);
281287
}
282288
}
283289
}

opm/simulators/wells/BlackoilWellModelNetworkGeneric.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace Opm {
3434
class Schedule;
3535
template<class Scalar, class IndexTraits> class BlackoilWellModelGeneric;
3636
template<typename Scalar, typename IndexTraits> class WellGroupHelpers;
37+
template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
3738
}
3839

3940
namespace Opm {
@@ -65,6 +66,9 @@ class BlackoilWellModelNetworkGeneric
6566
//! \brief Initialize wells according to network configuration.
6667
void initialize(const int report_step);
6768

69+
//! \brief Initialize a single well according to network configuration.
70+
void initializeWell(WellInterfaceGeneric<Scalar,IndexTraits>& well);
71+
6872
/// Checks if network is active (at least one network well on prediction).
6973
void updateActiveState(const int report_step);
7074

opm/simulators/wells/BlackoilWellModel_impl.hpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,8 @@ namespace Opm {
575575
}
576576

577577
const auto& network = this->schedule()[timeStepIdx].network();
578-
const auto& node_pressures = this->network_.nodePressures();
579-
if (network.active() && !node_pressures.empty()) {
580-
if (well->isProducer()) {
581-
const auto it = node_pressures.find(well->wellEcl().groupName());
582-
if (it != node_pressures.end()) {
583-
// The well belongs to a group which has a network nodal pressure,
584-
// set the dynamic THP constraint based on the network nodal pressure
585-
const Scalar nodal_pressure = it->second;
586-
well->setDynamicThpLimit(nodal_pressure);
587-
}
588-
}
578+
if (network.active()) {
579+
this->network_.initializeWell(*well);
589580
}
590581
try {
591582
using GLiftEclWells = typename GasLiftGroupInfo<Scalar, IndexTraits>::GLiftEclWells;

0 commit comments

Comments
 (0)