mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-11 05:25:37 -06:00
Let reported pressures (GPR) respect the NETBALAN configuration
This commit is contained in:
parent
389db91839
commit
77bb7aa9cf
@ -214,7 +214,6 @@ namespace Opm {
|
||||
|
||||
void endTimeStep()
|
||||
{
|
||||
updateNetworkPressures(ebosSimulator_.episodeIndex(), true);
|
||||
OPM_TIMEBLOCK(endTimeStep);
|
||||
timeStepSucceeded(ebosSimulator_.time(), ebosSimulator_.timeStepSize());
|
||||
}
|
||||
|
@ -1010,8 +1010,6 @@ bool
|
||||
BlackoilWellModelGeneric::
|
||||
needPreStepNetworkRebalance(const int report_step) const
|
||||
{
|
||||
assert(this->networkActive());
|
||||
|
||||
const auto& network = schedule()[report_step].network();
|
||||
bool network_rebalance_necessary = false;
|
||||
for (const auto& well : well_container_generic_) {
|
||||
@ -1082,9 +1080,9 @@ inferLocalShutWells()
|
||||
|
||||
double
|
||||
BlackoilWellModelGeneric::
|
||||
updateNetworkPressures(const int reportStepIdx, const bool compute_only)
|
||||
updateNetworkPressures(const int reportStepIdx)
|
||||
{
|
||||
// Get the network and return if inactive.
|
||||
// Get the network and return if inactive (no wells in network at this time)
|
||||
const auto& network = schedule()[reportStepIdx].network();
|
||||
if (!network.active()) {
|
||||
return 0.0;
|
||||
@ -1101,7 +1099,7 @@ updateNetworkPressures(const int reportStepIdx, const bool compute_only)
|
||||
|
||||
// here, the network imbalance is the difference between the previous nodal pressure and the new nodal pressure
|
||||
double network_imbalance = 0.;
|
||||
if (compute_only)
|
||||
if (!this->networkActive())
|
||||
return network_imbalance;
|
||||
|
||||
if (!previous_node_pressures.empty()) {
|
||||
@ -1138,7 +1136,7 @@ updateNetworkPressures(const int reportStepIdx, const bool compute_only)
|
||||
// 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()) {
|
||||
if (well->isProducer() && well->wellEcl().predictionMode()) {
|
||||
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,
|
||||
@ -1394,10 +1392,6 @@ bool
|
||||
BlackoilWellModelGeneric::
|
||||
shouldBalanceNetwork(const int reportStepIdx, const int iterationIdx) const
|
||||
{
|
||||
// If the network is not active now, we do not need to balance it.
|
||||
if (!this->networkActive())
|
||||
return false;
|
||||
|
||||
const auto& balance = schedule()[reportStepIdx].network_balance();
|
||||
if (balance.mode() == Network::Balance::CalcMode::TimeStepStart) {
|
||||
return iterationIdx == 0;
|
||||
|
@ -328,7 +328,7 @@ protected:
|
||||
|
||||
bool wasDynamicallyShutThisTimeStep(const int well_index) const;
|
||||
|
||||
double updateNetworkPressures(const int reportStepIdx, const bool compute_only = false);
|
||||
double updateNetworkPressures(const int reportStepIdx);
|
||||
|
||||
void updateWsolvent(const Group& group,
|
||||
const int reportStepIdx,
|
||||
|
@ -1010,7 +1010,7 @@ namespace Opm {
|
||||
const double dt = this->ebosSimulator_.timeStepSize();
|
||||
// TODO: should we also have the group and network backed-up here in case the solution did not get converged?
|
||||
auto& well_state = this->wellState();
|
||||
constexpr std::size_t max_iter = 100;
|
||||
const std::size_t max_iter = param_.network_max_iterations_;
|
||||
bool converged = false;
|
||||
std::size_t iter = 0;
|
||||
bool changed_well_group = false;
|
||||
@ -1030,11 +1030,11 @@ namespace Opm {
|
||||
} while (iter < max_iter);
|
||||
|
||||
if (!converged) {
|
||||
const std::string msg = fmt::format("balanceNetwork did not get converged with {} iterations, and unconverged "
|
||||
"network balance result will be used", max_iter);
|
||||
const std::string msg = fmt::format("Initial (pre-step) network balance did not get converged with {} iterations, "
|
||||
"unconverged network balance result will be used", max_iter);
|
||||
deferred_logger.warning(msg);
|
||||
} else {
|
||||
const std::string msg = fmt::format("balanceNetwork get converged with {} iterations", iter);
|
||||
const std::string msg = fmt::format("Initial (pre-step) network balance converged with {} iterations", iter);
|
||||
deferred_logger.debug(msg);
|
||||
}
|
||||
}
|
||||
@ -2245,8 +2245,7 @@ namespace Opm {
|
||||
|
||||
// Rebalance the network initially if any wells in the network have status changes
|
||||
// (Need to check this before clearing events)
|
||||
bool do_prestep_network_rebalance{false};
|
||||
if (this->networkActive()) do_prestep_network_rebalance = this->needPreStepNetworkRebalance(episodeIdx);
|
||||
const bool do_prestep_network_rebalance = this->needPreStepNetworkRebalance(episodeIdx);
|
||||
|
||||
for (const auto& well : well_container_) {
|
||||
auto& events = this->wellState().well(well->indexOfWell()).events;
|
||||
|
Loading…
Reference in New Issue
Block a user