renaming Simple2DTable to PolyInjTable

make it more clear that it is a talbe introduced for the polymer
injectivity study, not intended for general usage.
This commit is contained in:
Kai Bao
2018-10-16 16:35:35 +02:00
parent 2bf33c30d8
commit 316324a78e
10 changed files with 100 additions and 54 deletions

View File

@@ -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

View File

@@ -20,16 +20,17 @@
#ifndef OPM_PARSER_PLYMWINJ_TABLE_HPP
#define OPM_PARSER_PLYMWINJ_TABLE_HPP
#include <opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp>
namespace Opm {
class DeckKeyword;
class PlymwinjTable : public Simple2DTable {
class PlymwinjTable : public PolyInjTable {
public:
explicit PlymwinjTable(const DeckKeyword& table);
const std::vector<std::vector<double>>& getMoleWeights() const;
};
}

View File

@@ -17,25 +17,42 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#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 <vector>
namespace Opm {
class Simple2DTable {
class PolyInjTable {
public:
int getTableNumber() const;
const std::vector<double>& getXSamplingPoints() const;
const std::vector<double>& getYSamplingPoints() const;
const std::vector<double>& getThroughputs() const;
const std::vector<double>& getVelocities() const;
const std::vector<std::vector<double>>& getTableData() const;
protected:
std::vector<double> m_x_points;
std::vector<double> m_y_points;
std::vector<double> m_throughputs;
std::vector<double> 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

View File

@@ -20,18 +20,20 @@
#ifndef OPM_PARSER_SKPRPOLY_TABLE_HPP
#define OPM_PARSER_SKPRPOLY_TABLE_HPP
#include <opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp>
namespace Opm {
class DeckKeyword;
class SkprpolyTable : public Simple2DTable {
class SkprpolyTable : public PolyInjTable {
public:
explicit SkprpolyTable(const DeckKeyword& table);
double referenceConcentration() const;
const std::vector<std::vector<double>>& getSkinPressures() const;
private:
double m_ref_polymer_concentration;

View File

@@ -20,16 +20,18 @@
#ifndef OPM_PARSER_SKPRWAT_TABLE_HPP
#define OPM_PARSER_SKPRWAT_TABLE_HPP
#include <opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp>
namespace Opm {
class DeckKeyword;
class SkprwatTable : public Simple2DTable {
class SkprwatTable : public PolyInjTable {
public:
explicit SkprwatTable(const DeckKeyword& table);
const std::vector<std::vector<double>>& getSkinPressures() const;
};
}

View File

@@ -31,13 +31,15 @@ namespace Opm{
using namespace ParserKeywords;
const DeckRecord& record0 = table.getRecord(0);
m_table_number = record0.getItem<PLYMWINJ::TABLE_NUMBER>().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<PLYMWINJ::THROUGHPUT>().getSIDoubleData();
const size_t num_cols = m_x_points.size();
m_throughputs = table.getRecord(1).getItem<PLYMWINJ::THROUGHPUT>().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<PLYMWINJ::VELOCITY>().getSIDoubleData();
const size_t num_rows = m_y_points.size();
m_velocities = table.getRecord(2).getItem<PLYMWINJ::VELOCITY>().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<std::vector<double>>&
PlymwinjTable::getMoleWeights() const
{
return getTableData();
}
}

View File

@@ -19,27 +19,27 @@
// TODO: this will go to Tables.cpp later.
#include <opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp>
namespace Opm{
int Simple2DTable::getTableNumber() const
int PolyInjTable::getTableNumber() const
{
return m_table_number;
}
const std::vector<double>& Simple2DTable::getXSamplingPoints() const
const std::vector<double>& PolyInjTable::getThroughputs() const
{
return m_x_points;
return m_throughputs;
}
const std::vector<double>& Simple2DTable::getYSamplingPoints() const
const std::vector<double>& PolyInjTable::getVelocities() const
{
return m_y_points;
return m_velocities;
}
const std::vector<std::vector<double>>& Simple2DTable::getTableData() const
const std::vector<std::vector<double>>& PolyInjTable::getTableData() const
{
return m_data;
}

View File

@@ -31,20 +31,22 @@ namespace Opm{
using namespace ParserKeywords;
const DeckRecord& record0 = table.getRecord(0);
m_table_number = record0.getItem<SKPRPOLY::TABLE_NUMBER>().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<SKPRPOLY::POLYMERCONCENTRATION>().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<SKPRPOLY::THROUGHPUT>().getSIDoubleData();
const size_t num_cols = m_x_points.size();
m_throughputs = table.getRecord(1).getItem<SKPRPOLY::THROUGHPUT>().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<SKPRPOLY::VELOCITY>().getSIDoubleData();
const size_t num_rows = m_y_points.size();
m_velocities = table.getRecord(2).getItem<SKPRPOLY::VELOCITY>().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<std::vector<double>>&
SkprpolyTable::getSkinPressures() const
{
return getTableData();
}
}

View File

@@ -31,13 +31,15 @@ namespace Opm{
using namespace ParserKeywords;
const DeckRecord& record0 = table.getRecord(0);
m_table_number = record0.getItem<SKPRWAT::TABLE_NUMBER>().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<SKPRWAT::THROUGHPUT>().getSIDoubleData();
const size_t num_cols = m_x_points.size();
m_throughputs = table.getRecord(1).getItem<SKPRWAT::THROUGHPUT>().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<SKPRWAT::VELOCITY>().getSIDoubleData();
const size_t num_rows = m_y_points.size();
m_velocities = table.getRecord(2).getItem<SKPRWAT::VELOCITY>().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<std::vector<double>>&
SkprwatTable::getSkinPressures() const
{
return getTableData();
}
}

View File

@@ -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<double>& throughputs = table2.getXSamplingPoints();
const std::vector<double>& throughputs = table2.getThroughputs();
BOOST_CHECK_EQUAL( throughputs.size(), 3 );
BOOST_CHECK_EQUAL( throughputs[1], 200.0 );
const std::vector<double>& velocities = table2.getYSamplingPoints();
const std::vector<double>& velocities = table2.getVelocities();
BOOST_CHECK_EQUAL( velocities.size(), 4 );
constexpr double dayinseconds = 86400.;
BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds );
const std::vector<std::vector<double>>& mwdata = table2.getTableData();
const std::vector<std::vector<double>>& 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<double>& throughputs = table3.getXSamplingPoints();
const std::vector<double>& throughputs = table3.getThroughputs();
BOOST_CHECK_EQUAL( throughputs.size(), 2 );
BOOST_CHECK_EQUAL( throughputs[1], 100.0 );
const std::vector<double>& velocities = table3.getYSamplingPoints();
const std::vector<double>& velocities = table3.getVelocities();
BOOST_CHECK_EQUAL( velocities.size(), 3 );
constexpr double dayinseconds = 86400.;
BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds );
const std::vector<std::vector<double>>& mwdata = table3.getTableData();
const std::vector<std::vector<double>>& 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<double>& throughputs = table1.getXSamplingPoints();
const std::vector<double>& throughputs = table1.getThroughputs();
BOOST_CHECK_EQUAL( throughputs.size(), 3 );
BOOST_CHECK_EQUAL( throughputs[1], 200.0 );
const std::vector<double>& velocities = table1.getYSamplingPoints();
const std::vector<double>& velocities = table1.getVelocities();
BOOST_CHECK_EQUAL( velocities.size(), 4 );
constexpr double dayinseconds = 86400.;
BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds );
const std::vector<std::vector<double>>& skindata = table1.getTableData();
const std::vector<std::vector<double>>& 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<double>& throughputs = table2.getXSamplingPoints();
const std::vector<double>& throughputs = table2.getThroughputs();
BOOST_CHECK_EQUAL( throughputs.size(), 2 );
BOOST_CHECK_EQUAL( throughputs[1], 100.0 );
const std::vector<double>& velocities = table2.getYSamplingPoints();
const std::vector<double>& velocities = table2.getVelocities();
BOOST_CHECK_EQUAL( velocities.size(), 3 );
constexpr double dayinseconds = 86400.;
BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds );
const std::vector<std::vector<double>>& skindata = table2.getTableData();
const std::vector<std::vector<double>>& 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<double>& throughputs = table1.getXSamplingPoints();
const std::vector<double>& throughputs = table1.getThroughputs();
BOOST_CHECK_EQUAL( throughputs.size(), 3 );
BOOST_CHECK_EQUAL( throughputs[1], 200.0 );
const std::vector<double>& velocities = table1.getYSamplingPoints();
const std::vector<double>& velocities = table1.getVelocities();
BOOST_CHECK_EQUAL( velocities.size(), 4 );
constexpr double dayinseconds = 86400.;
BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds );
const std::vector<std::vector<double>>& skindata = table1.getTableData();
const std::vector<std::vector<double>>& 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<double>& throughputs = table2.getXSamplingPoints();
const std::vector<double>& throughputs = table2.getThroughputs();
BOOST_CHECK_EQUAL( throughputs.size(), 2 );
BOOST_CHECK_EQUAL( throughputs[1], 100.0 );
const std::vector<double>& velocities = table2.getYSamplingPoints();
const std::vector<double>& velocities = table2.getVelocities();
BOOST_CHECK_EQUAL( velocities.size(), 3 );
constexpr double dayinseconds = 86400.;
BOOST_CHECK_EQUAL( velocities[2], 2.0 / dayinseconds );
const std::vector<std::vector<double>>& skindata = table2.getTableData();
const std::vector<std::vector<double>>& skindata = table2.getSkinPressures();
BOOST_CHECK_EQUAL( skindata.size(), throughputs.size() );
for (const auto& data : skindata) {