diff --git a/opm/io/eclipse/rst/well.hpp b/opm/io/eclipse/rst/well.hpp index c7cd9cf42..72b01b781 100644 --- a/opm/io/eclipse/rst/well.hpp +++ b/opm/io/eclipse/rst/well.hpp @@ -66,6 +66,7 @@ struct RstWell { std::array ij; std::pair k1k2; WellType wtype; + int well_status; int active_control; int vfp_table; int pred_requested_control; diff --git a/src/opm/io/eclipse/rst/well.cpp b/src/opm/io/eclipse/rst/well.cpp index 0a79880ca..2f2231d93 100644 --- a/src/opm/io/eclipse/rst/well.cpp +++ b/src/opm/io/eclipse/rst/well.cpp @@ -61,6 +61,7 @@ RstWell::RstWell(const ::Opm::UnitSystem& unit_system, ij( {iwel[VI::IWell::IHead] - 1, iwel[VI::IWell::JHead] - 1}), k1k2( std::make_pair(iwel[VI::IWell::FirstK] - 1, iwel[VI::IWell::LastK] - 1)), wtype( iwel[VI::IWell::WType], def_ecl_phase), + well_status( iwel[VI::IWell::Status]), active_control( iwel[VI::IWell::ActWCtrl]), vfp_table( iwel[VI::IWell::VFPTab]), pred_requested_control( iwel[VI::IWell::PredReqWCtrl]), diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index f4d0329fe..8f397c080 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -17,6 +17,8 @@ along with OPM. If not, see . */ +#include + #include #include #include @@ -81,9 +83,6 @@ namespace { namespace { -constexpr int def_well_closed_control = 0; - - Connection::Order order_from_int(int int_value) { switch(int_value) { case 0: @@ -93,7 +92,24 @@ Connection::Order order_from_int(int int_value) { case 2: return Connection::Order::INPUT; default: - throw std::invalid_argument("Invalid integer value: " + std::to_string(int_value) + " encountered when determining connection ordering"); + throw std::invalid_argument(fmt::format("Invalid integer value: {} encountered when determining connection ordering", int_value)); + } +} + +Well::Status status_from_int(int int_value) { + using Value = RestartIO::Helpers::VectorItems::IWell::Value::Status; + + switch (int_value) { + case Value::Shut: + return Well::Status::SHUT; + case Value::Stop: + return Well::Status::STOP; + case Value::Open: + return Well::Status::OPEN; + case Value::Auto: + return Well::Status::AUTO; + default: + throw std::logic_error(fmt::format("integer value: {} could not be converted to a valid state", int_value)); } } @@ -121,7 +137,7 @@ Well::Well(const RestartIO::RstWell& rst_well, pvt_table(rst_well.pvt_table), unit_system(unit_system_arg), udq_undefined(udq_undefined_arg), - status(rst_well.active_control == def_well_closed_control ? Well::Status::SHUT : Well::Status::OPEN), + status(status_from_int(rst_well.well_status)), wtype(rst_well.wtype), guide_rate(def_guide_rate), efficiency_factor(rst_well.efficiency_factor),