From 867df8b7ce9f022d5093a2f46a3d94baddac68b3 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 8 Jan 2018 14:17:37 +0100 Subject: [PATCH] Add support for PDVD and PBVD --- .../eclipse/EclipseState/Tables/PbvdTable.hpp | 37 ++++++++++++ .../eclipse/EclipseState/Tables/PdvdTable.hpp | 37 ++++++++++++ .../EclipseState/Tables/TableManager.hpp | 3 + .../EclipseState/Tables/TableManager.cpp | 15 +++++ .../eclipse/EclipseState/Tables/Tables.cpp | 32 +++++++++++ .../share/keywords/000_Eclipse100/P/PDVD | 7 +++ .../eclipse/share/keywords/keyword_list.cmake | 1 + tests/parser/TableManagerTests.cpp | 57 +++++++++++++++++++ 8 files changed, 189 insertions(+) create mode 100644 opm/parser/eclipse/EclipseState/Tables/PbvdTable.hpp create mode 100644 opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp create mode 100644 src/opm/parser/eclipse/share/keywords/000_Eclipse100/P/PDVD diff --git a/opm/parser/eclipse/EclipseState/Tables/PbvdTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PbvdTable.hpp new file mode 100644 index 000000000..a0f6d7c64 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/PbvdTable.hpp @@ -0,0 +1,37 @@ +/* + Copyright (C) 2018 by IRIS + + 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_PBVD_TABLE_HPP +#define OPM_PARSER_PBVD_TABLE_HPP + +#include "SimpleTable.hpp" + +namespace Opm { + + class DeckItem; + + class PbvdTable : public SimpleTable { + public: + PbvdTable( const DeckItem& item ); + + const TableColumn& getDepthColumn() const; + const TableColumn& getPbubColumn() const; + }; +} + +#endif diff --git a/opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp new file mode 100644 index 000000000..dfce28941 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp @@ -0,0 +1,37 @@ +/* + Copyright (C) 2018 by IRIS + + 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_PDVD_TABLE_HPP +#define OPM_PARSER_PDVD_TABLE_HPP + +#include "SimpleTable.hpp" + +namespace Opm { + + class DeckItem; + + class PdvdTable : public SimpleTable { + public: + PdvdTable( const DeckItem& item ); + + const TableColumn& getDepthColumn() const; + const TableColumn& getPdewColumn() const; + }; +} + +#endif diff --git a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp index 2fea076e7..211d582ac 100644 --- a/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp +++ b/opm/parser/eclipse/EclipseState/Tables/TableManager.hpp @@ -1,5 +1,6 @@ /* Copyright 2015 Statoil ASA. + Copyright 2018 IRIS This file is part of the Open Porous Media project (OPM). @@ -80,6 +81,8 @@ namespace Opm { const TableContainer& getSsfnTables() const; const TableContainer& getRsvdTables() const; const TableContainer& getRvvdTables() const; + const TableContainer& getPbvdTables() const; + const TableContainer& getPdvdTables() const; const TableContainer& getEnkrvdTables() const; const TableContainer& getEnptvdTables() const; const TableContainer& getImkrvdTables() const; diff --git a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp index 49af88ab2..3cea3ea36 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp @@ -1,5 +1,6 @@ /* Copyright 2015 Statoil ASA. + Copyright 2018 IRIS This file is part of the Open Porous Media project (OPM). @@ -52,6 +53,8 @@ #include #include #include +#include +#include #include #include #include @@ -224,6 +227,8 @@ namespace Opm { addTables( "PLYMAX", m_regdims->getNPLMIX()); addTables( "RSVD", m_eqldims->getNumEquilRegions()); addTables( "RVVD", m_eqldims->getNumEquilRegions()); + addTables( "PBVD", m_eqldims->getNumEquilRegions()); + addTables( "PDVD", m_eqldims->getNumEquilRegions()); addTables( "AQUTAB", m_aqudims.getNumInfluenceTablesCT()); { @@ -282,6 +287,8 @@ namespace Opm { initSimpleTableContainer(deck, "RSVD" , m_eqldims->getNumEquilRegions()); initSimpleTableContainer(deck, "RVVD" , m_eqldims->getNumEquilRegions()); + initSimpleTableContainer(deck, "PBVD" , m_eqldims->getNumEquilRegions()); + initSimpleTableContainer(deck, "PDVD" , m_eqldims->getNumEquilRegions()); initSimpleTableContainer(deck, "AQUTAB" , m_aqudims.getNumInfluenceTablesCT()); { size_t numEndScaleTables = ParserKeywords::ENDSCALE::NUM_TABLES::defaultValue; @@ -610,6 +617,14 @@ namespace Opm { return getTables("RVVD"); } + const TableContainer& TableManager::getPbvdTables() const { + return getTables("PBVD"); + } + + const TableContainer& TableManager::getPdvdTables() const { + return getTables("PDVD"); + } + const TableContainer& TableManager::getEnkrvdTables() const { return getTables("ENKRVD"); } diff --git a/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp b/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp index 8a783d7d9..15cf98323 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp @@ -55,6 +55,8 @@ #include #include #include +#include +#include #include #include #include @@ -802,6 +804,36 @@ const TableColumn& RvvdTable::getRvColumn() const { return SimpleTable::getColumn(1); } +PbvdTable::PbvdTable( const DeckItem& item ) { + m_schema.addColumn( ColumnSchema( "DEPTH" , Table::STRICTLY_INCREASING , Table::DEFAULT_NONE )); + m_schema.addColumn( ColumnSchema( "PBUB" , Table::RANDOM , Table::DEFAULT_NONE )); + + SimpleTable::init(item); +} + +const TableColumn& PbvdTable::getDepthColumn() const { + return SimpleTable::getColumn(0); +} + +const TableColumn& PbvdTable::getPbubColumn() const { + return SimpleTable::getColumn(1); +} + +PdvdTable::PdvdTable( const DeckItem& item ) { + m_schema.addColumn( ColumnSchema( "DEPTH" , Table::STRICTLY_INCREASING , Table::DEFAULT_NONE )); + m_schema.addColumn( ColumnSchema( "PDEW" , Table::RANDOM , Table::DEFAULT_NONE )); + + SimpleTable::init(item); +} + +const TableColumn& PdvdTable::getDepthColumn() const { + return SimpleTable::getColumn(0); +} + +const TableColumn& PdvdTable::getPdewColumn() const { + return SimpleTable::getColumn(1); +} + AqutabTable::AqutabTable( const DeckItem& item ) { m_schema.addColumn( ColumnSchema( "TD" , Table::STRICTLY_INCREASING , Table::DEFAULT_NONE ) ); m_schema.addColumn( ColumnSchema( "PD" , Table::RANDOM , Table::DEFAULT_LINEAR ) ); diff --git a/src/opm/parser/eclipse/share/keywords/000_Eclipse100/P/PDVD b/src/opm/parser/eclipse/share/keywords/000_Eclipse100/P/PDVD new file mode 100644 index 000000000..f549a8272 --- /dev/null +++ b/src/opm/parser/eclipse/share/keywords/000_Eclipse100/P/PDVD @@ -0,0 +1,7 @@ +{"name" : "PDVD" , "sections" : ["SOLUTION"], "size" : {"keyword" : "EQLDIMS" , "item" : "NTEQUL"}, + "items" : [{"name" : "table" , + "value_type" : "DOUBLE" , + "size_type" : "ALL", + "dimension" : ["Length" , "Pressure"]}]} + + diff --git a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake index 69edb5a4f..c0b8ffd2f 100644 --- a/src/opm/parser/eclipse/share/keywords/keyword_list.cmake +++ b/src/opm/parser/eclipse/share/keywords/keyword_list.cmake @@ -189,6 +189,7 @@ set( keywords 000_Eclipse100/P/PATHS 000_Eclipse100/P/PBVD 000_Eclipse100/P/PCG + 000_Eclipse100/P/PDVD 000_Eclipse100/P/PERFORMANCE_PROBE 000_Eclipse100/P/PERMR 000_Eclipse100/P/PERMTHT diff --git a/tests/parser/TableManagerTests.cpp b/tests/parser/TableManagerTests.cpp index e23d4774a..009182ed5 100644 --- a/tests/parser/TableManagerTests.cpp +++ b/tests/parser/TableManagerTests.cpp @@ -40,6 +40,9 @@ #include #include #include +#include +#include + #include @@ -271,6 +274,60 @@ BOOST_AUTO_TEST_CASE(SwofTable_Tests) { BOOST_CHECK_EQUAL(swof2Table.getSwColumn().back(), 17.0); } +BOOST_AUTO_TEST_CASE(PbvdTable_Tests) { + const char *deckData = + "EQLDIMS\n" + "2 /\n" + "\n" + "PBVD\n" + " 1 1 \n" + " 2 1 / \n" + " 3 2\n" + " 2 2\n" + " 1 2/\n"; + + Opm::Parser parser; + auto deck = parser.parseString(deckData, Opm::ParseContext()); + + Opm::PbvdTable pbvdTable1(deck.getKeyword("PBVD").getRecord(0).getItem(0)); + + BOOST_CHECK_EQUAL(pbvdTable1.numRows(), 2); + BOOST_CHECK_EQUAL(pbvdTable1.numColumns(), 2); + BOOST_CHECK_EQUAL(pbvdTable1.getDepthColumn().front(), 1); + BOOST_CHECK_EQUAL(pbvdTable1.getDepthColumn().back(), 2); + BOOST_CHECK_EQUAL(pbvdTable1.getPbubColumn().front(), 100000); // 1 barsa + + // depth must be increasing down the column. + BOOST_CHECK_THROW(Opm::PbvdTable pbvdTable2(deck.getKeyword("PBVD").getRecord(1).getItem(0)), std::invalid_argument); +} + + +BOOST_AUTO_TEST_CASE(PdvdTable_Tests) { + const char *deckData = + "EQLDIMS\n" + "2 /\n" + "\n" + "PDVD\n" + " 1 1 \n" + " 2 1 / \n" + " 3 2\n" + " 2 2\n" + " 1 2/\n"; + + Opm::Parser parser; + auto deck = parser.parseString(deckData, Opm::ParseContext()); + + Opm::PdvdTable pdvdTable1(deck.getKeyword("PDVD").getRecord(0).getItem(0)); + + BOOST_CHECK_EQUAL(pdvdTable1.numRows(), 2); + BOOST_CHECK_EQUAL(pdvdTable1.numColumns(), 2); + BOOST_CHECK_EQUAL(pdvdTable1.getDepthColumn().front(), 1); + BOOST_CHECK_EQUAL(pdvdTable1.getDepthColumn().back(), 2); + BOOST_CHECK_EQUAL(pdvdTable1.getPdewColumn().front(), 100000); // 1 barsa + + // depth must be increasing down the column. + BOOST_CHECK_THROW(Opm::PdvdTable pdvdTable2(deck.getKeyword("PDVD").getRecord(1).getItem(0)), std::invalid_argument); +} BOOST_AUTO_TEST_CASE(SgwfnTable_Tests) { const char *deckData =