mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
not using spres_lower_limit limit non-top segments
with multi-segments, the segment pressure can be lower than the bhp, so it is not desirable to use spres_lower_limit to limit the segment pressure. We only use spres_lower_limit to limit the bhp, which is still valid until we begin using bhp limit lower than 1 bar.
This commit is contained in:
parent
c7e7204727
commit
f7ad5cb211
@ -40,6 +40,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template<class FluidSystem, class Indices, class Scalar>
|
||||
@ -157,7 +159,8 @@ updateNewton(const BVectorWell& dwells,
|
||||
const double relaxation_factor,
|
||||
const double dFLimit,
|
||||
const bool stop_or_zero_rate_target,
|
||||
const double max_pressure_change)
|
||||
const double max_pressure_change,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
const std::vector<std::array<double, numWellEq>> old_primary_variables = value_;
|
||||
|
||||
@ -183,10 +186,21 @@ updateNewton(const BVectorWell& dwells,
|
||||
const double dx_limited = sign * std::min(std::abs(dwells[seg][SPres]) * relaxation_factor, max_pressure_change);
|
||||
// some cases might have defaulted bhp constraint of 1 bar, we use a slightly smaller value as the bhp lower limit for Newton update
|
||||
// so that bhp constaint can be an active control when needed.
|
||||
// TODO: we might need to distinguish SPres of the top segment from the SPres of the other segments, since only the top segment
|
||||
// is involved in the well constraints/control checking
|
||||
constexpr double spres_lower_limit = 1. * unit::barsa - 1. * unit::Pascal;
|
||||
value_[seg][SPres] = std::max(old_primary_variables[seg][SPres] - dx_limited, spres_lower_limit);
|
||||
if (seg == 0) { // top segment pressure is the bhp
|
||||
constexpr double bhp_lower_limit = 1. * unit::barsa - 1. * unit::Pascal;
|
||||
value_[seg][SPres] = std::max(old_primary_variables[seg][SPres] - dx_limited, bhp_lower_limit);
|
||||
} else {
|
||||
// enforcing 0. as the lower limit for the segment pressure of other segment
|
||||
const double newton_update_value = old_primary_variables[seg][SPres] - dx_limited;
|
||||
if (newton_update_value >= 0.) {
|
||||
value_[seg][SPres] = newton_update_value;
|
||||
} else {
|
||||
const std::string msg = fmt::format("Segment with location index {} of well {} trying to acheive negative segment pressure {} bar"
|
||||
" during the newton update, it will be chopped to 0.", seg, this->well_.name(), newton_update_value / unit::barsa);
|
||||
deferred_logger.debug(msg);
|
||||
value_[seg][SPres] = std::max(newton_update_value, 0.);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the total rate // TODO: should we have a limitation of the total rate change?
|
||||
@ -257,7 +271,7 @@ copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
if (scale > 0.) {
|
||||
fractions[p] /= scale;
|
||||
} else {
|
||||
// this should only happens to injection wells
|
||||
// this should only happen to injection wells
|
||||
fractions[p] = 0.;
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ public:
|
||||
const double relaxation_factor,
|
||||
const double DFLimit,
|
||||
const bool stop_or_zero_rate_target,
|
||||
const double max_pressure_change);
|
||||
const double max_pressure_change,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
//! \brief Copy values to well state.
|
||||
void copyToWellState(const MultisegmentWellGeneric<Scalar>& mswell,
|
||||
|
@ -689,7 +689,8 @@ namespace Opm
|
||||
relaxation_factor,
|
||||
dFLimit,
|
||||
stop_or_zero_rate_target,
|
||||
max_pressure_change);
|
||||
max_pressure_change,
|
||||
deferred_logger);
|
||||
|
||||
this->primary_variables_.copyToWellState(*this, getRefDensity(), stop_or_zero_rate_target,
|
||||
well_state, summary_state, deferred_logger);
|
||||
|
Loading…
Reference in New Issue
Block a user