From 58aa93dcfe3977e2c0685561986bf75317ddc289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ove=20S=C3=A6vareid?= Date: Fri, 9 Oct 2020 20:03:56 +0200 Subject: [PATCH] New kw PVTSOL to accomodate an extension of the back oil model. --- CMakeLists_files.cmake | 1 + opm/parser/eclipse/EclipseState/Runspec.hpp | 8 +++-- .../EclipseState/Tables/PvtsolTable.hpp | 35 +++++++++++++++++++ .../EclipseState/Tables/TableManager.hpp | 4 +++ .../parser/eclipse/EclipseState/Runspec.cpp | 10 ++++-- .../EclipseState/Schedule/Well/Well.cpp | 4 ++- .../eclipse/EclipseState/Tables/PvtxTable.cpp | 2 +- .../EclipseState/Tables/TableManager.cpp | 7 ++++ .../eclipse/EclipseState/Tables/Tables.cpp | 27 ++++++++++++++ .../eclipse/share/keywords/900_OPM/P/PVTSOL | 6 ++++ .../eclipse/share/keywords/keyword_list.cmake | 1 + 11 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 opm/parser/eclipse/EclipseState/Tables/PvtsolTable.hpp create mode 100644 src/opm/parser/eclipse/share/keywords/900_OPM/P/PVTSOL diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 279dd7e48..cea6e0e83 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -667,6 +667,7 @@ if(ENABLE_ECL_INPUT) opm/parser/eclipse/EclipseState/Tables/SgwfnTable.hpp opm/parser/eclipse/EclipseState/Tables/PvdsTable.hpp opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp + opm/parser/eclipse/EclipseState/Tables/PvtsolTable.hpp opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp opm/parser/eclipse/EclipseState/Tables/RockwnodTable.hpp diff --git a/opm/parser/eclipse/EclipseState/Runspec.hpp b/opm/parser/eclipse/EclipseState/Runspec.hpp index cb32818f7..13bd7f9fb 100644 --- a/opm/parser/eclipse/EclipseState/Runspec.hpp +++ b/opm/parser/eclipse/EclipseState/Runspec.hpp @@ -42,11 +42,13 @@ enum class Phase { ENERGY = 5, POLYMW = 6, FOAM = 7, - BRINE = 8 + BRINE = 8, + ZFRACTION = 9 + // If you add more entries to this enum, remember to update NUM_PHASES_IN_ENUM below. }; -constexpr int NUM_PHASES_IN_ENUM = static_cast(Phase::BRINE) + 1; // Used to get correct size of the bitset in class Phases. +constexpr int NUM_PHASES_IN_ENUM = static_cast(Phase::ZFRACTION) + 1; // Used to get correct size of the bitset in class Phases. Phase get_phase( const std::string& ); std::ostream& operator<<( std::ostream&, const Phase& ); @@ -55,7 +57,7 @@ class Phases { public: Phases() noexcept = default; Phases( bool oil, bool gas, bool wat, bool solvent = false, bool polymer = false, bool energy = false, - bool polymw = false, bool foam = false, bool brine = false ) noexcept; + bool polymw = false, bool foam = false, bool brine = false, bool zfraction = false ) noexcept; static Phases serializeObject(); diff --git a/opm/parser/eclipse/EclipseState/Tables/PvtsolTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PvtsolTable.hpp new file mode 100644 index 000000000..4209a2879 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/PvtsolTable.hpp @@ -0,0 +1,35 @@ +/* + Copyright (C) 2014 by Andreas Lauser + + This file is part of the Open Porous Media project (OPM). + + OPM 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. + + OPM 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 for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . + */ +#ifndef OPM_PARSER_PVTSOL_TABLE_HPP +#define OPM_PARSER_PVTSOL_TABLE_HPP + +#include + +namespace Opm { + + class DeckKeyword; + + class PvtsolTable : public PvtxTable { + public: + PvtsolTable(const DeckKeyword& keyword, size_t tableIdx); + }; +} + +#endif + diff --git a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp index 249624745..f3944fa3a 100644 --- a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -142,6 +143,7 @@ namespace Opm { const std::vector& getPvtgwTables() const; const std::vector& getPvtgwoTables() const; const std::vector& getPvtoTables() const; + const std::vector& getPvtsolTables() const; const std::vector& getRock2dTables() const; const std::vector& getRock2dtrTables() const; const TableContainer& getRockwnodTables() const; @@ -207,6 +209,7 @@ namespace Opm { serializer.vector(m_pvtgwTables); serializer.vector(m_pvtgwoTables); serializer.vector(m_pvtoTables); + serializer.vector(m_pvtsolTables); serializer.vector(m_rock2dTables); serializer.vector(m_rock2dtrTables); m_pvtwTable.serializeOp(serializer); @@ -505,6 +508,7 @@ namespace Opm { std::vector m_pvtgwTables; std::vector m_pvtgwoTables; std::vector m_pvtoTables; + std::vector m_pvtsolTables; std::vector m_rock2dTables; std::vector m_rock2dtrTables; PvtwTable m_pvtwTable; diff --git a/src/opm/parser/eclipse/EclipseState/Runspec.cpp b/src/opm/parser/eclipse/EclipseState/Runspec.cpp index 7c7dc1de5..6a5da705c 100644 --- a/src/opm/parser/eclipse/EclipseState/Runspec.cpp +++ b/src/opm/parser/eclipse/EclipseState/Runspec.cpp @@ -42,6 +42,7 @@ Phase get_phase( const std::string& str ) { if( str == "POLYMW" ) return Phase::POLYMW; if( str == "FOAM" ) return Phase::FOAM; if( str == "BRINE" ) return Phase::BRINE; + if( str == "ZFRACTION" ) return Phase::ZFRACTION; throw std::invalid_argument( "Unknown phase '" + str + "'" ); } @@ -57,6 +58,7 @@ std::ostream& operator<<( std::ostream& stream, const Phase& p ) { case Phase::POLYMW: return stream << "POLYMW"; case Phase::FOAM: return stream << "FOAM"; case Phase::BRINE: return stream << "BRINE"; + case Phase::ZFRACTION: return stream << "ZFRACTION"; } @@ -65,7 +67,7 @@ std::ostream& operator<<( std::ostream& stream, const Phase& p ) { using un = std::underlying_type< Phase >::type; -Phases::Phases( bool oil, bool gas, bool wat, bool sol, bool pol, bool energy, bool polymw, bool foam, bool brine) noexcept : +Phases::Phases( bool oil, bool gas, bool wat, bool sol, bool pol, bool energy, bool polymw, bool foam, bool brine, bool zfraction) noexcept : bits( (oil ? (1 << static_cast< un >( Phase::OIL ) ) : 0) | (gas ? (1 << static_cast< un >( Phase::GAS ) ) : 0) | (wat ? (1 << static_cast< un >( Phase::WATER ) ) : 0) | @@ -74,7 +76,8 @@ Phases::Phases( bool oil, bool gas, bool wat, bool sol, bool pol, bool energy, b (energy ? (1 << static_cast< un >( Phase::ENERGY ) ) : 0) | (polymw ? (1 << static_cast< un >( Phase::POLYMW ) ) : 0) | (foam ? (1 << static_cast< un >( Phase::FOAM ) ) : 0) | - (brine ? (1 << static_cast< un >( Phase::BRINE ) ) : 0) ) + (brine ? (1 << static_cast< un >( Phase::BRINE ) ) : 0) | + (zfraction ? (1 << static_cast< un >( Phase::ZFRACTION ) ) : 0) ) {} @@ -311,7 +314,8 @@ Runspec::Runspec( const Deck& deck ) : deck.hasKeyword( "THERMAL" ), deck.hasKeyword( "POLYMW" ), deck.hasKeyword( "FOAM" ), - deck.hasKeyword( "BRINE" ) ) ), + deck.hasKeyword( "BRINE" ), + deck.hasKeyword( "PVTSOL" ) ) ), m_tabdims( deck ), endscale( deck ), welldims( deck ), diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 411d3a6cf..1239a5672 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -1284,7 +1284,9 @@ double Well::production_rate(const SummaryState& st, Phase prod_phase) const { case Phase::FOAM: throw std::invalid_argument( "Production of 'FOAM' requested."); case Phase::BRINE: - throw std::invalid_argument( "Production of 'BRINE' requested."); + throw std::invalid_argument( "Production of 'BRINE' requested."); + case Phase::ZFRACTION: + throw std::invalid_argument( "Production of 'ZFRACTION' requested."); } throw std::logic_error( "Unreachable state. Invalid Phase value. " diff --git a/src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp index 3c56e6586..d832a58bb 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp @@ -71,7 +71,7 @@ namespace Opm { m_saturatedTable = SimpleTable(m_saturatedSchema); for (size_t sat_index = 0; sat_index < size(); sat_index++) { const auto& underSaturatedTable = getUnderSaturatedTable( sat_index ); - std::vector row(4); + std::vector row(m_saturatedSchema.size()); row[0] = m_outerColumn[sat_index]; for (size_t col_index = 0; col_index < m_underSaturatedSchema.size(); col_index++) row[col_index + 1] = underSaturatedTable.get( col_index , 0 ); diff --git a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp index 9c846fc6c..4dc5e4b06 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp @@ -138,6 +138,9 @@ namespace Opm { this->checkPVTOMonotonicity(deck); } + if( deck.hasKeyword( "PVTSOL" ) ) + initFullTables(deck, "PVTSOL", m_pvtsolTables); + if( deck.hasKeyword( "PVTW" ) ) this->m_pvtwTable = PvtwTable( deck.getKeyword( "PVTW" ) ); @@ -1036,6 +1039,10 @@ namespace Opm { return m_pvtoTables; } + const std::vector& TableManager::getPvtsolTables() const { + return m_pvtsolTables; + } + const std::vector& TableManager::getRock2dTables() const { return m_rock2dTables; } diff --git a/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp b/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp index 28e45187f..7f1953f9c 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -216,6 +217,32 @@ PvtoTable::nonMonotonicSaturatedFVF() const return nonmonoFVF; } +PvtsolTable::PvtsolTable( const DeckKeyword& keyword, size_t tableIdx) : + PvtxTable("ZCO2") { + m_underSaturatedSchema.addColumn( ColumnSchema( "P" , Table::STRICTLY_INCREASING , Table::DEFAULT_NONE )); + m_underSaturatedSchema.addColumn( ColumnSchema( "B_O" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_underSaturatedSchema.addColumn( ColumnSchema( "B_G" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_underSaturatedSchema.addColumn( ColumnSchema( "RS" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_underSaturatedSchema.addColumn( ColumnSchema( "RV" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_underSaturatedSchema.addColumn( ColumnSchema( "XVOL" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_underSaturatedSchema.addColumn( ColumnSchema( "YVOL" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_underSaturatedSchema.addColumn( ColumnSchema( "MU_O" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_underSaturatedSchema.addColumn( ColumnSchema( "MU_G" , Table::RANDOM , Table::DEFAULT_LINEAR )); + + m_saturatedSchema.addColumn( ColumnSchema( "ZCO2" , Table::STRICTLY_INCREASING , Table::DEFAULT_NONE )); + m_saturatedSchema.addColumn( ColumnSchema( "P" , Table::INCREASING , Table::DEFAULT_NONE )); + m_saturatedSchema.addColumn( ColumnSchema( "B_O" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_saturatedSchema.addColumn( ColumnSchema( "B_G" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_saturatedSchema.addColumn( ColumnSchema( "RS" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_saturatedSchema.addColumn( ColumnSchema( "RV" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_saturatedSchema.addColumn( ColumnSchema( "XVOL" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_saturatedSchema.addColumn( ColumnSchema( "YVOL" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_saturatedSchema.addColumn( ColumnSchema( "MU_O" , Table::RANDOM , Table::DEFAULT_LINEAR )); + m_saturatedSchema.addColumn( ColumnSchema( "MU_G" , Table::RANDOM , Table::DEFAULT_LINEAR )); + + PvtxTable::init(keyword , tableIdx); + } + SpecheatTable::SpecheatTable(const DeckItem& item) { m_schema.addColumn(ColumnSchema("TEMPERATURE", Table::STRICTLY_INCREASING, Table::DEFAULT_NONE)); diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/P/PVTSOL b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PVTSOL new file mode 100644 index 000000000..8115bdf22 --- /dev/null +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PVTSOL @@ -0,0 +1,6 @@ +{"name" : "PVTSOL" , "sections" : ["PROPS"], "num_tables" : {"keyword" : "TABDIMS" , "item" : "NTPVT"}, + "items" : [ + {"name":"ZCO2", "value_type" : "DOUBLE", "dimension":"1" }, + {"name":"DATA", "value_type":"DOUBLE", "size_type" : "ALL" , "dimension" : ["Pressure","1","OilDissolutionFactor","GasDissolutionFactor","OilDissolutionFactor","1","1","Viscosity","Viscosity"]} + ] +} diff --git a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake index 287ece466..62d71469c 100644 --- a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake +++ b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake @@ -1102,6 +1102,7 @@ set( keywords 900_OPM/P/PRECSALT 900_OPM/P/PVTGW 900_OPM/P/PVTGWO + 900_OPM/P/PVTSOL 900_OPM/P/PYACTION 900_OPM/P/PYINPUT 900_OPM/R/RHO