Load well status from IWEL when loading restart file
This commit is contained in:
parent
a33fd2483f
commit
00d5421153
@ -66,6 +66,7 @@ struct RstWell {
|
|||||||
std::array<int, 2> ij;
|
std::array<int, 2> ij;
|
||||||
std::pair<int,int> k1k2;
|
std::pair<int,int> k1k2;
|
||||||
WellType wtype;
|
WellType wtype;
|
||||||
|
int well_status;
|
||||||
int active_control;
|
int active_control;
|
||||||
int vfp_table;
|
int vfp_table;
|
||||||
int pred_requested_control;
|
int pred_requested_control;
|
||||||
|
@ -61,6 +61,7 @@ RstWell::RstWell(const ::Opm::UnitSystem& unit_system,
|
|||||||
ij( {iwel[VI::IWell::IHead] - 1, iwel[VI::IWell::JHead] - 1}),
|
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)),
|
k1k2( std::make_pair(iwel[VI::IWell::FirstK] - 1, iwel[VI::IWell::LastK] - 1)),
|
||||||
wtype( iwel[VI::IWell::WType], def_ecl_phase),
|
wtype( iwel[VI::IWell::WType], def_ecl_phase),
|
||||||
|
well_status( iwel[VI::IWell::Status]),
|
||||||
active_control( iwel[VI::IWell::ActWCtrl]),
|
active_control( iwel[VI::IWell::ActWCtrl]),
|
||||||
vfp_table( iwel[VI::IWell::VFPTab]),
|
vfp_table( iwel[VI::IWell::VFPTab]),
|
||||||
pred_requested_control( iwel[VI::IWell::PredReqWCtrl]),
|
pred_requested_control( iwel[VI::IWell::PredReqWCtrl]),
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||||
#include <opm/io/eclipse/rst/well.hpp>
|
#include <opm/io/eclipse/rst/well.hpp>
|
||||||
@ -81,9 +83,6 @@ namespace {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr int def_well_closed_control = 0;
|
|
||||||
|
|
||||||
|
|
||||||
Connection::Order order_from_int(int int_value) {
|
Connection::Order order_from_int(int int_value) {
|
||||||
switch(int_value) {
|
switch(int_value) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -93,7 +92,24 @@ Connection::Order order_from_int(int int_value) {
|
|||||||
case 2:
|
case 2:
|
||||||
return Connection::Order::INPUT;
|
return Connection::Order::INPUT;
|
||||||
default:
|
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),
|
pvt_table(rst_well.pvt_table),
|
||||||
unit_system(unit_system_arg),
|
unit_system(unit_system_arg),
|
||||||
udq_undefined(udq_undefined_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),
|
wtype(rst_well.wtype),
|
||||||
guide_rate(def_guide_rate),
|
guide_rate(def_guide_rate),
|
||||||
efficiency_factor(rst_well.efficiency_factor),
|
efficiency_factor(rst_well.efficiency_factor),
|
||||||
|
Loading…
Reference in New Issue
Block a user