///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2025 Equinor ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RimKeywordWconprod.h" #include "RifOpmDeckTools.h" #include "cafPdmFieldCapability.h" #include "opm/input/eclipse/Deck/DeckItem.hpp" #include "opm/input/eclipse/Deck/DeckKeyword.hpp" #include "opm/input/eclipse/Deck/DeckRecord.hpp" #include "opm/input/eclipse/Parser/ParserKeyword.hpp" #include "opm/input/eclipse/Parser/ParserKeywords/W.hpp" CAF_PDM_SOURCE_INIT( RimKeywordWconprod, "KeywordWconprod" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimKeywordWconprod::RimKeywordWconprod() { CAF_PDM_InitObject( "WCONPROD Keyword" ); CAF_PDM_InitField( &m_status, "status", QString( "OPEN" ), "Well Status" ); CAF_PDM_InitField( &m_target, "target", QString( "LRAT" ), "Target Production Phase" ); CAF_PDM_InitFieldNoDefault( &m_orat, "orat", "Max Surface Oil Production Rate" ); CAF_PDM_InitFieldNoDefault( &m_wrat, "wrat", "Max Surface Water Production Rate" ); CAF_PDM_InitFieldNoDefault( &m_grat, "grat", "Max Surface Gas Production Rate" ); CAF_PDM_InitFieldNoDefault( &m_lrat, "lrat", "Max Surface Liquid Production Rate" ); CAF_PDM_InitFieldNoDefault( &m_resv, "resv", "Max Reservoir Volume Rate" ); CAF_PDM_InitFieldNoDefault( &m_bhp, "bhp", "Max Bottom Hole Pressure" ); CAF_PDM_InitFieldNoDefault( &m_thp, "thp", "Min Tubing Head Pressure" ); CAF_PDM_InitFieldNoDefault( &m_vfptab, "vfptab", "VFP Table Index" ); CAF_PDM_InitFieldNoDefault( &m_alqWell, "alqWell", "Artificial Lift Quantity" ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimKeywordWconprod::~RimKeywordWconprod() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QList RimKeywordWconprod::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_status ) { options.push_back( caf::PdmOptionItemInfo( "OPEN", QVariant::fromValue( QString( "OPEN" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "STOP", QVariant::fromValue( QString( "STOP" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "SHUT", QVariant::fromValue( QString( "SHUT" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "AUTO", QVariant::fromValue( QString( "AUTO" ) ) ) ); } else if ( fieldNeedingOptions == &m_target ) { options.push_back( caf::PdmOptionItemInfo( "ORAT", QVariant::fromValue( QString( "ORAT" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "WRAT", QVariant::fromValue( QString( "WRAT" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "GRAT", QVariant::fromValue( QString( "GRAT" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "LRAT", QVariant::fromValue( QString( "LRAT" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "RESV", QVariant::fromValue( QString( "RESV" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "BHP", QVariant::fromValue( QString( "BHP" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "THP", QVariant::fromValue( QString( "THP" ) ) ) ); options.push_back( caf::PdmOptionItemInfo( "GRUP", QVariant::fromValue( QString( "GRUP" ) ) ) ); } return options; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimKeywordWconprod::uiOrdering( caf::PdmUiGroup* uiGroup ) { uiGroup->add( &m_status ); uiGroup->add( &m_target ); uiGroup->add( &m_orat ); uiGroup->add( &m_wrat ); uiGroup->add( &m_grat ); uiGroup->add( &m_lrat ); uiGroup->add( &m_resv ); uiGroup->add( &m_bhp ); uiGroup->add( &m_thp ); uiGroup->add( &m_vfptab ); uiGroup->add( &m_alqWell ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- Opm::DeckKeyword RimKeywordWconprod::keyword( const QString& wellName ) { using W = Opm::ParserKeywords::WCONPROD; std::vector items; items.push_back( RifOpmDeckTools::item( W::WELL::itemName, wellName.toStdString() ) ); items.push_back( RifOpmDeckTools::item( W::STATUS::itemName, m_status().toStdString() ) ); items.push_back( RifOpmDeckTools::item( W::CMODE::itemName, m_target().toStdString() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::ORAT::itemName, m_orat() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::WRAT::itemName, m_wrat() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::GRAT::itemName, m_grat() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::LRAT::itemName, m_lrat() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::RESV::itemName, m_resv() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::BHP::itemName, m_bhp() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::THP::itemName, m_thp() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::VFP_TABLE::itemName, m_vfptab() ) ); items.push_back( RifOpmDeckTools::optionalItem( W::ALQ::itemName, m_alqWell() ) ); Opm::DeckKeyword kw( ( W() ) ); kw.addRecord( Opm::DeckRecord{ std::move( items ) } ); return kw; }