when a well is in a network node with nodal pressure

setting the dynamic thp limit with the the nodal pressure.
This commit is contained in:
Kai Bao 2023-04-20 22:46:38 +02:00
parent e4c15531a8
commit 0f4da07aaf
2 changed files with 27 additions and 2 deletions

View File

@ -1238,6 +1238,12 @@ bool
BlackoilWellModelGeneric::
shouldBalanceNetwork(const int reportStepIdx, const int iterationIdx) const
{
// if network is not active, we do not need to balance the network
const auto& network = schedule()[reportStepIdx].network();
if (!network.active()) {
return false;
}
const auto& balance = schedule()[reportStepIdx].network_balance();
if (balance.mode() == Network::Balance::CalcMode::TimeStepStart) {
return iterationIdx == 0;

View File

@ -25,12 +25,13 @@
#include <opm/grid/utility/cartesianToCompressed.hpp>
#include <opm/input/eclipse/Units/UnitSystem.hpp>
#include <opm/input/eclipse/Schedule/Network/Balance.hpp>
#include <opm/input/eclipse/Schedule/Network/ExtNetwork.hpp>
#include <opm/simulators/wells/BlackoilWellModelConstraints.hpp>
#include <opm/simulators/wells/VFPProperties.hpp>
#include <opm/simulators/utils/MPIPacker.hpp>
#include <opm/simulators/linalg/bda/WellContributions.hpp>
#include <opm/input/eclipse/Schedule/Network/Balance.hpp>
#if HAVE_MPI
#include <ebos/eclmpiserializer.hh>
@ -746,7 +747,25 @@ namespace Opm {
well_container_generic_.clear();
for (auto& w : well_container_)
well_container_generic_.push_back(w.get());
well_container_generic_.push_back(w.get());
const auto& network = schedule()[time_step].network();
if (network.active() && !this->node_pressures_.empty()) {
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 which has a network nodal pressure,
// set the dynamic THP constraint based on the network nodal pressure
const double nodal_pressure = it->second;
well->setDynamicThpLimit(nodal_pressure);
}
}
}
}
}