mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fixing comments.
no functional change.
This commit is contained in:
parent
4dad47f90d
commit
a8c2626e5a
@ -30,6 +30,7 @@
|
|||||||
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
|
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||||
|
|
||||||
@ -230,21 +231,29 @@ namespace Opm {
|
|||||||
|
|
||||||
using WellMapType = typename WellState::WellMapType;
|
using WellMapType = typename WellState::WellMapType;
|
||||||
|
|
||||||
|
// a tuple type for ratio limit check.
|
||||||
|
// first value indicates whether ratio limit is violated, when the ratio limit is not violated, the following three
|
||||||
|
// values should not be used.
|
||||||
|
// second value indicates whehter there is only one connection left.
|
||||||
|
// third value indicates the indx of the worst-offending connection.
|
||||||
|
// the last value indicates the extent of the violation for the worst-offending connection, which is defined by
|
||||||
|
// the ratio of the actual value to the value of the violated limit.
|
||||||
|
using RatioCheckTuple = std::tuple<bool, bool, int, double>;
|
||||||
|
|
||||||
|
enum ConnectionIndex {
|
||||||
|
INVALIDCONNECTION = -10000
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class WellState>
|
template <class WellState>
|
||||||
bool checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
RatioCheckTuple checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const WellState& well_state,
|
||||||
const typename WellMapType::const_iterator& i_well,
|
const typename WellMapType::const_iterator& i_well) const;
|
||||||
int& worst_offending_connection,
|
|
||||||
bool& last_connection) const;
|
|
||||||
|
|
||||||
template <class WellState>
|
template <class WellState>
|
||||||
bool checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
RatioCheckTuple checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const WellState& well_state,
|
||||||
const typename WellMapType::const_iterator& i_well,
|
const typename WellMapType::const_iterator& i_well) const;
|
||||||
int& worst_offending_connection,
|
|
||||||
double& violation_extent,
|
|
||||||
bool& last_connection) const;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1322,24 +1322,26 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checking for ratio related limits, mostly all kinds of ratio.
|
// checking for ratio related limits, mostly all kinds of ratio.
|
||||||
int worst_offending_connection = -1e4;
|
|
||||||
bool ratio_limits_violated = false;
|
bool ratio_limits_violated = false;
|
||||||
bool last_connection = false;
|
RatioCheckTuple ratio_check_return;
|
||||||
|
|
||||||
if (econ_production_limits.onAnyRatioLimit()) {
|
if (econ_production_limits.onAnyRatioLimit()) {
|
||||||
ratio_limits_violated = checkRatioEconLimits(econ_production_limits, well_state, i_well,
|
ratio_check_return = checkRatioEconLimits(econ_production_limits, well_state, i_well);
|
||||||
worst_offending_connection, last_connection);
|
ratio_limits_violated = std::get<0>(ratio_check_return);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ratio_limits_violated) {
|
if (ratio_limits_violated) {
|
||||||
|
const bool last_connection = std::get<1>(ratio_check_return);
|
||||||
|
const int worst_offending_connection = std::get<2>(ratio_check_return);
|
||||||
|
|
||||||
const int perf_start = (i_well->second)[1];
|
const int perf_start = (i_well->second)[1];
|
||||||
const int perf_number = (i_well->second)[2];
|
|
||||||
assert((worst_offending_connection >= 0) && (worst_offending_connection < perf_number));
|
assert((worst_offending_connection >= 0) && (worst_offending_connection < (i_well->second)[2]));
|
||||||
|
|
||||||
const int cell_worst_offending_connection = wells_struct->well_cells[perf_start + worst_offending_connection];
|
const int cell_worst_offending_connection = wells_struct->well_cells[perf_start + worst_offending_connection];
|
||||||
list_econ_limited.addClosedConnectionsForWell(well_name, cell_worst_offending_connection);
|
list_econ_limited.addClosedConnectionsForWell(well_name, cell_worst_offending_connection);
|
||||||
const std::string msg = std::string("Connection ") + std::to_string(worst_offending_connection) + std::string(" for well ")
|
const std::string msg = std::string("Connection ") + std::to_string(worst_offending_connection) + std::string(" for well ")
|
||||||
+ well_name + std::string(" will be closed due to econic limit");
|
+ well_name + std::string(" will be closed due to economic limit");
|
||||||
OpmLog::info(msg);
|
OpmLog::info(msg);
|
||||||
|
|
||||||
if (last_connection) {
|
if (last_connection) {
|
||||||
@ -1408,39 +1410,35 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
template <class WellState>
|
template <class WellState>
|
||||||
bool
|
StandardWells::RatioCheckTuple
|
||||||
StandardWells::
|
StandardWells::
|
||||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const WellState& well_state,
|
||||||
const typename WellMapType::const_iterator& i_well,
|
const typename WellMapType::const_iterator& i_well) const
|
||||||
int& worst_offending_connection,
|
|
||||||
bool& last_connection) const
|
|
||||||
{
|
{
|
||||||
// TODO: not sure how to define the worst-offending connection when more than one
|
// TODO: not sure how to define the worst-offending connection when more than one
|
||||||
// ratio related limit is violated.
|
// ratio related limit is violated.
|
||||||
// The defintion used here is that we define the violation extent based on the
|
// The defintion used here is that we define the violation extent based on the
|
||||||
// ratio between the value and the corresopoding limit.
|
// ratio between the value and the corresponding limit.
|
||||||
// For each violated limit, we decide the worst-offending connection separately.
|
// For each violated limit, we decide the worst-offending connection separately.
|
||||||
// Among the worst-offending connections, we use the one has the biggest violation
|
// Among the worst-offending connections, we use the one has the biggest violation
|
||||||
// extent.
|
// extent.
|
||||||
|
|
||||||
bool any_limit_violated = false;
|
bool any_limit_violated = false;
|
||||||
double violation_extent = 0.0;
|
bool last_connection = false;
|
||||||
worst_offending_connection = -1;
|
int worst_offending_connection = INVALIDCONNECTION;
|
||||||
last_connection = false;
|
double violation_extent = -1.0;
|
||||||
|
|
||||||
if (econ_production_limits.onMaxWaterCut()) {
|
if (econ_production_limits.onMaxWaterCut()) {
|
||||||
int worst_offending_connection_water_cut = -1;
|
const RatioCheckTuple water_cut_return = checkMaxWaterCutLimit(econ_production_limits, well_state, i_well);
|
||||||
double violation_extent_water_cut = 0.0;
|
bool water_cut_violated = std::get<0>(water_cut_return);
|
||||||
const bool water_cut_violated = checkMaxWaterCutLimit(econ_production_limits, well_state, i_well,
|
|
||||||
worst_offending_connection_water_cut,
|
|
||||||
violation_extent_water_cut,
|
|
||||||
last_connection);
|
|
||||||
if (water_cut_violated) {
|
if (water_cut_violated) {
|
||||||
any_limit_violated = true;
|
any_limit_violated = true;
|
||||||
|
const double violation_extent_water_cut = std::get<3>(water_cut_return);
|
||||||
if (violation_extent_water_cut > violation_extent) {
|
if (violation_extent_water_cut > violation_extent) {
|
||||||
violation_extent = violation_extent_water_cut;
|
violation_extent = violation_extent_water_cut;
|
||||||
worst_offending_connection = worst_offending_connection_water_cut;
|
worst_offending_connection = std::get<2>(water_cut_return);
|
||||||
|
last_connection = std::get<1>(water_cut_return);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1462,7 +1460,7 @@ namespace Opm
|
|||||||
assert(violation_extent > 1.);
|
assert(violation_extent > 1.);
|
||||||
}
|
}
|
||||||
|
|
||||||
return any_limit_violated;
|
return std::make_tuple(any_limit_violated, last_connection, worst_offending_connection, violation_extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1470,18 +1468,16 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
template <class WellState>
|
template <class WellState>
|
||||||
bool
|
StandardWells::RatioCheckTuple
|
||||||
StandardWells::
|
StandardWells::
|
||||||
checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state,
|
const WellState& well_state,
|
||||||
const typename WellMapType::const_iterator& i_well,
|
const typename WellMapType::const_iterator& i_well) const
|
||||||
int& worst_offending_connection,
|
|
||||||
double& violation_extent,
|
|
||||||
bool& last_connection) const
|
|
||||||
{
|
{
|
||||||
bool water_cut_limit_violated = false;
|
bool water_cut_limit_violated = false;
|
||||||
worst_offending_connection = -1;
|
int worst_offending_connection = INVALIDCONNECTION;
|
||||||
violation_extent = -1.0;
|
bool last_connection = false;
|
||||||
|
double violation_extent = -1.0;
|
||||||
|
|
||||||
const int np = well_state.numPhases();
|
const int np = well_state.numPhases();
|
||||||
const Opm::PhaseUsage& pu = fluid_->phaseUsage();
|
const Opm::PhaseUsage& pu = fluid_->phaseUsage();
|
||||||
@ -1523,11 +1519,11 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (perf_number == 1) {
|
last_connection = (perf_number == 1);
|
||||||
last_connection = true;
|
if (last_connection) {
|
||||||
worst_offending_connection = 0;
|
worst_offending_connection = 0;
|
||||||
violation_extent = water_cut_perf[0] / max_water_cut_limit;
|
violation_extent = water_cut_perf[0] / max_water_cut_limit;
|
||||||
return water_cut_limit_violated;
|
return std::make_tuple(water_cut_limit_violated, last_connection, worst_offending_connection, violation_extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
double max_water_cut_perf = 0.;
|
double max_water_cut_perf = 0.;
|
||||||
@ -1544,7 +1540,7 @@ namespace Opm
|
|||||||
violation_extent = max_water_cut_perf / max_water_cut_limit;
|
violation_extent = max_water_cut_perf / max_water_cut_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return water_cut_limit_violated;
|
return std::make_tuple(water_cut_limit_violated, last_connection, worst_offending_connection, violation_extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user