From 5328de6361be72d9fa0f03ab1e6ae4361d2965dd Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Wed, 11 Oct 2017 07:55:48 +0200 Subject: [PATCH] handling WELL workover over ratio economic limit. --- opm/autodiff/WellInterface_impl.hpp | 55 +++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/opm/autodiff/WellInterface_impl.hpp b/opm/autodiff/WellInterface_impl.hpp index def98243d..8e5107bc5 100644 --- a/opm/autodiff/WellInterface_impl.hpp +++ b/opm/autodiff/WellInterface_impl.hpp @@ -636,11 +636,11 @@ namespace Opm if (well_ecl_->getAutomaticShutIn()) { list_econ_limited.addShutWell(well_name); - const std::string msg = std::string("well ") + well_name + std::string(" will be shut in due to economic limit"); + const std::string msg = std::string("well ") + well_name + std::string(" will be shut in due to rate economic limit"); OpmLog::info(msg); } else { list_econ_limited.addStoppedWell(well_name); - const std::string msg = std::string("well ") + well_name + std::string(" will be stopped due to economic limit"); + const std::string msg = std::string("well ") + well_name + std::string(" will be stopped due to rate economic limit"); OpmLog::info(msg); } // the well is closed, not need to check other limits @@ -657,21 +657,48 @@ namespace Opm } 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 WellEcon::WorkoverEnum workover = econ_production_limits.workover(); + switch (workover) { + case WellEcon::CON: + { + const bool last_connection = std::get<1>(ratio_check_return); + const int worst_offending_connection = std::get<2>(ratio_check_return); - assert((worst_offending_connection >= 0) && (worst_offending_connection < number_of_perforations_)); + assert((worst_offending_connection >= 0) && (worst_offending_connection < number_of_perforations_)); - const int cell_worst_offending_connection = well_cells_[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 ") - + well_name + std::string(" will be closed due to economic limit"); - OpmLog::info(msg); + const int cell_worst_offending_connection = well_cells_[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 ") + + well_name + std::string(" will be closed due to economic limit"); + OpmLog::info(msg); - if (last_connection) { - list_econ_limited.addShutWell(well_name); - const std::string msg2 = well_name + std::string(" will be shut due to the last connection closed"); - OpmLog::info(msg2); + if (last_connection) { + // TODO: there is more things to check here + list_econ_limited.addShutWell(well_name); + const std::string msg2 = well_name + std::string(" will be shut due to the last connection closed"); + OpmLog::info(msg2); + } + break; + } + case WellEcon::WELL: + { + if (well_ecl_->getAutomaticShutIn()) { + list_econ_limited.addShutWell(well_name); + const std::string msg = well_name + std::string(" will be shut due to ratio economic limit"); + OpmLog::info(msg); + } else { + list_econ_limited.addStoppedWell(well_name); + const std::string msg = well_name + std::string(" will be stopped due to ratio economic limit"); + OpmLog::info(msg); + } + break; + } + case WellEcon::NONE: + break; + default: + { + OpmLog::warning("NOT_SUPPORTED_WORKOVER_TYPE", "not supporting workover type " + WellEcon::WorkoverEnumToString(workover) ); + } } } }