mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fixup from PR comments
This commit is contained in:
@@ -50,6 +50,7 @@ namespace Opm
|
||||
min_linear_iterations ( std::numeric_limits<unsigned int>::max() ),
|
||||
max_linear_iterations ( 0 ),
|
||||
converged(false),
|
||||
well_group_control_changed(false),
|
||||
exit_status(EXIT_SUCCESS),
|
||||
global_time(0),
|
||||
timestep_length(0.0)
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Opm
|
||||
|
||||
|
||||
bool converged;
|
||||
bool well_group_control_changed;
|
||||
int exit_status;
|
||||
|
||||
double global_time;
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace Opm {
|
||||
void applyScaleAdd(const Scalar alpha, const BVector& x, BVector& Ax) const;
|
||||
|
||||
// Check if well equations is converged.
|
||||
ConvergenceReport getWellConvergence(const std::vector<Scalar>& B_avg, const bool checkWellGroupControls = false);
|
||||
ConvergenceReport getWellConvergence(const std::vector<Scalar>& B_avg, const bool checkWellGroupControls = false) const;
|
||||
|
||||
const SimulatorReportSingle& lastReport() const;
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace Opm {
|
||||
// and in the well equations.
|
||||
void assemble(const int iterationIdx,
|
||||
const double dt);
|
||||
void assembleImpl(const int iterationIdx,
|
||||
bool assembleImpl(const int iterationIdx,
|
||||
const double dt,
|
||||
const std::size_t recursion_level,
|
||||
DeferredLogger& local_deferredLogger);
|
||||
|
||||
@@ -880,9 +880,11 @@ namespace Opm {
|
||||
terminal_output_, grid().comm());
|
||||
}
|
||||
|
||||
assembleImpl(iterationIdx, dt, 0, local_deferredLogger);
|
||||
const bool well_group_control_changed = assembleImpl(iterationIdx, dt, 0, local_deferredLogger);
|
||||
|
||||
last_report_.converged = true;
|
||||
// if group or well control changes we don't consider the
|
||||
// case converged
|
||||
last_report_.well_group_control_changed = well_group_control_changed;
|
||||
last_report_.assemble_time_well += perfTimer.stop();
|
||||
}
|
||||
|
||||
@@ -891,7 +893,7 @@ namespace Opm {
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
bool
|
||||
BlackoilWellModel<TypeTag>::
|
||||
assembleImpl(const int iterationIdx,
|
||||
const double dt,
|
||||
@@ -899,7 +901,7 @@ namespace Opm {
|
||||
DeferredLogger& local_deferredLogger)
|
||||
{
|
||||
|
||||
const auto [group_well_changed, network_changed, network_imbalance] = updateWellControls(local_deferredLogger);
|
||||
auto [well_group_control_changed, network_changed, network_imbalance] = updateWellControls(local_deferredLogger);
|
||||
|
||||
bool alq_updated = false;
|
||||
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
||||
@@ -931,10 +933,11 @@ namespace Opm {
|
||||
const auto& balance = schedule()[reportStepIdx].network_balance();
|
||||
// Iterate if not converged, and number of iterations is not yet max (NETBALAN item 3).
|
||||
if (recursion_level < balance.pressure_max_iter() && network_imbalance > balance.pressure_tolerance()) {
|
||||
assembleImpl(iterationIdx, dt, recursion_level + 1, local_deferredLogger);
|
||||
well_group_control_changed = assembleImpl(iterationIdx, dt, recursion_level + 1, local_deferredLogger);
|
||||
}
|
||||
}
|
||||
}
|
||||
return well_group_control_changed;
|
||||
}
|
||||
|
||||
|
||||
@@ -1389,7 +1392,7 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
ConvergenceReport
|
||||
BlackoilWellModel<TypeTag>::
|
||||
getWellConvergence(const std::vector<Scalar>& B_avg, bool checkWellGroupControls)
|
||||
getWellConvergence(const std::vector<Scalar>& B_avg, bool checkWellGroupControls) const
|
||||
{
|
||||
|
||||
DeferredLogger local_deferredLogger;
|
||||
@@ -1409,14 +1412,13 @@ namespace Opm {
|
||||
|
||||
const Opm::Parallel::Communication comm = grid().comm();
|
||||
DeferredLogger global_deferredLogger = gatherDeferredLogger(local_deferredLogger, comm);
|
||||
|
||||
|
||||
ConvergenceReport report = gatherConvergenceReport(local_report, comm);
|
||||
|
||||
if (report.converged() && checkWellGroupControls) {
|
||||
const auto [group_well_changed, network_changed, network_imbalance] = updateWellControls(global_deferredLogger);
|
||||
report.setWellGroupTargetsViolated(group_well_changed);
|
||||
// the well_group_control_changed info is already communicated
|
||||
if (checkWellGroupControls) {
|
||||
report.setWellGroupTargetsViolated(this->lastReport().well_group_control_changed);
|
||||
}
|
||||
|
||||
if (terminal_output_) {
|
||||
global_deferredLogger.logMessages();
|
||||
}
|
||||
|
||||
@@ -1363,10 +1363,10 @@ updateThp(WellState& well_state,
|
||||
ws.thp = 0;
|
||||
return;
|
||||
}
|
||||
// For THP controled wells, we know the thp value
|
||||
bool thp_controled = baseif_.isInjector() ? ws.injection_cmode == Well::InjectorCMode::THP:
|
||||
// For THP controlled wells, we know the thp value
|
||||
bool thp_controlled = baseif_.isInjector() ? ws.injection_cmode == Well::InjectorCMode::THP:
|
||||
ws.production_cmode == Well::ProducerCMode::THP;
|
||||
if (thp_controled) {
|
||||
if (thp_controlled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -573,14 +573,13 @@ updateThp(WellState& well_state,
|
||||
return;
|
||||
}
|
||||
|
||||
// For THP controled wells, we know the thp value
|
||||
bool thp_controled = baseif_.isInjector() ? ws.injection_cmode == Well::InjectorCMode::THP:
|
||||
// For THP controlled wells, we know the thp value
|
||||
bool thp_controlled = baseif_.isInjector() ? ws.injection_cmode == Well::InjectorCMode::THP:
|
||||
ws.production_cmode == Well::ProducerCMode::THP;
|
||||
if (thp_controled) {
|
||||
if (thp_controlled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// the well is under other control types, we calculate the thp based on bhp and rates
|
||||
std::vector<double> rates(3, 0.0);
|
||||
|
||||
|
||||
@@ -710,15 +710,15 @@ namespace Opm
|
||||
{
|
||||
this->operability_status_.resetOperability();
|
||||
|
||||
bool thp_controled = this->isInjector() ? well_state.well(this->index_of_well_).injection_cmode == Well::InjectorCMode::THP:
|
||||
bool thp_controlled = this->isInjector() ? well_state.well(this->index_of_well_).injection_cmode == Well::InjectorCMode::THP:
|
||||
well_state.well(this->index_of_well_).production_cmode == Well::ProducerCMode::THP;
|
||||
bool bhp_controled = this->isInjector() ? well_state.well(this->index_of_well_).injection_cmode == Well::InjectorCMode::BHP:
|
||||
bool bhp_controlled = this->isInjector() ? well_state.well(this->index_of_well_).injection_cmode == Well::InjectorCMode::BHP:
|
||||
well_state.well(this->index_of_well_).production_cmode == Well::ProducerCMode::BHP;
|
||||
|
||||
// Operability checking is not free
|
||||
// Only check wells under BHP and THP control
|
||||
bool check_thp = thp_controled || this->operability_status_.thp_limit_violated_but_not_switched;
|
||||
if (check_thp || bhp_controled) {
|
||||
bool check_thp = thp_controlled || this->operability_status_.thp_limit_violated_but_not_switched;
|
||||
if (check_thp || bhp_controlled) {
|
||||
updateIPR(ebos_simulator, deferred_logger);
|
||||
checkOperabilityUnderBHPLimit(well_state, ebos_simulator, deferred_logger);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user