From bcb852e8f28bdf15304d6c2d9f4270246e12febf Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 5 Apr 2018 14:18:26 +0200 Subject: [PATCH 01/12] adding keyword PLYMWINJ --- src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYMWINJ | 7 +++++++ src/opm/parser/eclipse/share/keywords/keyword_list.cmake | 1 + 2 files changed, 8 insertions(+) create mode 100644 src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYMWINJ diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYMWINJ b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYMWINJ new file mode 100644 index 000000000..d67fdc139 --- /dev/null +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYMWINJ @@ -0,0 +1,7 @@ +{"name" : "PLYMWINJ" , "sections" : ["PROPS"], "size" : "UNKNOWN", + "records" : [ +[{"name" : "TABLE_NUMBER" , "value_type" : "INT"}], +[{"name" : "THROUGHPUT", "value_type" : "DOUBLE", "dimension" : "Length", "size_type" : "ALL"}], +[{"name" : "VELOCITY", "value_type" : "DOUBLE", "dimension" : "Length/Time", "size_type" : "ALL"}], +[{"name" : "MOLECULARWEIGHT", "value_type" : "DOUBLE", "dimension" : "1", "size_type" : "ALL"}] +]} diff --git a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake index 5c870b1aa..1ec6f8f82 100644 --- a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake +++ b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake @@ -455,6 +455,7 @@ set( keywords 900_OPM/P/PINTDIMS 900_OPM/P/PLYVMH 900_OPM/P/POLYMW + 900_OPM/P/PLYMWINJ 900_OPM/R/RHO 900_OPM/S/SPOLYMW 900_OPM/T/TLPMIXPA) From 65ef90f471eed76eda4d0a8a62fa2f78d321871a Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 5 Apr 2018 15:17:22 +0200 Subject: [PATCH 02/12] removing NPLYVMH from PINTDIMS from now on, the number of NPLYVMH will depend on the number of polymer mixing regions, which is defined with NPLMIX from REGDIMS. --- src/opm/parser/eclipse/share/keywords/900_OPM/P/PINTDIMS | 3 +-- src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYVMH | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/P/PINTDIMS b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PINTDIMS index 64f39297d..0b96e19c4 100644 --- a/src/opm/parser/eclipse/share/keywords/900_OPM/P/PINTDIMS +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PINTDIMS @@ -1,6 +1,5 @@ {"name" : "PINTDIMS", "sections" : ["RUNSPEC"], "size" : 1, "items" : [ {"name" : "NTSKWAT" , "value_type" : "INT" , "default" : 1}, {"name" : "NTSKPOLY" , "value_type" : "INT" , "default" : 1}, - {"name" : "NTPMWINJ" , "value_type" : "INT" , "default" : 1}, - {"name" : "NPLYVMH" , "value_type" : "INT" , "default" : 1} + {"name" : "NTPMWINJ" , "value_type" : "INT" , "default" : 1} ]} diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYVMH b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYVMH index 6de34e720..1c500ea77 100644 --- a/src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYVMH +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/P/PLYVMH @@ -1,4 +1,4 @@ -{"name" : "PLYVMH" , "sections" : ["PROPS"], "size" : {"keyword" : "PINTDIMS" , "item" : "NPLYVMH"} , "items" : +{"name" : "PLYVMH" , "sections" : ["PROPS"], "size" : {"keyword" : "REGDIMS" , "item" : "NPLMIX"} , "items" : [ {"name" : "K_MH", "value_type" : "DOUBLE", "dimension" : "1" }, {"name" : "A_MH", "value_type" : "DOUBLE", "dimension" : "1" }, From d0e5f8f47054b1bd1397e3374921eb47ba54e8c6 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 5 Apr 2018 16:22:31 +0200 Subject: [PATCH 03/12] beginning working on PlymwinjTable it will go to Tables.cpp later. --- CMakeLists_files.cmake | 4 ++ .../EclipseState/Tables/PlymwinjTable.hpp | 40 +++++++++++++ .../EclipseState/Tables/Simple2DTable.hpp | 53 +++++++++++++++++ .../EclipseState/Tables/TableManager.hpp | 4 ++ .../EclipseState/Tables/PlymwinjTable.cpp | 59 +++++++++++++++++++ .../EclipseState/Tables/Simple2DTable.cpp | 46 +++++++++++++++ .../EclipseState/Tables/TableManager.cpp | 32 ++++++++++ 7 files changed, 238 insertions(+) create mode 100644 opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp create mode 100644 opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp create mode 100644 src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp create mode 100644 src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 6baf5602e..25956ef7c 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -106,8 +106,10 @@ if(ENABLE_ECL_INPUT) src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp src/opm/parser/eclipse/EclipseState/Tables/ColumnSchema.cpp src/opm/parser/eclipse/EclipseState/Tables/JFunc.cpp + src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp src/opm/parser/eclipse/EclipseState/Tables/SimpleTable.cpp + src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp src/opm/parser/eclipse/EclipseState/Tables/TableContainer.cpp src/opm/parser/eclipse/EclipseState/Tables/TableIndex.cpp @@ -380,6 +382,7 @@ if(ENABLE_ECL_INPUT) opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp opm/parser/eclipse/EclipseState/EndpointScaling.hpp opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp + opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp opm/parser/eclipse/EclipseState/Tables/TlpmixpaTable.hpp opm/parser/eclipse/EclipseState/Tables/PvdgTable.hpp @@ -389,6 +392,7 @@ if(ENABLE_ECL_INPUT) opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp opm/parser/eclipse/EclipseState/Tables/SpecrockTable.hpp opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp + opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp opm/parser/eclipse/EclipseState/Tables/RsvdTable.hpp opm/parser/eclipse/EclipseState/Tables/SpecheatTable.hpp diff --git a/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp new file mode 100644 index 000000000..f7b39a8c3 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp @@ -0,0 +1,40 @@ +/* + Copyright (C) 2018 Statoil ASA + + 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_PLYMWINJ_TABLE_HPP +#define OPM_PARSER_PLYMWINJ_TABLE_HPP + +#include +namespace Opm { + + class DeckKeyword; + + class PlymwinjTable : public Simple2DTable { + public: + + explicit PlymwinjTable(const DeckKeyword& table); + + private: + // TODO: maybe this one is not necessary + // TODO: maybe table number should go to base class + }; + +} + +#endif //OPM_PARSER_PLYMWINJ_TABLE_HPP diff --git a/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp b/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp new file mode 100644 index 000000000..50c9e65e1 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp @@ -0,0 +1,53 @@ +/* + Copyright (C) 2018 Statoil ASA + + 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_SIMPLE_2D_TABLE_HPP +#define OPM_PARSER_SIMPLE_2D_TABLE_HPP + +// TODO: it is a simple version to begin with, will check whether to introduce +// the Schemas and TableColumn + +#include + +namespace Opm { + + class Simple2DTable { + public: + + int getTableNumber() const; + + const std::vector& getXSamplingPoints() const; + const std::vector& getYSamplingPoints() const; + const std::vector>& getTableData() const; + + protected: + std::vector m_x_points; + std::vector m_y_points; + + // TODO: maybe not needed, since this is also stored in the std::map + int m_table_number; + + // each vector corresponds to the values corresponds to one value related to one x sampling point + // as a result, the number of the vector should be equal to be the size of m_x_points, + // the size of each vector should be equal to the size of m_y_points + std::vector > m_data; + }; +} + +#endif // OPM_PARSER_SIMPLE_2D_TABLE_HPP diff --git a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp index 27d5e0cea..ee7b4d1ef 100644 --- a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp @@ -45,6 +45,7 @@ #include #include #include +#include namespace Opm { @@ -121,6 +122,7 @@ namespace Opm { const RockTable& getRockTable() const; const ViscrefTable& getViscrefTable() const; const WatdentTable& getWatdentTable() const; + const std::map& getPlymwinjTables() const; /// deck has keyword "IMPTVD" --- Imbition end-point versus depth tables bool useImptvd() const; @@ -150,6 +152,7 @@ namespace Opm { void initPlymaxTables(const Deck& deck); void initPlyrockTables(const Deck& deck); void initPlyshlogTables(const Deck& deck); + void initPlymwinjTables(const Deck& deck); @@ -287,6 +290,7 @@ namespace Opm { RockTable m_rockTable; ViscrefTable m_viscrefTable; WatdentTable m_watdentTable; + std::map m_plymwinjTables; Tabdims m_tabdims; std::shared_ptr m_regdims; diff --git a/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp new file mode 100644 index 000000000..17757f7f5 --- /dev/null +++ b/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp @@ -0,0 +1,59 @@ +/* + Copyright 2018 Statoil ASA. + + 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 . +*/ + +// TODO: this will go to Tables.cpp later. + +#include +#include +#include + + +namespace Opm{ + + PlymwinjTable::PlymwinjTable(const Opm::DeckKeyword& table) + { + using namespace ParserKeywords; + + const DeckRecord& record0 = table.getRecord(0); + m_table_number = record0.getItem().get< int >(0); + m_x_points = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_x_points.size(); + + if (table.size() != num_cols + 3) { + const std::string msg = "PLYMWINJ table " + std::to_string(m_table_number) + + " does not have enough records!"; + throw std::invalid_argument(msg); + } + + m_y_points = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_y_points.size(); + + for (size_t i = 3; i < table.size(); ++i) { + const DeckRecord& record_i = table.getRecord(i); + const std::vector& data_i = record_i.getItem().getSIDoubleData(); + if (data_i.size() != num_rows) { + const std::string msg = "PLYMWINJ table " + std::to_string(m_table_number) + + " record " + std::to_string(i) + + " does not have correct number of data "; + throw std::invalid_argument(msg); + } + m_data.push_back(data_i); + } + } +} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp new file mode 100644 index 000000000..9cfdd7835 --- /dev/null +++ b/src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp @@ -0,0 +1,46 @@ +/* + Copyright 2018 Statoil ASA. + + 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 . +*/ + +// TODO: this will go to Tables.cpp later. + +#include + + +namespace Opm{ + + int Simple2DTable::getTableNumber() const + { + return m_table_number; + } + + const std::vector& Simple2DTable::getXSamplingPoints() const + { + return m_x_points; + } + + const std::vector& Simple2DTable::getYSamplingPoints() const + { + return m_y_points; + } + + const std::vector>& Simple2DTable::getTableData() const + { + return m_data; + } +} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp index ae801d978..d59ae4ceb 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp @@ -342,6 +342,7 @@ namespace Opm { initRTempTables(deck); initRocktabTables(deck); initPlyshlogTables(deck); + initPlymwinjTables(deck); } @@ -417,6 +418,32 @@ namespace Opm { } } + void TableManager::initPlymwinjTables(const Deck& deck) { + if (!deck.hasKeyword("PLYMWINJ")) { + return; + } + + const size_t num_tables = deck.count("PLYMWINJ"); + const auto keywords = deck.getKeywordList(); + for (size_t i = 0; i < num_tables; ++i) { + const DeckKeyword &keyword = *keywords[i]; + + // not const for std::move + PlymwinjTable table(keyword); + + // we need to check the value of the table_number against the allowed ones + const int table_number = table.getTableNumber(); + // we should check if the table_number is valid + if (m_plymwinjTables.find(table_number) == m_plymwinjTables.end()) { + m_plymwinjTables.insert(std::make_pair(table_number, std::move(table))); + } else { + throw std::invalid_argument("Duplicated table number " + + std::to_string(table_number) + + " for keyword SKPRWAT found"); + } + } + } + void TableManager::initPlyrockTables(const Deck& deck) { size_t numTables = m_tabdims.getNumSatTables(); @@ -724,6 +751,11 @@ namespace Opm { return *jfunc; } + + const std::map& TableManager::getPlymwinjTables() const { + return m_plymwinjTables; + } + bool TableManager::useImptvd() const { return hasImptvd; } From e4912d4fcf81c32153d0913dbc0e21befd34b86d Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Fri, 6 Apr 2018 15:48:27 +0200 Subject: [PATCH 04/12] adding keyword WPMITAB --- .../eclipse/EclipseState/Schedule/Schedule.hpp | 17 ++++++++++------- .../Schedule/WellPolymerProperties.hpp | 1 + .../eclipse/EclipseState/Schedule/Schedule.cpp | 17 +++++++++++++++++ .../Schedule/WellPolymerProperties.cpp | 4 +++- .../eclipse/share/keywords/900_OPM/W/WPMITAB | 8 ++++++++ .../eclipse/share/keywords/keyword_list.cmake | 3 ++- 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 src/opm/parser/eclipse/share/keywords/900_OPM/W/WPMITAB diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 904c09f2e..96fb1702e 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -170,19 +170,22 @@ namespace Opm void handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, const ParseContext& parseContext); void handleCOMPLUMP( const DeckKeyword& keyword, size_t currentStep ); void handleWELSEGS( const DeckKeyword& keyword, size_t currentStep); + void handleCOMPSEGS( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid); void handleWCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep); void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext ); - void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep); + void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep ); + void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep); + void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep); + void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep); + void handleGEFAC( const DeckKeyword& keyword, size_t currentStep); + void handleWEFAC( const DeckKeyword& keyword, size_t currentStep); + void handleTUNING( const DeckKeyword& keyword, size_t currentStep); void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep); void handleGRUPNET( const DeckKeyword& keyword, size_t currentStep); diff --git a/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp index 6b8bc23d2..ed25b0b77 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp @@ -26,6 +26,7 @@ namespace Opm { struct WellPolymerProperties { double m_polymerConcentration; double m_saltConcentration; + int m_plymwinjtable; bool operator==(const WellPolymerProperties& other) const; bool operator!=(const WellPolymerProperties& other) const; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index d289298fc..90906ad59 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -197,6 +197,10 @@ namespace Opm { else if (keyword.name() == "WTEMP") handleWTEMP(keyword, currentStep, parseContext); + else if (keyword.name() == "WPMITAB") + handleWPMITAB(keyword, currentStep); + + else if (keyword.name() == "WINJTEMP") handleWINJTEMP(keyword, currentStep, parseContext); @@ -761,6 +765,19 @@ namespace Opm { } + void Schedule::handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep) { + for (const auto& record : keyword) { + const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); + for (auto* well : getWells(wellNamePattern) ) { + // TODO: it needs to be an injector + WellPolymerProperties properties(well->getPolymerProperties(currentStep)); + properties.m_plymwinjtable = record.getItem("TABLE_NUMBER").get(0); + // TODO: some sanity check about the table number? + well->setPolymerProperties(currentStep, properties); + } + } + } + void Schedule::handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext) { for( const auto& record : keyword ) { diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp index ec99654b1..c62f7a560 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp @@ -26,11 +26,13 @@ namespace Opm { WellPolymerProperties::WellPolymerProperties() { m_polymerConcentration = 0.0; m_saltConcentration = 0.0; + m_plymwinjtable = -1; // unusable table number } bool WellPolymerProperties::operator==(const WellPolymerProperties& other) const { if ((m_polymerConcentration == other.m_polymerConcentration) && - (m_saltConcentration == other.m_saltConcentration)) + (m_saltConcentration == other.m_saltConcentration) && + (m_plymwinjtable == other.m_plymwinjtable) ) return true; else return false; diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/W/WPMITAB b/src/opm/parser/eclipse/share/keywords/900_OPM/W/WPMITAB new file mode 100644 index 000000000..29867eb6c --- /dev/null +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/W/WPMITAB @@ -0,0 +1,8 @@ +{ + "name" : "WPMITAB", + "sections" : ["SCHEDULE" ], + "items" : + [{"name" : "WELL" , "value_type" : "STRING"}, + {"name" : "TABLE_NUMBER" , "value_type" : "INT"} + ] +} diff --git a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake index 1ec6f8f82..1b298a12d 100644 --- a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake +++ b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake @@ -458,4 +458,5 @@ set( keywords 900_OPM/P/PLYMWINJ 900_OPM/R/RHO 900_OPM/S/SPOLYMW - 900_OPM/T/TLPMIXPA) + 900_OPM/T/TLPMIXPA + 900_OPM/W/WPMITAB) From 1432367e078b1ddf1ab1bd2b89eea3c10882b720 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 12 Apr 2018 13:52:48 +0200 Subject: [PATCH 05/12] adding a few keywords related to skin pressure SKPRPOLY, SKPRWAT, WSKPTAB --- opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp | 3 --- src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRPOLY | 8 ++++++++ src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRWAT | 7 +++++++ src/opm/parser/eclipse/share/keywords/900_OPM/W/WSKPTAB | 9 +++++++++ src/opm/parser/eclipse/share/keywords/keyword_list.cmake | 5 ++++- 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRPOLY create mode 100644 src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRWAT create mode 100644 src/opm/parser/eclipse/share/keywords/900_OPM/W/WSKPTAB diff --git a/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp index f7b39a8c3..bd9fdc90c 100644 --- a/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp @@ -30,9 +30,6 @@ namespace Opm { explicit PlymwinjTable(const DeckKeyword& table); - private: - // TODO: maybe this one is not necessary - // TODO: maybe table number should go to base class }; } diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRPOLY b/src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRPOLY new file mode 100644 index 000000000..a1630541a --- /dev/null +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRPOLY @@ -0,0 +1,8 @@ +{"name" : "SKPRPOLY" , "sections" : ["PROPS"], "size" : "UNKNOWN", + "records" : [ +[{"name" : "TABLE_NUMBER" , "value_type" : "INT"}, +{"name" : "POLYMERCONCENTRATION" , "value_type" : "DOUBLE", "dimension" : "PolymerDensity"}], +[{"name" : "THROUGHPUT", "value_type" : "DOUBLE", "dimension" : "Length", "size_type" : "ALL"}], +[{"name" : "VELOCITY", "value_type" : "DOUBLE", "dimension" : "Length/Time", "size_type" : "ALL"}], +[{"name" : "SKINPRESSURE", "value_type" : "DOUBLE", "dimension" : "Pressure", "size_type" : "ALL"}] +]} diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRWAT b/src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRWAT new file mode 100644 index 000000000..41e484940 --- /dev/null +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/S/SKPRWAT @@ -0,0 +1,7 @@ +{"name" : "SKPRWAT" , "sections" : ["PROPS"], "size" : "UNKNOWN", + "records" : [ +[{"name" : "TABLE_NUMBER" , "value_type" : "INT"}], +[{"name" : "THROUGHPUT", "value_type" : "DOUBLE", "dimension" : "Length", "size_type" : "ALL"}], +[{"name" : "VELOCITY", "value_type" : "DOUBLE", "dimension" : "Length/Time", "size_type" : "ALL"}], +[{"name" : "SKINPRESSURE", "value_type" : "DOUBLE", "dimension" : "Pressure", "size_type" : "ALL"}] +]} diff --git a/src/opm/parser/eclipse/share/keywords/900_OPM/W/WSKPTAB b/src/opm/parser/eclipse/share/keywords/900_OPM/W/WSKPTAB new file mode 100644 index 000000000..9dcaa09d9 --- /dev/null +++ b/src/opm/parser/eclipse/share/keywords/900_OPM/W/WSKPTAB @@ -0,0 +1,9 @@ +{ + "name" : "WSKPTAB", + "sections" : ["SCHEDULE" ], + "items" : + [{"name" : "WELL" , "value_type" : "STRING"}, + {"name" : "TABLE_NUMBER_WATER" , "value_type" : "INT"}, + {"name" : "TABLE_NUMBER_POLYMER" , "value_type" : "INT"} + ] +} diff --git a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake index 1b298a12d..939d55063 100644 --- a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake +++ b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake @@ -457,6 +457,9 @@ set( keywords 900_OPM/P/POLYMW 900_OPM/P/PLYMWINJ 900_OPM/R/RHO + 900_OPM/S/SKPRPOLY + 900_OPM/S/SKPRWAT 900_OPM/S/SPOLYMW 900_OPM/T/TLPMIXPA - 900_OPM/W/WPMITAB) + 900_OPM/W/WPMITAB + 900_OPM/W/WSKPTAB) From 49655b464cf040acff6943faefd31b8722c584d7 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 12 Apr 2018 15:39:45 +0200 Subject: [PATCH 06/12] adding support for the few skin pressure related keywords SKPRWAT SKPRPOLY WSKPTAB --- CMakeLists_files.cmake | 4 ++ .../EclipseState/Schedule/Schedule.hpp | 1 + .../Schedule/WellPolymerProperties.hpp | 2 + .../EclipseState/Tables/SkprpolyTable.hpp | 42 ++++++++++++ .../EclipseState/Tables/SkprwatTable.hpp | 37 +++++++++++ .../EclipseState/Tables/TableManager.hpp | 9 +++ .../EclipseState/Schedule/Schedule.cpp | 16 ++++- .../Schedule/WellPolymerProperties.cpp | 6 +- .../EclipseState/Tables/SkprpolyTable.cpp | 65 +++++++++++++++++++ .../EclipseState/Tables/SkprwatTable.cpp | 59 +++++++++++++++++ .../EclipseState/Tables/TableManager.cpp | 64 +++++++++++++++++- 11 files changed, 302 insertions(+), 3 deletions(-) create mode 100644 opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp create mode 100644 opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp create mode 100644 src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp create mode 100644 src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 25956ef7c..0e8ad7601 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -108,6 +108,8 @@ if(ENABLE_ECL_INPUT) src/opm/parser/eclipse/EclipseState/Tables/JFunc.cpp src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp + src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp + src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp src/opm/parser/eclipse/EclipseState/Tables/SimpleTable.cpp src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp @@ -395,6 +397,8 @@ if(ENABLE_ECL_INPUT) opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp opm/parser/eclipse/EclipseState/Tables/RsvdTable.hpp + opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp + opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp opm/parser/eclipse/EclipseState/Tables/SpecheatTable.hpp opm/parser/eclipse/EclipseState/Tables/SgcwmisTable.hpp opm/parser/eclipse/EclipseState/Tables/Sof2Table.hpp diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 96fb1702e..2316e2895 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -177,6 +177,7 @@ namespace Opm void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep); + void handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep); void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep); void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep ); diff --git a/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp index ed25b0b77..9f36aff3f 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp @@ -27,6 +27,8 @@ namespace Opm { double m_polymerConcentration; double m_saltConcentration; int m_plymwinjtable; + int m_skprwattable; + int m_skprpolytable; bool operator==(const WellPolymerProperties& other) const; bool operator!=(const WellPolymerProperties& other) const; diff --git a/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp b/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp new file mode 100644 index 000000000..404eae384 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp @@ -0,0 +1,42 @@ +/* + Copyright (C) 2018 Statoil ASA + + 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_SKPRPOLY_TABLE_HPP +#define OPM_PARSER_SKPRPOLY_TABLE_HPP + +#include +namespace Opm { + + class DeckKeyword; + + class SkprpolyTable : public Simple2DTable { + public: + + explicit SkprpolyTable(const DeckKeyword& table); + + double referenceConcentration() const; + + private: + double m_ref_polymer_concentration; + + }; + +} + +#endif //OPM_PARSER_SKPRPOLY_TABLE_HPP diff --git a/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp b/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp new file mode 100644 index 000000000..5f2700818 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp @@ -0,0 +1,37 @@ +/* + Copyright (C) 2018 Statoil ASA + + 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_SKPRWAT_TABLE_HPP +#define OPM_PARSER_SKPRWAT_TABLE_HPP + +#include +namespace Opm { + + class DeckKeyword; + + class SkprwatTable : public Simple2DTable { + public: + + explicit SkprwatTable(const DeckKeyword& table); + + }; + +} + +#endif //OPM_PARSER_SKPRWAT_TABLE_HPP diff --git a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp index ee7b4d1ef..99bfb701d 100644 --- a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp @@ -46,6 +46,8 @@ #include #include #include +#include +#include namespace Opm { @@ -123,6 +125,8 @@ namespace Opm { const ViscrefTable& getViscrefTable() const; const WatdentTable& getWatdentTable() const; const std::map& getPlymwinjTables() const; + const std::map& getSkprwatTables() const; + const std::map& getSkprpolyTables() const; /// deck has keyword "IMPTVD" --- Imbition end-point versus depth tables bool useImptvd() const; @@ -152,7 +156,10 @@ namespace Opm { void initPlymaxTables(const Deck& deck); void initPlyrockTables(const Deck& deck); void initPlyshlogTables(const Deck& deck); + // TODO: maybe the following three tables should go to one function void initPlymwinjTables(const Deck& deck); + void initSkprwatTables(const Deck& deck); + void initSkprpolyTables(const Deck& deck); @@ -291,6 +298,8 @@ namespace Opm { ViscrefTable m_viscrefTable; WatdentTable m_watdentTable; std::map m_plymwinjTables; + std::map m_skprwatTables; + std::map m_skprpolyTables; Tabdims m_tabdims; std::shared_ptr m_regdims; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 90906ad59..718fc32e5 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -779,7 +779,21 @@ namespace Opm { } - void Schedule::handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext) { + void Schedule::handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep) { + for (const auto& record : keyword) { + const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); + for (auto* well : getWells(wellNamePattern) ) { + // TODO: it needs to be an injector + WellPolymerProperties properties(well->getPolymerProperties(currentStep)); + properties.m_skprwattable = record.getItem("TABLE_NUMBER_WATER").get(0); + properties.m_skprpolytable = record.getItem("TABLE_NUMBER_POLYMER").get(0); + // TODO: some sanity check about the table number? + well->setPolymerProperties(currentStep, properties); + } + } + } + + for( const auto& record : keyword ) { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); WellEconProductionLimits econ_production_limits(record); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp index c62f7a560..e3e9f67a0 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp @@ -27,12 +27,16 @@ namespace Opm { m_polymerConcentration = 0.0; m_saltConcentration = 0.0; m_plymwinjtable = -1; // unusable table number + m_skprwattable = -1; + m_skprpolytable = -1; } bool WellPolymerProperties::operator==(const WellPolymerProperties& other) const { if ((m_polymerConcentration == other.m_polymerConcentration) && (m_saltConcentration == other.m_saltConcentration) && - (m_plymwinjtable == other.m_plymwinjtable) ) + (m_plymwinjtable == other.m_plymwinjtable) && + (m_skprwattable == other.m_skprwattable) && + (m_skprpolytable == other.m_skprpolytable) ) return true; else return false; diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp new file mode 100644 index 000000000..1594e4311 --- /dev/null +++ b/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp @@ -0,0 +1,65 @@ +/* + Copyright 2018 Statoil ASA. + + 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 . +*/ + +// TODO: this will go to Tables.cpp later. + +#include +#include +#include + + +namespace Opm{ + + SkprpolyTable::SkprpolyTable(const Opm::DeckKeyword &table) + { + using namespace ParserKeywords; + + const DeckRecord& record0 = table.getRecord(0); + m_table_number = record0.getItem().get< int >(0); + m_ref_polymer_concentration = record0.getItem().get< double >(0); + m_x_points = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_x_points.size(); + + if (table.size() != num_cols + 3) { + const std::string msg = "SKPRPOLY table " + std::to_string(m_table_number) + + " does not have enough records!"; + throw std::invalid_argument(msg); + } + + m_y_points = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_y_points.size(); + + for (size_t i = 3; i < table.size(); ++i) { + const DeckRecord& record_i = table.getRecord(i); + const std::vector& data_i = record_i.getItem().getSIDoubleData(); + if (data_i.size() != num_rows) { + const std::string msg = "SKPRPOLY table " + std::to_string(m_table_number) + + " record " + std::to_string(i) + + " does not have correct number of data "; + throw std::invalid_argument(msg); + } + m_data.push_back(data_i); + } + } + + double SkprpolyTable::referenceConcentration() const + { + return m_ref_polymer_concentration; + } +} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp new file mode 100644 index 000000000..5a3751125 --- /dev/null +++ b/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp @@ -0,0 +1,59 @@ +/* + Copyright 2018 Statoil ASA. + + 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 . +*/ + +// TODO: this will go to Tables.cpp later. + +#include +#include +#include + + +namespace Opm{ + + SkprwatTable::SkprwatTable(const Opm::DeckKeyword &table) + { + using namespace ParserKeywords; + + const DeckRecord& record0 = table.getRecord(0); + m_table_number = record0.getItem().get< int >(0); + m_x_points = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_x_points.size(); + + if (table.size() != num_cols + 3) { + const std::string msg = "SKPRWAT table " + std::to_string(m_table_number) + + " does not have enough records!"; + throw std::invalid_argument(msg); + } + + m_y_points = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_y_points.size(); + + for (size_t i = 3; i < table.size(); ++i) { + const DeckRecord& record_i = table.getRecord(i); + const std::vector& data_i = record_i.getItem().getSIDoubleData(); + if (data_i.size() != num_rows) { + const std::string msg = "SKPRWAT table " + std::to_string(m_table_number) + + " record " + std::to_string(i) + + " does not have correct number of data "; + throw std::invalid_argument(msg); + } + m_data.push_back(data_i); + } + } +} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp index d59ae4ceb..5d0132684 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include // Phase::PhaseEnum #include @@ -343,6 +344,8 @@ namespace Opm { initRocktabTables(deck); initPlyshlogTables(deck); initPlymwinjTables(deck); + initSkprpolyTables(deck); + initSkprwatTables(deck); } @@ -424,7 +427,7 @@ namespace Opm { } const size_t num_tables = deck.count("PLYMWINJ"); - const auto keywords = deck.getKeywordList(); + const auto& keywords = deck.getKeywordList(); for (size_t i = 0; i < num_tables; ++i) { const DeckKeyword &keyword = *keywords[i]; @@ -436,6 +439,32 @@ namespace Opm { // we should check if the table_number is valid if (m_plymwinjTables.find(table_number) == m_plymwinjTables.end()) { m_plymwinjTables.insert(std::make_pair(table_number, std::move(table))); + } else { + throw std::invalid_argument("Duplicated table number " + + std::to_string(table_number) + + " for keyword PLYMWINJ found"); + } + } + } + + void TableManager::initSkprwatTables(const Opm::Deck &deck) { + if (!deck.hasKeyword("SKPRWAT")) { + return; + } + + const size_t num_tables = deck.count("SKPRWAT"); + const auto& keywords = deck.getKeywordList(); + for (size_t i = 0; i < num_tables; ++i) { + const DeckKeyword &keyword = *keywords[i]; + + // not const for std::move + SkprwatTable table(keyword); + + // we need to check the value of the table_number against the allowed ones + const int table_number = table.getTableNumber(); + // we should check if the table_number is valid + if (m_skprwatTables.find(table_number) == m_skprwatTables.end()) { + m_skprwatTables.insert(std::make_pair(table_number, std::move(table))); } else { throw std::invalid_argument("Duplicated table number " + std::to_string(table_number) @@ -444,6 +473,31 @@ namespace Opm { } } + void TableManager::initSkprpolyTables(const Opm::Deck &deck) { + if (!deck.hasKeyword("SKPRPOLY")) { + return; + } + + const size_t num_tables = deck.count("SKPRPOLY"); + const auto& keywords = deck.getKeywordList(); + for (size_t i = 0; i < num_tables; ++i) { + const DeckKeyword &keyword = *keywords[i]; + + // not const for std::move + SkprpolyTable table(keyword); + + // we need to check the value of the table_number against the allowed ones + const int table_number = table.getTableNumber(); + // we should check if the table_number is valid + if (m_skprpolyTables.find(table_number) == m_skprpolyTables.end()) { + m_skprpolyTables.insert(std::make_pair(table_number, std::move(table))); + } else { + throw std::invalid_argument("Duplicated table number " + + std::to_string(table_number) + + " for keyword SKPRPOLY found"); + } + } + } void TableManager::initPlyrockTables(const Deck& deck) { size_t numTables = m_tabdims.getNumSatTables(); @@ -756,6 +810,14 @@ namespace Opm { return m_plymwinjTables; } + const std::map& TableManager::getSkprwatTables() const { + return m_skprwatTables; + } + + const std::map& TableManager::getSkprpolyTables() const { + return m_skprpolyTables; + } + bool TableManager::useImptvd() const { return hasImptvd; } From 082476f84095c624d6d0635b16a59e01d0314b3e Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Mon, 4 Jun 2018 12:04:17 +0200 Subject: [PATCH 07/12] fixing errors from rebasing. --- .../EclipseState/Schedule/Schedule.hpp | 20 ++++++------ .../EclipseState/Schedule/Schedule.cpp | 31 +++++++++++++++---- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 2316e2895..3b11fabc0 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -170,22 +170,22 @@ namespace Opm void handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, const ParseContext& parseContext); void handleCOMPLUMP( const DeckKeyword& keyword, size_t currentStep ); void handleWELSEGS( const DeckKeyword& keyword, size_t currentStep); - void handleCOMPSEGS( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid); void handleWCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep); - void handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep); + void handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext); + void handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext); void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep); - void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep ); - void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep); - void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep); - void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep); - void handleGEFAC( const DeckKeyword& keyword, size_t currentStep); - void handleWEFAC( const DeckKeyword& keyword, size_t currentStep); + void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext ); + void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); + void handleTUNING( const DeckKeyword& keyword, size_t currentStep); void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 718fc32e5..0b49b82f6 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -197,9 +197,11 @@ namespace Opm { else if (keyword.name() == "WTEMP") handleWTEMP(keyword, currentStep, parseContext); - else if (keyword.name() == "WPMITAB") - handleWPMITAB(keyword, currentStep); + else if (keyword.name() == "WPMITAB") + handleWPMITAB(keyword, currentStep, parseContext); + else if (keyword.name() == "WSKPTAB") + handleWSKPTAB(keyword, currentStep, parseContext); else if (keyword.name() == "WINJTEMP") handleWINJTEMP(keyword, currentStep, parseContext); @@ -765,10 +767,18 @@ namespace Opm { } - void Schedule::handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep) { + void Schedule::handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext) { + for (const auto& record : keyword) { + const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); - for (auto* well : getWells(wellNamePattern) ) { + const auto wells = getWells(wellNamePattern); + + if (wells.empty()) { + invalidNamePattern(wellNamePattern, parseContext, keyword); + } + + for (auto* well : wells) { // TODO: it needs to be an injector WellPolymerProperties properties(well->getPolymerProperties(currentStep)); properties.m_plymwinjtable = record.getItem("TABLE_NUMBER").get(0); @@ -779,10 +789,18 @@ namespace Opm { } - void Schedule::handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep) { + void Schedule::handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext) { + + for (const auto& record : keyword) { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); - for (auto* well : getWells(wellNamePattern) ) { + const auto wells = getWells(wellNamePattern); + + if (wells.empty()) { + invalidNamePattern(wellNamePattern, parseContext, keyword); + } + + for (auto* well : wells) { // TODO: it needs to be an injector WellPolymerProperties properties(well->getPolymerProperties(currentStep)); properties.m_skprwattable = record.getItem("TABLE_NUMBER_WATER").get(0); @@ -794,6 +812,7 @@ namespace Opm { } + void Schedule::handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext) { for( const auto& record : keyword ) { const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); WellEconProductionLimits econ_production_limits(record); From 862b3450d3ba7bf2643af87dc43e8736762427f1 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Tue, 9 Oct 2018 11:39:17 +0200 Subject: [PATCH 08/12] adding test for the following three keywords SKPRWAT, SKPRPOLY and PLYMWINJ . --- tests/parser/TableManagerTests.cpp | 240 +++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/tests/parser/TableManagerTests.cpp b/tests/parser/TableManagerTests.cpp index fd4856291..125e35f7d 100644 --- a/tests/parser/TableManagerTests.cpp +++ b/tests/parser/TableManagerTests.cpp @@ -1190,6 +1190,246 @@ VFPINJ \n\ } +BOOST_AUTO_TEST_CASE( TestPLYMWINJ ) { + const char *inputstring = + "PLYMWINJ \n" + " 2 / -- table number \n" + " 0.0 200.0 800.0 / -- throughput values \n" + " 0.0 1.0 2.0 3.0 / -- velocity values \n" + " -- the rest will be the polymer molecular weight \n" + " -- each row corresponds to one sample points in the throughput direction \n" + " 20. 19. 18. 16. /\n" + " 20. 16. 14. 12. /\n" + " 20. 12. 8. 4. /\n" + "PLYMWINJ \n" + " 3 / -- table number \n" + " 0.0 100.0 / -- throughput values \n" + " 0.0 1.0 2.0 / -- velocity values \n" + " -- the rest will be the polymer molecular weight \n" + " -- each row corresponds to one sample points in the throughput direction \n" + " 20. 19. 18. /\n" + " 20. 16. 14. /\n"; + + Opm::Parser parser; + const Opm::Deck deck = parser.parseString(inputstring, Opm::ParseContext()); + const Opm::TableManager tables( deck ); + const auto& plymwinjtables = tables.getPlymwinjTables(); + + BOOST_CHECK_EQUAL( plymwinjtables.size(), 2 ); + + BOOST_CHECK( plymwinjtables.find(1) == plymwinjtables.end() ); + + { + const auto searchtable2 = plymwinjtables.find(2); + BOOST_CHECK( searchtable2 != plymwinjtables.end() ); + const auto& table2 = searchtable2->second; + BOOST_CHECK_EQUAL( searchtable2->first, table2.getTableNumber() ); + BOOST_CHECK_EQUAL( table2.getTableNumber(), 2 ); + + const std::vector& throughputs = table2.getXSamplingPoints(); + BOOST_CHECK_EQUAL( throughputs.size(), 3 ); + BOOST_CHECK_EQUAL( throughputs[1], 200.0 ); + const std::vector& velocities = table2.getYSamplingPoints(); + BOOST_CHECK_EQUAL( velocities.size(), 4 ); + constexpr double dayinseconds = 86400.; + BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); + const std::vector>& mwdata = table2.getTableData(); + + BOOST_CHECK_EQUAL( mwdata.size(), throughputs.size() ); + for (const auto& data : mwdata) { + BOOST_CHECK_EQUAL( data.size(), velocities.size() ); + } + BOOST_CHECK_EQUAL(mwdata[2][3], 4.0); + BOOST_CHECK_EQUAL(mwdata[1][1], 16.0); + } + + { + const auto searchtable3 = plymwinjtables.find(3); + BOOST_CHECK( searchtable3 != plymwinjtables.end() ); + const auto& table3 = searchtable3->second; + BOOST_CHECK_EQUAL( searchtable3->first, table3.getTableNumber() ); + BOOST_CHECK_EQUAL( table3.getTableNumber(), 3 ); + + const std::vector& throughputs = table3.getXSamplingPoints(); + BOOST_CHECK_EQUAL( throughputs.size(), 2 ); + BOOST_CHECK_EQUAL( throughputs[1], 100.0 ); + const std::vector& velocities = table3.getYSamplingPoints(); + BOOST_CHECK_EQUAL( velocities.size(), 3 ); + constexpr double dayinseconds = 86400.; + BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); + const std::vector>& mwdata = table3.getTableData(); + + BOOST_CHECK_EQUAL( mwdata.size(), throughputs.size() ); + for (const auto& data : mwdata) { + BOOST_CHECK_EQUAL( data.size(), velocities.size() ); + } + BOOST_CHECK_EQUAL(mwdata[1][2], 14.0); + BOOST_CHECK_EQUAL(mwdata[0][0], 20.0); + } +} + +BOOST_AUTO_TEST_CASE( TestSKPRWAT ) { + const char *inputstring = + "SKPRWAT \n" + " 1 / -- table number \n" + " 0.0 200.0 800.0 / -- throughput values \n" + " 0.0 1.0 2.0 3.0 / -- velocity values \n" + " -- the rest will be the skin pressure \n" + " -- each row corresponds to one sample points in the throughput direction \n" + " 20. 19. 18. 16. /\n" + " 20. 16. 14. 12. /\n" + " 20. 12. 8. 4. /\n" + "SKPRWAT \n" + " 2 / -- table number \n" + " 0.0 100.0 / -- throughput values \n" + " 0.0 1.0 2.0 / -- velocity values \n" + " -- the rest will be the skin pressure \n" + " -- each row corresponds to one sample points in the throughput direction \n" + " 20. 19. 18. /\n" + " 20. 16. 14. /\n"; + + Opm::Parser parser; + const Opm::Deck deck = parser.parseString(inputstring, Opm::ParseContext()); + const Opm::TableManager tables( deck ); + const auto& skprwattables = tables.getSkprwatTables(); + + BOOST_CHECK_EQUAL( skprwattables.size(), 2 ); + + BOOST_CHECK( skprwattables.find(3) == skprwattables.end() ); + + { + const auto searchtable1 = skprwattables.find(1); + BOOST_CHECK( searchtable1 != skprwattables.end() ); + const auto& table1 = searchtable1->second; + BOOST_CHECK_EQUAL( searchtable1->first, table1.getTableNumber() ); + BOOST_CHECK_EQUAL( table1.getTableNumber(), 1 ); + + const std::vector& throughputs = table1.getXSamplingPoints(); + BOOST_CHECK_EQUAL( throughputs.size(), 3 ); + BOOST_CHECK_EQUAL( throughputs[1], 200.0 ); + const std::vector& velocities = table1.getYSamplingPoints(); + BOOST_CHECK_EQUAL( velocities.size(), 4 ); + constexpr double dayinseconds = 86400.; + BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); + const std::vector>& skindata = table1.getTableData(); + + BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); + for (const auto& data : skindata) { + BOOST_CHECK_EQUAL( data.size(), velocities.size() ); + } + constexpr double barsa = 1.0e5; + BOOST_CHECK_EQUAL(skindata[2][3], 4.0 * barsa); + BOOST_CHECK_EQUAL(skindata[1][1], 16.0 * barsa); + } + + { + const auto searchtable2 = skprwattables.find(2); + BOOST_CHECK( searchtable2 != skprwattables.end() ); + const auto& table2 = searchtable2->second; + BOOST_CHECK_EQUAL( searchtable2->first, table2.getTableNumber() ); + BOOST_CHECK_EQUAL( table2.getTableNumber(), 2 ); + + const std::vector& throughputs = table2.getXSamplingPoints(); + BOOST_CHECK_EQUAL( throughputs.size(), 2 ); + BOOST_CHECK_EQUAL( throughputs[1], 100.0 ); + const std::vector& velocities = table2.getYSamplingPoints(); + BOOST_CHECK_EQUAL( velocities.size(), 3 ); + constexpr double dayinseconds = 86400.; + BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); + const std::vector>& skindata = table2.getTableData(); + + BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); + for (const auto& data : skindata) { + BOOST_CHECK_EQUAL( data.size(), velocities.size() ); + } + constexpr double barsa = 1.0e5; + BOOST_CHECK_EQUAL(skindata[1][2], 14.0 * barsa); + BOOST_CHECK_EQUAL(skindata[0][0], 20.0 * barsa); + } +} + +BOOST_AUTO_TEST_CASE( TestSKPRPOLY ) { + const char *inputstring = + "SKPRPOLY \n" + " 1 2.0 / -- table number & reference concentration \n" + " 0.0 200.0 800.0 / -- throughput values \n" + " 0.0 1.0 2.0 3.0 / -- velocity values \n" + " -- the rest will be the skin pressure \n" + " -- each row corresponds to one sample points in the throughput direction \n" + " 20. 19. 18. 16. /\n" + " 20. 16. 14. 12. /\n" + " 20. 12. 8. 4. /\n" + "SKPRPOLY \n" + " 2 3.0 / -- table number & reference concentration \n" + " 0.0 100.0 / -- throughput values \n" + " 0.0 1.0 2.0 / -- velocity values \n" + " -- the rest will be the skin pressure \n" + " -- each row corresponds to one sample points in the throughput direction \n" + " 20. 19. 18. /\n" + " 20. 16. 14. /\n"; + + Opm::Parser parser; + const Opm::Deck deck = parser.parseString(inputstring, Opm::ParseContext()); + const Opm::TableManager tables( deck ); + const auto& skprpolytables = tables.getSkprpolyTables(); + + BOOST_CHECK_EQUAL( skprpolytables.size(), 2 ); + + BOOST_CHECK( skprpolytables.find(4) == skprpolytables.end() ); + + { + const auto searchtable1 = skprpolytables.find(1); + BOOST_CHECK( searchtable1 != skprpolytables.end() ); + const auto& table1 = searchtable1->second; + BOOST_CHECK_EQUAL( searchtable1->first, table1.getTableNumber() ); + BOOST_CHECK_EQUAL( table1.getTableNumber(), 1 ); + + BOOST_CHECK_EQUAL( table1.referenceConcentration(), 2.0 ); + const std::vector& throughputs = table1.getXSamplingPoints(); + BOOST_CHECK_EQUAL( throughputs.size(), 3 ); + BOOST_CHECK_EQUAL( throughputs[1], 200.0 ); + const std::vector& velocities = table1.getYSamplingPoints(); + BOOST_CHECK_EQUAL( velocities.size(), 4 ); + constexpr double dayinseconds = 86400.; + BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); + const std::vector>& skindata = table1.getTableData(); + + BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); + for (const auto& data : skindata) { + BOOST_CHECK_EQUAL( data.size(), velocities.size() ); + } + constexpr double barsa = 1.0e5; + BOOST_CHECK_EQUAL(skindata[2][3], 4.0 * barsa); + BOOST_CHECK_EQUAL(skindata[1][1], 16.0 * barsa); + } + + { + const auto searchtable2 = skprpolytables.find(2); + BOOST_CHECK( searchtable2 != skprpolytables.end() ); + const auto& table2 = searchtable2->second; + BOOST_CHECK_EQUAL( searchtable2->first, table2.getTableNumber() ); + BOOST_CHECK_EQUAL( table2.getTableNumber(), 2 ); + + BOOST_CHECK_EQUAL( table2.referenceConcentration(), 3.0 ); + const std::vector& throughputs = table2.getXSamplingPoints(); + BOOST_CHECK_EQUAL( throughputs.size(), 2 ); + BOOST_CHECK_EQUAL( throughputs[1], 100.0 ); + const std::vector& velocities = table2.getYSamplingPoints(); + BOOST_CHECK_EQUAL( velocities.size(), 3 ); + constexpr double dayinseconds = 86400.; + BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); + const std::vector>& skindata = table2.getTableData(); + + BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); + for (const auto& data : skindata) { + BOOST_CHECK_EQUAL( data.size(), velocities.size() ); + } + constexpr double barsa = 1.0e5; + BOOST_CHECK_EQUAL(skindata[1][2], 14.0 * barsa); + BOOST_CHECK_EQUAL(skindata[0][0], 20.0 * barsa); + } +} + BOOST_AUTO_TEST_CASE( TestPLYROCK ) { const char *data = "TABDIMS\n" From 2bf33c30d852a0921ebb4a642af9905f8e83deed Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Tue, 9 Oct 2018 12:48:11 +0200 Subject: [PATCH 09/12] some cleaning up and sanity checks. --- opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp | 2 -- .../eclipse/EclipseState/Tables/Simple2DTable.hpp | 3 --- .../eclipse/EclipseState/Tables/TableManager.hpp | 2 +- .../parser/eclipse/EclipseState/Schedule/Schedule.cpp | 10 ++++++---- .../eclipse/EclipseState/Tables/PlymwinjTable.cpp | 4 ++++ .../eclipse/EclipseState/Tables/SkprpolyTable.cpp | 10 ++++++++++ .../eclipse/EclipseState/Tables/SkprwatTable.cpp | 4 ++++ 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 3b11fabc0..10398f3b5 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -185,8 +185,6 @@ namespace Opm void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext); - - void handleTUNING( const DeckKeyword& keyword, size_t currentStep); void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep); void handleGRUPNET( const DeckKeyword& keyword, size_t currentStep); diff --git a/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp b/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp index 50c9e65e1..7a7092cde 100644 --- a/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp @@ -20,9 +20,6 @@ #ifndef OPM_PARSER_SIMPLE_2D_TABLE_HPP #define OPM_PARSER_SIMPLE_2D_TABLE_HPP -// TODO: it is a simple version to begin with, will check whether to introduce -// the Schemas and TableColumn - #include namespace Opm { diff --git a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp index 99bfb701d..544e28224 100644 --- a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp @@ -156,7 +156,7 @@ namespace Opm { void initPlymaxTables(const Deck& deck); void initPlyrockTables(const Deck& deck); void initPlyshlogTables(const Deck& deck); - // TODO: maybe the following three tables should go to one function + void initPlymwinjTables(const Deck& deck); void initSkprwatTables(const Deck& deck); void initSkprpolyTables(const Deck& deck); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 0b49b82f6..840800fae 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -779,10 +779,11 @@ namespace Opm { } for (auto* well : wells) { - // TODO: it needs to be an injector + if (well->isProducer(currentStep) ) { + throw std::logic_error("WPMITAB keyword can not be applied to production well " + well->name() ); + } WellPolymerProperties properties(well->getPolymerProperties(currentStep)); properties.m_plymwinjtable = record.getItem("TABLE_NUMBER").get(0); - // TODO: some sanity check about the table number? well->setPolymerProperties(currentStep, properties); } } @@ -801,11 +802,12 @@ namespace Opm { } for (auto* well : wells) { - // TODO: it needs to be an injector + if (well->isProducer(currentStep) ) { + throw std::logic_error("WSKPTAB can not be applied to production well " + well->name() ); + } WellPolymerProperties properties(well->getPolymerProperties(currentStep)); properties.m_skprwattable = record.getItem("TABLE_NUMBER_WATER").get(0); properties.m_skprpolytable = record.getItem("TABLE_NUMBER_POLYMER").get(0); - // TODO: some sanity check about the table number? well->setPolymerProperties(currentStep, properties); } } diff --git a/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp index 17757f7f5..7af1adb29 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp @@ -32,6 +32,10 @@ namespace Opm{ const DeckRecord& record0 = table.getRecord(0); m_table_number = record0.getItem().get< int >(0); + if (m_table_number <= 0) { + const std::string msg = "PLYMWINJ table has non-positive table number " + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } m_x_points = table.getRecord(1).getItem().getSIDoubleData(); const size_t num_cols = m_x_points.size(); diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp index 1594e4311..4c4c42ce3 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp @@ -32,7 +32,17 @@ namespace Opm{ const DeckRecord& record0 = table.getRecord(0); m_table_number = record0.getItem().get< int >(0); + if (m_table_number <= 0) { + const std::string msg = "SKPRPOLY table has non-positive table number " + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } m_ref_polymer_concentration = record0.getItem().get< double >(0); + if (m_ref_polymer_concentration <= 0.) { + const std::string msg = "Non-positive reference polymer concentration is specified for SKPRPOLY table "i + + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } + m_x_points = table.getRecord(1).getItem().getSIDoubleData(); const size_t num_cols = m_x_points.size(); diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp index 5a3751125..65df509ee 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp @@ -32,6 +32,10 @@ namespace Opm{ const DeckRecord& record0 = table.getRecord(0); m_table_number = record0.getItem().get< int >(0); + if (m_table_number <= 0) { + const std::string msg = "SKPRWAT table has non-positive table number " + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } m_x_points = table.getRecord(1).getItem().getSIDoubleData(); const size_t num_cols = m_x_points.size(); From 316324a78e996ca8ef22716c5687cc5b2af8762f Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Tue, 16 Oct 2018 16:35:35 +0200 Subject: [PATCH 10/12] renaming Simple2DTable to PolyInjTable make it more clear that it is a talbe introduced for the polymer injectivity study, not intended for general usage. --- CMakeLists_files.cmake | 4 +-- .../EclipseState/Tables/PlymwinjTable.hpp | 5 +-- .../{Simple2DTable.hpp => PolyInjTable.hpp} | 33 ++++++++++++----- .../EclipseState/Tables/SkprpolyTable.hpp | 6 ++-- .../EclipseState/Tables/SkprwatTable.hpp | 6 ++-- .../EclipseState/Tables/PlymwinjTable.cpp | 16 ++++++--- .../{Simple2DTable.cpp => PolyInjTable.cpp} | 14 ++++---- .../EclipseState/Tables/SkprpolyTable.cpp | 18 +++++++--- .../EclipseState/Tables/SkprwatTable.cpp | 16 ++++++--- tests/parser/TableManagerTests.cpp | 36 +++++++++---------- 10 files changed, 100 insertions(+), 54 deletions(-) rename opm/parser/eclipse/EclipseState/Tables/{Simple2DTable.hpp => PolyInjTable.hpp} (60%) rename src/opm/parser/eclipse/EclipseState/Tables/{Simple2DTable.cpp => PolyInjTable.cpp} (68%) diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 0e8ad7601..9fde118ae 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -111,7 +111,7 @@ if(ENABLE_ECL_INPUT) src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp src/opm/parser/eclipse/EclipseState/Tables/SimpleTable.cpp - src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp + src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp src/opm/parser/eclipse/EclipseState/Tables/TableContainer.cpp src/opm/parser/eclipse/EclipseState/Tables/TableIndex.cpp @@ -384,7 +384,7 @@ if(ENABLE_ECL_INPUT) opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp opm/parser/eclipse/EclipseState/EndpointScaling.hpp opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp - opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp + opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp opm/parser/eclipse/EclipseState/Tables/TlpmixpaTable.hpp opm/parser/eclipse/EclipseState/Tables/PvdgTable.hpp diff --git a/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp index bd9fdc90c..47b7d897d 100644 --- a/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp @@ -20,16 +20,17 @@ #ifndef OPM_PARSER_PLYMWINJ_TABLE_HPP #define OPM_PARSER_PLYMWINJ_TABLE_HPP -#include +#include namespace Opm { class DeckKeyword; - class PlymwinjTable : public Simple2DTable { + class PlymwinjTable : public PolyInjTable { public: explicit PlymwinjTable(const DeckKeyword& table); + const std::vector>& getMoleWeights() const; }; } diff --git a/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp similarity index 60% rename from opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp rename to opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp index 7a7092cde..87fd2bd4c 100644 --- a/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp @@ -17,25 +17,42 @@ along with OPM. If not, see . */ -#ifndef OPM_PARSER_SIMPLE_2D_TABLE_HPP -#define OPM_PARSER_SIMPLE_2D_TABLE_HPP +#ifndef OPM_PARSER_POLY_INJ_TABLE_HPP +#define OPM_PARSER_POLY_INJ_TABLE_HPP + + +/* This class is introduced for the following keywords related to polymer injectivity study. + * PLYMWINJ, SKPRWAT, SKPRPOLY . + * These keywords share very similar structure with small difference. + * + * KEYWORD + * 1 / --table number + * 0 20 30 / -- water throughputs + * 0 0.1 0.2 0.3 / -- water velocities + * -- the rest is the table data, + * -- each row corresponds to one value in throughputs + * -- each column corresponds to one value in water velocities + * 20 19 18 17 / + * 20 18 17 16 / + * 20 17 16 15 / + */ #include namespace Opm { - class Simple2DTable { + class PolyInjTable { public: int getTableNumber() const; - const std::vector& getXSamplingPoints() const; - const std::vector& getYSamplingPoints() const; + const std::vector& getThroughputs() const; + const std::vector& getVelocities() const; const std::vector>& getTableData() const; protected: - std::vector m_x_points; - std::vector m_y_points; + std::vector m_throughputs; + std::vector m_velocities; // TODO: maybe not needed, since this is also stored in the std::map int m_table_number; @@ -47,4 +64,4 @@ namespace Opm { }; } -#endif // OPM_PARSER_SIMPLE_2D_TABLE_HPP +#endif // OPM_PARSER_POLY_INJ_TABLE_HPP diff --git a/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp b/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp index 404eae384..a86597c5f 100644 --- a/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp @@ -20,18 +20,20 @@ #ifndef OPM_PARSER_SKPRPOLY_TABLE_HPP #define OPM_PARSER_SKPRPOLY_TABLE_HPP -#include +#include namespace Opm { class DeckKeyword; - class SkprpolyTable : public Simple2DTable { + class SkprpolyTable : public PolyInjTable { public: explicit SkprpolyTable(const DeckKeyword& table); double referenceConcentration() const; + const std::vector>& getSkinPressures() const; + private: double m_ref_polymer_concentration; diff --git a/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp b/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp index 5f2700818..530068fb2 100644 --- a/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp @@ -20,16 +20,18 @@ #ifndef OPM_PARSER_SKPRWAT_TABLE_HPP #define OPM_PARSER_SKPRWAT_TABLE_HPP -#include +#include namespace Opm { class DeckKeyword; - class SkprwatTable : public Simple2DTable { + class SkprwatTable : public PolyInjTable { public: explicit SkprwatTable(const DeckKeyword& table); + const std::vector>& getSkinPressures() const; + }; } diff --git a/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp index 7af1adb29..e376cbad1 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp @@ -31,13 +31,15 @@ namespace Opm{ using namespace ParserKeywords; const DeckRecord& record0 = table.getRecord(0); + m_table_number = record0.getItem().get< int >(0); if (m_table_number <= 0) { const std::string msg = "PLYMWINJ table has non-positive table number " + std::to_string(m_table_number); throw std::invalid_argument(msg); } - m_x_points = table.getRecord(1).getItem().getSIDoubleData(); - const size_t num_cols = m_x_points.size(); + + m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_throughputs.size(); if (table.size() != num_cols + 3) { const std::string msg = "PLYMWINJ table " + std::to_string(m_table_number) @@ -45,8 +47,8 @@ namespace Opm{ throw std::invalid_argument(msg); } - m_y_points = table.getRecord(2).getItem().getSIDoubleData(); - const size_t num_rows = m_y_points.size(); + m_velocities = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_velocities.size(); for (size_t i = 3; i < table.size(); ++i) { const DeckRecord& record_i = table.getRecord(i); @@ -60,4 +62,10 @@ namespace Opm{ m_data.push_back(data_i); } } + + const std::vector>& + PlymwinjTable::getMoleWeights() const + { + return getTableData(); + } } diff --git a/src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp similarity index 68% rename from src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp rename to src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp index 9cfdd7835..1eaa1f604 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/Simple2DTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp @@ -19,27 +19,27 @@ // TODO: this will go to Tables.cpp later. -#include +#include namespace Opm{ - int Simple2DTable::getTableNumber() const + int PolyInjTable::getTableNumber() const { return m_table_number; } - const std::vector& Simple2DTable::getXSamplingPoints() const + const std::vector& PolyInjTable::getThroughputs() const { - return m_x_points; + return m_throughputs; } - const std::vector& Simple2DTable::getYSamplingPoints() const + const std::vector& PolyInjTable::getVelocities() const { - return m_y_points; + return m_velocities; } - const std::vector>& Simple2DTable::getTableData() const + const std::vector>& PolyInjTable::getTableData() const { return m_data; } diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp index 4c4c42ce3..a658649c9 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp @@ -31,20 +31,22 @@ namespace Opm{ using namespace ParserKeywords; const DeckRecord& record0 = table.getRecord(0); + m_table_number = record0.getItem().get< int >(0); if (m_table_number <= 0) { const std::string msg = "SKPRPOLY table has non-positive table number " + std::to_string(m_table_number); throw std::invalid_argument(msg); } + m_ref_polymer_concentration = record0.getItem().get< double >(0); if (m_ref_polymer_concentration <= 0.) { - const std::string msg = "Non-positive reference polymer concentration is specified for SKPRPOLY table "i + const std::string msg = "Non-positive reference polymer concentration is specified for SKPRPOLY table " + std::to_string(m_table_number); throw std::invalid_argument(msg); } - m_x_points = table.getRecord(1).getItem().getSIDoubleData(); - const size_t num_cols = m_x_points.size(); + m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_throughputs.size(); if (table.size() != num_cols + 3) { const std::string msg = "SKPRPOLY table " + std::to_string(m_table_number) @@ -52,8 +54,8 @@ namespace Opm{ throw std::invalid_argument(msg); } - m_y_points = table.getRecord(2).getItem().getSIDoubleData(); - const size_t num_rows = m_y_points.size(); + m_velocities = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_velocities.size(); for (size_t i = 3; i < table.size(); ++i) { const DeckRecord& record_i = table.getRecord(i); @@ -72,4 +74,10 @@ namespace Opm{ { return m_ref_polymer_concentration; } + + const std::vector>& + SkprpolyTable::getSkinPressures() const + { + return getTableData(); + } } diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp index 65df509ee..9d5776537 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp @@ -31,13 +31,15 @@ namespace Opm{ using namespace ParserKeywords; const DeckRecord& record0 = table.getRecord(0); + m_table_number = record0.getItem().get< int >(0); if (m_table_number <= 0) { const std::string msg = "SKPRWAT table has non-positive table number " + std::to_string(m_table_number); throw std::invalid_argument(msg); } - m_x_points = table.getRecord(1).getItem().getSIDoubleData(); - const size_t num_cols = m_x_points.size(); + + m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_throughputs.size(); if (table.size() != num_cols + 3) { const std::string msg = "SKPRWAT table " + std::to_string(m_table_number) @@ -45,8 +47,8 @@ namespace Opm{ throw std::invalid_argument(msg); } - m_y_points = table.getRecord(2).getItem().getSIDoubleData(); - const size_t num_rows = m_y_points.size(); + m_velocities = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_velocities.size(); for (size_t i = 3; i < table.size(); ++i) { const DeckRecord& record_i = table.getRecord(i); @@ -60,4 +62,10 @@ namespace Opm{ m_data.push_back(data_i); } } + + const std::vector>& + SkprwatTable::getSkinPressures() const + { + return getTableData(); + } } diff --git a/tests/parser/TableManagerTests.cpp b/tests/parser/TableManagerTests.cpp index 125e35f7d..e23fdec07 100644 --- a/tests/parser/TableManagerTests.cpp +++ b/tests/parser/TableManagerTests.cpp @@ -1226,14 +1226,14 @@ BOOST_AUTO_TEST_CASE( TestPLYMWINJ ) { BOOST_CHECK_EQUAL( searchtable2->first, table2.getTableNumber() ); BOOST_CHECK_EQUAL( table2.getTableNumber(), 2 ); - const std::vector& throughputs = table2.getXSamplingPoints(); + const std::vector& throughputs = table2.getThroughputs(); BOOST_CHECK_EQUAL( throughputs.size(), 3 ); BOOST_CHECK_EQUAL( throughputs[1], 200.0 ); - const std::vector& velocities = table2.getYSamplingPoints(); + const std::vector& velocities = table2.getVelocities(); BOOST_CHECK_EQUAL( velocities.size(), 4 ); constexpr double dayinseconds = 86400.; BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); - const std::vector>& mwdata = table2.getTableData(); + const std::vector>& mwdata = table2.getMoleWeights(); BOOST_CHECK_EQUAL( mwdata.size(), throughputs.size() ); for (const auto& data : mwdata) { @@ -1250,14 +1250,14 @@ BOOST_AUTO_TEST_CASE( TestPLYMWINJ ) { BOOST_CHECK_EQUAL( searchtable3->first, table3.getTableNumber() ); BOOST_CHECK_EQUAL( table3.getTableNumber(), 3 ); - const std::vector& throughputs = table3.getXSamplingPoints(); + const std::vector& throughputs = table3.getThroughputs(); BOOST_CHECK_EQUAL( throughputs.size(), 2 ); BOOST_CHECK_EQUAL( throughputs[1], 100.0 ); - const std::vector& velocities = table3.getYSamplingPoints(); + const std::vector& velocities = table3.getVelocities(); BOOST_CHECK_EQUAL( velocities.size(), 3 ); constexpr double dayinseconds = 86400.; BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); - const std::vector>& mwdata = table3.getTableData(); + const std::vector>& mwdata = table3.getMoleWeights(); BOOST_CHECK_EQUAL( mwdata.size(), throughputs.size() ); for (const auto& data : mwdata) { @@ -1304,14 +1304,14 @@ BOOST_AUTO_TEST_CASE( TestSKPRWAT ) { BOOST_CHECK_EQUAL( searchtable1->first, table1.getTableNumber() ); BOOST_CHECK_EQUAL( table1.getTableNumber(), 1 ); - const std::vector& throughputs = table1.getXSamplingPoints(); + const std::vector& throughputs = table1.getThroughputs(); BOOST_CHECK_EQUAL( throughputs.size(), 3 ); BOOST_CHECK_EQUAL( throughputs[1], 200.0 ); - const std::vector& velocities = table1.getYSamplingPoints(); + const std::vector& velocities = table1.getVelocities(); BOOST_CHECK_EQUAL( velocities.size(), 4 ); constexpr double dayinseconds = 86400.; BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); - const std::vector>& skindata = table1.getTableData(); + const std::vector>& skindata = table1.getSkinPressures(); BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); for (const auto& data : skindata) { @@ -1329,14 +1329,14 @@ BOOST_AUTO_TEST_CASE( TestSKPRWAT ) { BOOST_CHECK_EQUAL( searchtable2->first, table2.getTableNumber() ); BOOST_CHECK_EQUAL( table2.getTableNumber(), 2 ); - const std::vector& throughputs = table2.getXSamplingPoints(); + const std::vector& throughputs = table2.getThroughputs(); BOOST_CHECK_EQUAL( throughputs.size(), 2 ); BOOST_CHECK_EQUAL( throughputs[1], 100.0 ); - const std::vector& velocities = table2.getYSamplingPoints(); + const std::vector& velocities = table2.getVelocities(); BOOST_CHECK_EQUAL( velocities.size(), 3 ); constexpr double dayinseconds = 86400.; BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); - const std::vector>& skindata = table2.getTableData(); + const std::vector>& skindata = table2.getSkinPressures(); BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); for (const auto& data : skindata) { @@ -1385,14 +1385,14 @@ BOOST_AUTO_TEST_CASE( TestSKPRPOLY ) { BOOST_CHECK_EQUAL( table1.getTableNumber(), 1 ); BOOST_CHECK_EQUAL( table1.referenceConcentration(), 2.0 ); - const std::vector& throughputs = table1.getXSamplingPoints(); + const std::vector& throughputs = table1.getThroughputs(); BOOST_CHECK_EQUAL( throughputs.size(), 3 ); BOOST_CHECK_EQUAL( throughputs[1], 200.0 ); - const std::vector& velocities = table1.getYSamplingPoints(); + const std::vector& velocities = table1.getVelocities(); BOOST_CHECK_EQUAL( velocities.size(), 4 ); constexpr double dayinseconds = 86400.; BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); - const std::vector>& skindata = table1.getTableData(); + const std::vector>& skindata = table1.getSkinPressures(); BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); for (const auto& data : skindata) { @@ -1411,14 +1411,14 @@ BOOST_AUTO_TEST_CASE( TestSKPRPOLY ) { BOOST_CHECK_EQUAL( table2.getTableNumber(), 2 ); BOOST_CHECK_EQUAL( table2.referenceConcentration(), 3.0 ); - const std::vector& throughputs = table2.getXSamplingPoints(); + const std::vector& throughputs = table2.getThroughputs(); BOOST_CHECK_EQUAL( throughputs.size(), 2 ); BOOST_CHECK_EQUAL( throughputs[1], 100.0 ); - const std::vector& velocities = table2.getYSamplingPoints(); + const std::vector& velocities = table2.getVelocities(); BOOST_CHECK_EQUAL( velocities.size(), 3 ); constexpr double dayinseconds = 86400.; BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds ); - const std::vector>& skindata = table2.getTableData(); + const std::vector>& skindata = table2.getSkinPressures(); BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() ); for (const auto& data : skindata) { From 1b8680df7d5a4f7fba0218fdd964d8ca0c511810 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 18 Oct 2018 13:25:35 +0200 Subject: [PATCH 11/12] implmentation of the polymer injectivity tables in one file Moving PlymwinjTable.cpp PolyInjTable.cpp SkprpolyTable.cpp SkprwatTable.cpp into one single file PolyInjTables.cpp for better organization --- CMakeLists_files.cmake | 5 +- .../EclipseState/Tables/PlymwinjTable.cpp | 71 ------ .../EclipseState/Tables/PolyInjTable.cpp | 46 ---- .../EclipseState/Tables/PolyInjTables.cpp | 212 ++++++++++++++++++ .../EclipseState/Tables/SkprpolyTable.cpp | 83 ------- .../EclipseState/Tables/SkprwatTable.cpp | 71 ------ 6 files changed, 213 insertions(+), 275 deletions(-) delete mode 100644 src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp delete mode 100644 src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp create mode 100644 src/opm/parser/eclipse/EclipseState/Tables/PolyInjTables.cpp delete mode 100644 src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp delete mode 100644 src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 9fde118ae..d3b7842f3 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -106,12 +106,9 @@ if(ENABLE_ECL_INPUT) src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp src/opm/parser/eclipse/EclipseState/Tables/ColumnSchema.cpp src/opm/parser/eclipse/EclipseState/Tables/JFunc.cpp - src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp - src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp - src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp src/opm/parser/eclipse/EclipseState/Tables/SimpleTable.cpp - src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp + src/opm/parser/eclipse/EclipseState/Tables/PolyInjTables.cpp src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp src/opm/parser/eclipse/EclipseState/Tables/TableContainer.cpp src/opm/parser/eclipse/EclipseState/Tables/TableIndex.cpp diff --git a/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp deleted file mode 100644 index e376cbad1..000000000 --- a/src/opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright 2018 Statoil ASA. - - 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 . -*/ - -// TODO: this will go to Tables.cpp later. - -#include -#include -#include - - -namespace Opm{ - - PlymwinjTable::PlymwinjTable(const Opm::DeckKeyword& table) - { - using namespace ParserKeywords; - - const DeckRecord& record0 = table.getRecord(0); - - m_table_number = record0.getItem().get< int >(0); - if (m_table_number <= 0) { - const std::string msg = "PLYMWINJ table has non-positive table number " + std::to_string(m_table_number); - throw std::invalid_argument(msg); - } - - m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); - const size_t num_cols = m_throughputs.size(); - - if (table.size() != num_cols + 3) { - const std::string msg = "PLYMWINJ table " + std::to_string(m_table_number) - + " does not have enough records!"; - throw std::invalid_argument(msg); - } - - m_velocities = table.getRecord(2).getItem().getSIDoubleData(); - const size_t num_rows = m_velocities.size(); - - for (size_t i = 3; i < table.size(); ++i) { - const DeckRecord& record_i = table.getRecord(i); - const std::vector& data_i = record_i.getItem().getSIDoubleData(); - if (data_i.size() != num_rows) { - const std::string msg = "PLYMWINJ table " + std::to_string(m_table_number) - + " record " + std::to_string(i) - + " does not have correct number of data "; - throw std::invalid_argument(msg); - } - m_data.push_back(data_i); - } - } - - const std::vector>& - PlymwinjTable::getMoleWeights() const - { - return getTableData(); - } -} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp deleted file mode 100644 index 1eaa1f604..000000000 --- a/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTable.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright 2018 Statoil ASA. - - 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 . -*/ - -// TODO: this will go to Tables.cpp later. - -#include - - -namespace Opm{ - - int PolyInjTable::getTableNumber() const - { - return m_table_number; - } - - const std::vector& PolyInjTable::getThroughputs() const - { - return m_throughputs; - } - - const std::vector& PolyInjTable::getVelocities() const - { - return m_velocities; - } - - const std::vector>& PolyInjTable::getTableData() const - { - return m_data; - } -} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTables.cpp b/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTables.cpp new file mode 100644 index 000000000..7b9ea1d43 --- /dev/null +++ b/src/opm/parser/eclipse/EclipseState/Tables/PolyInjTables.cpp @@ -0,0 +1,212 @@ +/* + Copyright 2018 Statoil ASA. + + 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 . +*/ + + +/* This is the implementation for the following three keywords related to + * polymer injectivity study : + * PLYMWINJ, SKPRWAT, SKPRPOLY + */ + +#include + +#include +#include + +#include +#include +#include +#include + + +namespace Opm{ + + // PolyInjTable + + int PolyInjTable::getTableNumber() const + { + return m_table_number; + } + + const std::vector& PolyInjTable::getThroughputs() const + { + return m_throughputs; + } + + const std::vector& PolyInjTable::getVelocities() const + { + return m_velocities; + } + + const std::vector>& PolyInjTable::getTableData() const + { + return m_data; + } + + + + // PlymwinjTable + + PlymwinjTable::PlymwinjTable(const Opm::DeckKeyword& table) + { + using namespace ParserKeywords; + + const DeckRecord& record0 = table.getRecord(0); + + m_table_number = record0.getItem().get< int >(0); + if (m_table_number <= 0) { + const std::string msg = "PLYMWINJ table has non-positive table number " + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } + + m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_throughputs.size(); + + if (table.size() != num_cols + 3) { + const std::string msg = "PLYMWINJ table " + std::to_string(m_table_number) + + " does not have enough records!"; + throw std::invalid_argument(msg); + } + + m_velocities = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_velocities.size(); + + for (size_t i = 3; i < table.size(); ++i) { + const DeckRecord& record_i = table.getRecord(i); + const std::vector& data_i = record_i.getItem().getSIDoubleData(); + if (data_i.size() != num_rows) { + const std::string msg = "PLYMWINJ table " + std::to_string(m_table_number) + + " record " + std::to_string(i) + + " does not have correct number of data "; + throw std::invalid_argument(msg); + } + m_data.push_back(data_i); + } + } + + const std::vector>& + PlymwinjTable::getMoleWeights() const + { + return getTableData(); + } + + + // SkprwatTable + + SkprwatTable::SkprwatTable(const Opm::DeckKeyword &table) + { + using namespace ParserKeywords; + + const DeckRecord& record0 = table.getRecord(0); + + m_table_number = record0.getItem().get< int >(0); + if (m_table_number <= 0) { + const std::string msg = "SKPRWAT table has non-positive table number " + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } + + m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_throughputs.size(); + + if (table.size() != num_cols + 3) { + const std::string msg = "SKPRWAT table " + std::to_string(m_table_number) + + " does not have enough records!"; + throw std::invalid_argument(msg); + } + + m_velocities = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_velocities.size(); + + for (size_t i = 3; i < table.size(); ++i) { + const DeckRecord& record_i = table.getRecord(i); + const std::vector& data_i = record_i.getItem().getSIDoubleData(); + if (data_i.size() != num_rows) { + const std::string msg = "SKPRWAT table " + std::to_string(m_table_number) + + " record " + std::to_string(i) + + " does not have correct number of data "; + throw std::invalid_argument(msg); + } + m_data.push_back(data_i); + } + } + + const std::vector>& + SkprwatTable::getSkinPressures() const + { + return getTableData(); + } + + + // SkprpolyTable + + SkprpolyTable::SkprpolyTable(const Opm::DeckKeyword &table) + { + using namespace ParserKeywords; + + const DeckRecord& record0 = table.getRecord(0); + + m_table_number = record0.getItem().get< int >(0); + if (m_table_number <= 0) { + const std::string msg = "SKPRPOLY table has non-positive table number " + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } + + m_ref_polymer_concentration = record0.getItem().get< double >(0); + if (m_ref_polymer_concentration <= 0.) { + const std::string msg = "Non-positive reference polymer concentration is specified for SKPRPOLY table " + + std::to_string(m_table_number); + throw std::invalid_argument(msg); + } + + m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); + const size_t num_cols = m_throughputs.size(); + + if (table.size() != num_cols + 3) { + const std::string msg = "SKPRPOLY table " + std::to_string(m_table_number) + + " does not have enough records!"; + throw std::invalid_argument(msg); + } + + m_velocities = table.getRecord(2).getItem().getSIDoubleData(); + const size_t num_rows = m_velocities.size(); + + for (size_t i = 3; i < table.size(); ++i) { + const DeckRecord& record_i = table.getRecord(i); + const std::vector& data_i = record_i.getItem().getSIDoubleData(); + if (data_i.size() != num_rows) { + const std::string msg = "SKPRPOLY table " + std::to_string(m_table_number) + + " record " + std::to_string(i) + + " does not have correct number of data "; + throw std::invalid_argument(msg); + } + m_data.push_back(data_i); + } + } + + double SkprpolyTable::referenceConcentration() const + { + return m_ref_polymer_concentration; + } + + const std::vector>& + SkprpolyTable::getSkinPressures() const + { + return getTableData(); + } + +} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp deleted file mode 100644 index a658649c9..000000000 --- a/src/opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright 2018 Statoil ASA. - - 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 . -*/ - -// TODO: this will go to Tables.cpp later. - -#include -#include -#include - - -namespace Opm{ - - SkprpolyTable::SkprpolyTable(const Opm::DeckKeyword &table) - { - using namespace ParserKeywords; - - const DeckRecord& record0 = table.getRecord(0); - - m_table_number = record0.getItem().get< int >(0); - if (m_table_number <= 0) { - const std::string msg = "SKPRPOLY table has non-positive table number " + std::to_string(m_table_number); - throw std::invalid_argument(msg); - } - - m_ref_polymer_concentration = record0.getItem().get< double >(0); - if (m_ref_polymer_concentration <= 0.) { - const std::string msg = "Non-positive reference polymer concentration is specified for SKPRPOLY table " - + std::to_string(m_table_number); - throw std::invalid_argument(msg); - } - - m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); - const size_t num_cols = m_throughputs.size(); - - if (table.size() != num_cols + 3) { - const std::string msg = "SKPRPOLY table " + std::to_string(m_table_number) - + " does not have enough records!"; - throw std::invalid_argument(msg); - } - - m_velocities = table.getRecord(2).getItem().getSIDoubleData(); - const size_t num_rows = m_velocities.size(); - - for (size_t i = 3; i < table.size(); ++i) { - const DeckRecord& record_i = table.getRecord(i); - const std::vector& data_i = record_i.getItem().getSIDoubleData(); - if (data_i.size() != num_rows) { - const std::string msg = "SKPRPOLY table " + std::to_string(m_table_number) - + " record " + std::to_string(i) - + " does not have correct number of data "; - throw std::invalid_argument(msg); - } - m_data.push_back(data_i); - } - } - - double SkprpolyTable::referenceConcentration() const - { - return m_ref_polymer_concentration; - } - - const std::vector>& - SkprpolyTable::getSkinPressures() const - { - return getTableData(); - } -} diff --git a/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp deleted file mode 100644 index 9d5776537..000000000 --- a/src/opm/parser/eclipse/EclipseState/Tables/SkprwatTable.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright 2018 Statoil ASA. - - 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 . -*/ - -// TODO: this will go to Tables.cpp later. - -#include -#include -#include - - -namespace Opm{ - - SkprwatTable::SkprwatTable(const Opm::DeckKeyword &table) - { - using namespace ParserKeywords; - - const DeckRecord& record0 = table.getRecord(0); - - m_table_number = record0.getItem().get< int >(0); - if (m_table_number <= 0) { - const std::string msg = "SKPRWAT table has non-positive table number " + std::to_string(m_table_number); - throw std::invalid_argument(msg); - } - - m_throughputs = table.getRecord(1).getItem().getSIDoubleData(); - const size_t num_cols = m_throughputs.size(); - - if (table.size() != num_cols + 3) { - const std::string msg = "SKPRWAT table " + std::to_string(m_table_number) - + " does not have enough records!"; - throw std::invalid_argument(msg); - } - - m_velocities = table.getRecord(2).getItem().getSIDoubleData(); - const size_t num_rows = m_velocities.size(); - - for (size_t i = 3; i < table.size(); ++i) { - const DeckRecord& record_i = table.getRecord(i); - const std::vector& data_i = record_i.getItem().getSIDoubleData(); - if (data_i.size() != num_rows) { - const std::string msg = "SKPRWAT table " + std::to_string(m_table_number) - + " record " + std::to_string(i) - + " does not have correct number of data "; - throw std::invalid_argument(msg); - } - m_data.push_back(data_i); - } - } - - const std::vector>& - SkprwatTable::getSkinPressures() const - { - return getTableData(); - } -} From 6858bd4578c4a3edabc1f55edcd35d7b2ea403c8 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Mon, 19 Nov 2018 11:47:39 +0100 Subject: [PATCH 12/12] adding the ScheduleTests for the following keywords WPMITAB and WSKPTAB --- tests/parser/ScheduleTests.cpp | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 936c48368..57d3a0de8 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -2737,6 +2737,72 @@ VFPINJ \n \ } } +// tests for the polymer injectivity case +BOOST_AUTO_TEST_CASE(POLYINJ_TEST) { + const char *deckData = + "START\n" + " 8 MAR 2018/\n" + "PROPS\n \n" + "SCHEDULE\n" + "WELSPECS\n" + "'INJE01' 'I' 1 1 1* 'WATER' /\n" + "/\n" + "TSTEP\n" + " 1/\n" + "WPOLYMER\n" + " 'INJE01' 1.0 0.0 /\n" + "/\n" + "WPMITAB\n" + " 'INJE01' 2 /\n" + "/\n" + "WSKPTAB\n" + " 'INJE01' 1 1 /\n" + "/\n" + "TSTEP\n" + " 2*1/\n" + "WPMITAB\n" + " 'INJE01' 3 /\n" + "/\n" + "WSKPTAB\n" + " 'INJE01' 2 2 /\n" + "/\n" + "TSTEP\n" + " 1 /\n"; + + Opm::Parser parser; + auto deck = parser.parseString(deckData, Opm::ParseContext()); + EclipseGrid grid1(10,10,10); + TableManager table ( deck ); + Eclipse3DProperties eclipseProperties ( deck , table, grid1); + Runspec runspec (deck); + Schedule schedule(deck, grid1 , eclipseProperties, runspec , ParseContext() ); + + const Opm::Well* well_inj01 = schedule.getWell("INJE01"); + + // start + { + const auto wpolymer = well_inj01->getPolymerProperties(0); + BOOST_CHECK_EQUAL(wpolymer.m_plymwinjtable, -1); + BOOST_CHECK_EQUAL(wpolymer.m_skprwattable, -1); + BOOST_CHECK_EQUAL(wpolymer.m_skprpolytable, -1); + } + + // report step 1 + { + const auto wpolymer = well_inj01->getPolymerProperties(1); + BOOST_CHECK_EQUAL(wpolymer.m_plymwinjtable, 2); + BOOST_CHECK_EQUAL(wpolymer.m_skprwattable, 1); + BOOST_CHECK_EQUAL(wpolymer.m_skprpolytable, 1); + } + + // report step 3 + { + const auto wpolymer = well_inj01->getPolymerProperties(3); + BOOST_CHECK_EQUAL(wpolymer.m_plymwinjtable, 3); + BOOST_CHECK_EQUAL(wpolymer.m_skprwattable, 2); + BOOST_CHECK_EQUAL(wpolymer.m_skprpolytable, 2); + } +} BOOST_AUTO_TEST_CASE(WTEST_CONFIG) {