beginning working on PlymwinjTable

it will go to Tables.cpp later.
This commit is contained in:
Kai Bao
2018-04-05 16:22:31 +02:00
parent 65ef90f471
commit d0e5f8f470
7 changed files with 238 additions and 0 deletions

View File

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

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_PARSER_PLYMWINJ_TABLE_HPP
#define OPM_PARSER_PLYMWINJ_TABLE_HPP
#include <opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp>
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

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#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 <vector>
namespace Opm {
class Simple2DTable {
public:
int getTableNumber() const;
const std::vector<double>& getXSamplingPoints() const;
const std::vector<double>& getYSamplingPoints() const;
const std::vector<std::vector<double>>& getTableData() const;
protected:
std::vector<double> m_x_points;
std::vector<double> 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<std::vector<double> > m_data;
};
}
#endif // OPM_PARSER_SIMPLE_2D_TABLE_HPP

View File

@@ -45,6 +45,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp>
namespace Opm {
@@ -121,6 +122,7 @@ namespace Opm {
const RockTable& getRockTable() const;
const ViscrefTable& getViscrefTable() const;
const WatdentTable& getWatdentTable() const;
const std::map<int, PlymwinjTable>& 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<int, PlymwinjTable> m_plymwinjTables;
Tabdims m_tabdims;
std::shared_ptr<Regdims> m_regdims;

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
// TODO: this will go to Tables.cpp later.
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
namespace Opm{
PlymwinjTable::PlymwinjTable(const Opm::DeckKeyword& table)
{
using namespace ParserKeywords;
const DeckRecord& record0 = table.getRecord(0);
m_table_number = record0.getItem<PLYMWINJ::TABLE_NUMBER>().get< int >(0);
m_x_points = table.getRecord(1).getItem<PLYMWINJ::THROUGHPUT>().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<PLYMWINJ::VELOCITY>().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<double>& data_i = record_i.getItem<PLYMWINJ::MOLECULARWEIGHT>().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);
}
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
// TODO: this will go to Tables.cpp later.
#include <opm/parser/eclipse/EclipseState/Tables/Simple2DTable.hpp>
namespace Opm{
int Simple2DTable::getTableNumber() const
{
return m_table_number;
}
const std::vector<double>& Simple2DTable::getXSamplingPoints() const
{
return m_x_points;
}
const std::vector<double>& Simple2DTable::getYSamplingPoints() const
{
return m_y_points;
}
const std::vector<std::vector<double>>& Simple2DTable::getTableData() const
{
return m_data;
}
}

View File

@@ -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<ParserKeywords::PLYMWINJ>();
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<int, PlymwinjTable>& TableManager::getPlymwinjTables() const {
return m_plymwinjTables;
}
bool TableManager::useImptvd() const {
return hasImptvd;
}