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) {