mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-28 16:14:25 -06:00
Name completion and connection consistently
This commit is contained in:
parent
834f680587
commit
d769e7649a
@ -346,8 +346,8 @@ namespace Opm {
|
||||
/// return true if wells are available on this process
|
||||
bool localWellsActive() const;
|
||||
|
||||
/// upate the dynamic lists related to economic limits
|
||||
void updateListEconLimited(const double& simulationTime, WellTestState& wellTestState) const;
|
||||
/// upate the wellTestState related to economic limits
|
||||
void updateWellTestState(const double& simulationTime, WellTestState& wellTestState) const;
|
||||
|
||||
void updatePerforationIntensiveQuantities();
|
||||
|
||||
|
@ -167,7 +167,7 @@ namespace Opm {
|
||||
well->setVFPProperties(vfp_properties_.get());
|
||||
}
|
||||
|
||||
// Close wells and connections due to economical reasons
|
||||
// Close wells and completions due to economical reasons
|
||||
for (auto& well : well_container_) {
|
||||
well->closeWellsAndCompletions(wellTestState_);
|
||||
}
|
||||
@ -250,7 +250,7 @@ namespace Opm {
|
||||
while (testWell) {
|
||||
size_t numberOfClosedCompletions = wellTestStateForTheWellTest.sizeCompletions();
|
||||
well->solveWellEq(ebosSimulator_, wellStateCopy, /*dt (not relevant for well test) =*/ 1.0, B_avg, terminal_output_);
|
||||
well->updateListEconLimited(wellStateCopy, simulationTime, wellTestStateForTheWellTest, /*writeMessageToOPMLog=*/ false);
|
||||
well->updateWellTestState(wellStateCopy, simulationTime, wellTestStateForTheWellTest, /*writeMessageToOPMLog=*/ false);
|
||||
well->closeWellsAndCompletions(wellTestStateForTheWellTest);
|
||||
|
||||
// test completions individually.
|
||||
@ -302,7 +302,7 @@ namespace Opm {
|
||||
for (const auto& well : well_container_) {
|
||||
well->calculateReservoirRates(well_state_);
|
||||
}
|
||||
updateListEconLimited(simulationTime, wellTestState_);
|
||||
updateWellTestState(simulationTime, wellTestState_);
|
||||
previous_well_state_ = well_state_;
|
||||
}
|
||||
|
||||
@ -755,10 +755,10 @@ namespace Opm {
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
updateListEconLimited(const double& simulationTime, WellTestState& wellTestState) const
|
||||
updateWellTestState(const double& simulationTime, WellTestState& wellTestState) const
|
||||
{
|
||||
for (const auto& well : well_container_) {
|
||||
well->updateListEconLimited(well_state_, simulationTime, wellTestState, /*writeMessageToOPMLog=*/ true);
|
||||
well->updateWellTestState(well_state_, simulationTime, wellTestState, /*writeMessageToOPMLog=*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,10 +177,10 @@ namespace Opm
|
||||
WellState& well_state,
|
||||
bool only_wells) = 0;
|
||||
|
||||
void updateListEconLimited(const WellState& well_state,
|
||||
const double& simulationTime,
|
||||
WellTestState& wellTestState,
|
||||
const bool& writeMessageToOPMLog) const;
|
||||
void updateWellTestState(const WellState& well_state,
|
||||
const double& simulationTime,
|
||||
WellTestState& wellTestState,
|
||||
const bool& writeMessageToOPMLog) const;
|
||||
|
||||
void setWellEfficiencyFactor(const double efficiency_factor);
|
||||
|
||||
@ -234,8 +234,8 @@ namespace Opm
|
||||
|
||||
protected:
|
||||
|
||||
// to indicate a invalid connection
|
||||
static const int INVALIDCONNECTION = -100000;
|
||||
// to indicate a invalid completion
|
||||
static const int INVALIDCOMPLETION = 0;
|
||||
|
||||
const Well* well_ecl_;
|
||||
|
||||
@ -332,13 +332,12 @@ namespace Opm
|
||||
double mostStrictBhpFromBhpLimits() const;
|
||||
|
||||
// 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
|
||||
// first value indicates whether ratio limit is violated, when the ratio limit is not violated, the following two
|
||||
// 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
|
||||
// second value indicates the index of the worst-offending completion.
|
||||
// the last value indicates the extent of the violation for the worst-offending completion, 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>;
|
||||
using RatioCheckTuple = std::tuple<bool, int, double>;
|
||||
|
||||
RatioCheckTuple checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const WellState& well_state) const;
|
||||
|
@ -494,8 +494,7 @@ namespace Opm
|
||||
const WellState& well_state) const
|
||||
{
|
||||
bool water_cut_limit_violated = false;
|
||||
int worst_offending_connection = INVALIDCONNECTION;
|
||||
bool last_connection = false;
|
||||
int worst_offending_completion = INVALIDCOMPLETION;
|
||||
double violation_extent = -1.0;
|
||||
|
||||
const int np = number_of_phases_;
|
||||
@ -552,24 +551,22 @@ namespace Opm
|
||||
complnumIdx++;
|
||||
}
|
||||
|
||||
last_connection = false;
|
||||
|
||||
double max_water_cut_perf = 0.;
|
||||
complnumIdx = 0;
|
||||
for (const auto& completion : completions) {
|
||||
if (water_cut_in_completions[complnumIdx] > max_water_cut_perf) {
|
||||
worst_offending_connection = completion.first;
|
||||
worst_offending_completion = completion.first;
|
||||
max_water_cut_perf = water_cut_in_completions[complnumIdx];
|
||||
}
|
||||
complnumIdx++;
|
||||
}
|
||||
|
||||
assert(max_water_cut_limit != 0.);
|
||||
|
||||
assert(worst_offending_completion != INVALIDCOMPLETION);
|
||||
violation_extent = max_water_cut_perf / max_water_cut_limit;
|
||||
}
|
||||
|
||||
return std::make_tuple(water_cut_limit_violated, last_connection, worst_offending_connection, violation_extent);
|
||||
return std::make_tuple(water_cut_limit_violated, worst_offending_completion, violation_extent);
|
||||
}
|
||||
|
||||
|
||||
@ -582,17 +579,16 @@ namespace Opm
|
||||
checkRatioEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||
const WellState& well_state) const
|
||||
{
|
||||
// TODO: not sure how to define the worst-offending connection when more than one
|
||||
// TODO: not sure how to define the worst-offending completion when more than one
|
||||
// ratio related limit is violated.
|
||||
// The defintion used here is that we define the violation extent based on the
|
||||
// ratio between the value and the corresponding limit.
|
||||
// For each violated limit, we decide the worst-offending connection separately.
|
||||
// Among the worst-offending connections, we use the one has the biggest violation
|
||||
// For each violated limit, we decide the worst-offending completion separately.
|
||||
// Among the worst-offending completions, we use the one has the biggest violation
|
||||
// extent.
|
||||
|
||||
bool any_limit_violated = false;
|
||||
bool last_connection = false;
|
||||
int worst_offending_connection = INVALIDCONNECTION;
|
||||
int worst_offending_completion = INVALIDCOMPLETION;
|
||||
double violation_extent = -1.0;
|
||||
|
||||
if (econ_production_limits.onMaxWaterCut()) {
|
||||
@ -600,11 +596,10 @@ namespace Opm
|
||||
bool water_cut_violated = std::get<0>(water_cut_return);
|
||||
if (water_cut_violated) {
|
||||
any_limit_violated = true;
|
||||
const double violation_extent_water_cut = std::get<3>(water_cut_return);
|
||||
const double violation_extent_water_cut = std::get<2>(water_cut_return);
|
||||
if (violation_extent_water_cut > violation_extent) {
|
||||
violation_extent = violation_extent_water_cut;
|
||||
worst_offending_connection = std::get<2>(water_cut_return);
|
||||
last_connection = std::get<1>(water_cut_return);
|
||||
worst_offending_completion = std::get<1>(water_cut_return);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -622,11 +617,11 @@ namespace Opm
|
||||
}
|
||||
|
||||
if (any_limit_violated) {
|
||||
assert(worst_offending_connection >=0);
|
||||
assert(worst_offending_completion != INVALIDCOMPLETION);
|
||||
assert(violation_extent > 1.);
|
||||
}
|
||||
|
||||
return std::make_tuple(any_limit_violated, last_connection, worst_offending_connection, violation_extent);
|
||||
return std::make_tuple(any_limit_violated, worst_offending_completion, violation_extent);
|
||||
}
|
||||
|
||||
|
||||
@ -636,10 +631,10 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updateListEconLimited(const WellState& well_state,
|
||||
const double& simulationTime,
|
||||
WellTestState& wellTestState,
|
||||
const bool& writeMessageToOPMLog) const
|
||||
updateWellTestState(const WellState& well_state,
|
||||
const double& simulationTime,
|
||||
WellTestState& wellTestState,
|
||||
const bool& writeMessageToOPMLog) const
|
||||
{
|
||||
// economic limits only apply for production wells.
|
||||
if (wellType() != PRODUCER) {
|
||||
@ -709,16 +704,16 @@ namespace Opm
|
||||
switch (workover) {
|
||||
case WellEcon::CON:
|
||||
{
|
||||
const int worst_offending_connection = std::get<2>(ratio_check_return);
|
||||
const int worst_offending_completion = std::get<1>(ratio_check_return);
|
||||
|
||||
wellTestState.addClosedCompletion(well_name, worst_offending_connection, simulationTime);
|
||||
wellTestState.addClosedCompletion(well_name, worst_offending_completion, simulationTime);
|
||||
if (writeMessageToOPMLog) {
|
||||
if (worst_offending_connection < 0) {
|
||||
const std::string msg = std::string("Connection ") + std::to_string(- worst_offending_connection) + std::string(" for well ")
|
||||
if (worst_offending_completion < 0) {
|
||||
const std::string msg = std::string("Connection ") + std::to_string(- worst_offending_completion) + std::string(" for well ")
|
||||
+ well_name + std::string(" will be closed due to economic limit");
|
||||
OpmLog::info(msg);
|
||||
} else {
|
||||
const std::string msg = std::string("Completion ") + std::to_string(worst_offending_connection) + std::string(" for well ")
|
||||
const std::string msg = std::string("Completion ") + std::to_string(worst_offending_completion) + std::string(" for well ")
|
||||
+ well_name + std::string(" will be closed due to economic limit");
|
||||
OpmLog::info(msg);
|
||||
}
|
||||
@ -796,13 +791,13 @@ namespace Opm
|
||||
bore_diameters_.reserve(nperf);
|
||||
|
||||
// COMPDAT handling
|
||||
const auto& completionSet = well_ecl_->getConnections(current_step_);
|
||||
for (size_t c=0; c<completionSet.size(); c++) {
|
||||
const auto& completion = completionSet.get(c);
|
||||
if (completion.state == WellCompletion::OPEN) {
|
||||
const int i = completion.getI();
|
||||
const int j = completion.getJ();
|
||||
const int k = completion.getK();
|
||||
const auto& connectionSet = well_ecl_->getConnections(current_step_);
|
||||
for (size_t c=0; c<connectionSet.size(); c++) {
|
||||
const auto& connection = connectionSet.get(c);
|
||||
if (connection.state == WellCompletion::OPEN) {
|
||||
const int i = connection.getI();
|
||||
const int j = connection.getJ();
|
||||
const int k = connection.getK();
|
||||
|
||||
const int* cpgdim = cart_dims;
|
||||
const int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k);
|
||||
@ -814,7 +809,7 @@ namespace Opm
|
||||
const int cell = cgit->second;
|
||||
|
||||
{
|
||||
double radius = 0.5*completion.getDiameter();
|
||||
double radius = 0.5*connection.getDiameter();
|
||||
if (radius <= 0.0) {
|
||||
radius = 0.5*unit::feet;
|
||||
OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius);
|
||||
@ -826,7 +821,7 @@ namespace Opm
|
||||
double re; // area equivalent radius of the grid block
|
||||
double perf_length; // the length of the well perforation
|
||||
|
||||
switch (completion.dir) {
|
||||
switch (connection.dir) {
|
||||
case Opm::WellCompletion::DirectionEnum::X:
|
||||
re = std::sqrt(cubical[1] * cubical[2] / M_PI);
|
||||
perf_length = cubical[0];
|
||||
|
Loading…
Reference in New Issue
Block a user