From 1f6dbae5cb31fe47b519ca021a58db34ae2c4a3d Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 30 Nov 2020 15:21:04 +0100 Subject: [PATCH] use privious table as default --- src/opm/output/eclipse/Summary.cpp | 6 +++--- .../eclipse/EclipseState/Schedule/KeywordHandlers.cpp | 10 ++++++++-- .../Schedule/Well/WellProductionProperties.cpp | 4 +++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index 0b15d915f..adc531f33 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -483,11 +483,11 @@ inline quantity glir( const fn_args& args ) { double alq_rate = 0; for (const auto& well : args.schedule_wells) { - auto xwPos = args.wells.find(well.name()); - if (xwPos == args.wells.end()) + if (well.isInjector()) continue; - if (well.isInjector()) + auto xwPos = args.wells.find(well.name()); + if (xwPos == args.wells.end()) continue; double eff_fac = efac( args.eff_factors, well.name() ); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index 9e6158e42..7784340dc 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -872,7 +872,6 @@ namespace { for (const auto& well_name : well_names) { this->updateWellStatus( well_name , handlerContext.currentStep , status, false, handlerContext.keyword.location() ); - const auto table_nr = record.getItem("VFP_TABLE").get< int >(0); std::optional alq_type; auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[handlerContext.currentStep]); @@ -880,6 +879,10 @@ namespace { auto properties = std::make_shared(well2->getProductionProperties()); bool update_well = false; + auto table_nr = record.getItem("VFP_TABLE").get< int >(0); + if(record.getItem("VFP_TABLE").defaultApplied(0)) + table_nr = properties->VFPTableNumber; + if (table_nr != 0) alq_type = this->getVFPProdTable(table_nr, handlerContext.currentStep).getALQType(); properties->handleWCONHIST(alq_type, this->unit_system, record); @@ -937,7 +940,6 @@ namespace { for (const auto& well_name : well_names) { this->updateWellStatus(well_name, handlerContext.currentStep, status, false, handlerContext.keyword.location()); - const auto table_nr = record.getItem("VFP_TABLE").get< int >(0); std::optional alq_type; auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[handlerContext.currentStep]); @@ -948,6 +950,10 @@ namespace { if (well2->isAvailableForGroupControl()) properties->addProductionControl(Well::ProducerCMode::GRUP); + auto table_nr = record.getItem("VFP_TABLE").get< int >(0); + if(record.getItem("VFP_TABLE").defaultApplied(0)) + table_nr = properties->VFPTableNumber; + if (table_nr != 0) alq_type = this->getVFPProdTable(table_nr, handlerContext.currentStep).getALQType(); properties->handleWCONPROD(alq_type, this->unit_system, well_name, record); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp index a6500e80f..50e50ded8 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp @@ -92,7 +92,8 @@ namespace Opm { void Well::WellProductionProperties::init_vfp(const std::optional& alq_type, const UnitSystem& unit_system_arg, const DeckRecord& record) { if (alq_type) { - this->VFPTableNumber = record.getItem("VFP_TABLE").get(0); + if (!record.getItem("VFP_TABLE").defaultApplied(0)) + this->VFPTableNumber = record.getItem("VFP_TABLE").get< int >(0); double alq_input = record.getItem("ALQ").get(0); const auto alq_dim = VFPProdTable::ALQDimension(*alq_type, unit_system_arg); this->ALQValue = alq_dim.convertRawToSi(alq_input); @@ -279,6 +280,7 @@ void Well::WellProductionProperties::handleWCONHIST(const std::optional