From e1fa3a98c81507691b6e844a0b3fc752611e6cef Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Sat, 20 Jun 2015 16:57:42 +0800 Subject: [PATCH] Add keyword PLYDHFLF. --- opm/parser/eclipse/CMakeLists.txt | 1 + .../eclipse/EclipseState/EclipseState.cpp | 5 ++ .../eclipse/EclipseState/EclipseState.hpp | 3 + .../EclipseState/Tables/PlydhflfTable.hpp | 68 +++++++++++++++++++ .../eclipse/IntegrationTests/CMakeLists.txt | 2 +- .../IntegrationTests/ParsePLYDHFLF.cpp | 45 ++++++++++++ .../share/keywords/000_Eclipse100/P/PLYDHFLF | 7 ++ .../integration_tests/POLYMER/plydhflf.data | 10 +++ 8 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp create mode 100644 opm/parser/eclipse/IntegrationTests/ParsePLYDHFLF.cpp create mode 100644 opm/parser/share/keywords/000_Eclipse100/P/PLYDHFLF create mode 100644 testdata/integration_tests/POLYMER/plydhflf.data diff --git a/opm/parser/eclipse/CMakeLists.txt b/opm/parser/eclipse/CMakeLists.txt index 3a783a6ab..618aad57e 100644 --- a/opm/parser/eclipse/CMakeLists.txt +++ b/opm/parser/eclipse/CMakeLists.txt @@ -224,6 +224,7 @@ EclipseState/Tables/Sof2Table.hpp EclipseState/Tables/EnptvdTable.hpp EclipseState/Tables/FullTable.hpp EclipseState/Tables/PlyviscTable.hpp +EclipseState/Tables/PlydhflfTable.hpp EclipseState/Tables/PlyshlogTable.hpp EclipseState/Tables/EnkrvdTable.hpp EclipseState/Tables/ImkrvdTable.hpp diff --git a/opm/parser/eclipse/EclipseState/EclipseState.cpp b/opm/parser/eclipse/EclipseState/EclipseState.cpp index 7b8eb9b77..982cd5c15 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -206,6 +206,10 @@ namespace Opm { return m_plyshlogTables; } + const std::vector& EclipseState::getPlydhflfTables() const { + return m_plydhflfTables; + } + const std::vector& EclipseState::getPvdgTables() const { return m_pvdgTables; } @@ -335,6 +339,7 @@ namespace Opm { initSimpleTables(deck, "PLYMAX", m_plymaxTables); initSimpleTables(deck, "PLYROCK", m_plyrockTables); initSimpleTables(deck, "PLYVISC", m_plyviscTables); + initSimpleTables(deck, "PLYDHFLF", m_plydhflfTables); initSimpleTables(deck, "PVDG", m_pvdgTables); initSimpleTables(deck, "PVDO", m_pvdoTables); initSimpleTables(deck, "RSVD", m_rsvdTables); diff --git a/opm/parser/eclipse/EclipseState/EclipseState.hpp b/opm/parser/eclipse/EclipseState/EclipseState.hpp index f6cbae7fd..55e6d900f 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.hpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.hpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -119,6 +120,7 @@ namespace Opm { const std::vector& getPlymaxTables() const; const std::vector& getPlyrockTables() const; const std::vector& getPlyviscTables() const; + const std::vector& getPlydhflfTables() const; const std::vector& getPlyshlogTables() const; const std::vector& getPvdgTables() const; const std::vector& getPvdoTables() const; @@ -264,6 +266,7 @@ namespace Opm { std::vector m_plymaxTables; std::vector m_plyrockTables; std::vector m_plyviscTables; + std::vector m_plydhflfTables; std::vector m_plyshlogTables; std::vector m_pvdgTables; std::vector m_pvdoTables; diff --git a/opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp b/opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp new file mode 100644 index 000000000..88d2f84d1 --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp @@ -0,0 +1,68 @@ +/* + Copyright (C) 2015 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_PLYDHFLF_TABLE_HPP +#define OPM_PARSER_PLYDHFLF_TABLE_HPP + +#include "SingleRecordTable.hpp" + +namespace Opm { + // forward declaration + class EclipseState; + + class PlydhflfTable : protected SingleRecordTable { + typedef SingleRecordTable ParentType; + + friend class EclipseState; + PlydhflfTable() = default; + + /*! + * \brief Read the PLYDHFLF keyword and provide some convenience + * methods for it. + */ + void init(Opm::DeckKeywordConstPtr keyword, int recordIdx) + { + ParentType::init(keyword, + std::vector{ + "Temperature", + "PolymerHalflife" + }, + recordIdx, + /*firstEntityOffset=*/0); + + ParentType::checkNonDefaultable("Temperetura"); + ParentType::checkMonotonic("Temperature", /*isAscending=*/true); + ParentType::checkNonDefaultable("PolymerHalflife"); + ParentType::checkMonotonic("PolymerHalflife", /*isAscending=*/false); + } + + public: + using ParentType::numTables; + using ParentType::numRows; + using ParentType::numColumns; + using ParentType::evaluate; + + const std::vector &getTemperatureColumn() const + { return ParentType::getColumn(0); } + + const std::vector &getPolymerHalflifeColumn() const + { return ParentType::getColumn(1); } + }; +} + +#endif diff --git a/opm/parser/eclipse/IntegrationTests/CMakeLists.txt b/opm/parser/eclipse/IntegrationTests/CMakeLists.txt index 661bf5986..253a29335 100644 --- a/opm/parser/eclipse/IntegrationTests/CMakeLists.txt +++ b/opm/parser/eclipse/IntegrationTests/CMakeLists.txt @@ -2,7 +2,7 @@ add_definitions( -DKEYWORD_DIRECTORY="${PROJECT_SOURCE_DIR}/opm/parser/share/key foreach(tapp CheckDeckValidity IntegrationTests ParseWellProbe ParseTITLE ParseTOPS ParseWCONHIST ParseWellWithWildcards - ParsePORO ParsePLYVISC ParsePLYSHLOG ParseDATAWithDefault + ParsePORO ParsePLYVISC ParsePLYDHFLF ParsePLYSHLOG ParseDATAWithDefault ParseTVDP ParseDENSITY ParseVFPPROD ScheduleCreateFromDeck CompletionsFromDeck ParseEND IncludeTest ParseEQUIL ParseRSVD ParsePVTG ParsePVTO ParseSWOF BoxTest diff --git a/opm/parser/eclipse/IntegrationTests/ParsePLYDHFLF.cpp b/opm/parser/eclipse/IntegrationTests/ParsePLYDHFLF.cpp new file mode 100644 index 000000000..6ad9e4f36 --- /dev/null +++ b/opm/parser/eclipse/IntegrationTests/ParsePLYDHFLF.cpp @@ -0,0 +1,45 @@ +/* + Copyright 2015 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 . + */ + +#define BOOST_TEST_MODULE ParsePLYDHFLF +#include + +#include +#include + +#include +#include +#include + +using namespace Opm; + + + +BOOST_AUTO_TEST_CASE( PARSE_PLYDHFLF_OK) { + ParserPtr parser(new Parser()); + boost::filesystem::path deckFile("testdata/integration_tests/POLYMER/plydhflf.data"); + DeckPtr deck = parser->parseFile(deckFile.string()); + DeckKeywordConstPtr kw = deck->getKeyword("PLYDHFLF"); + DeckRecordConstPtr rec = kw->getRecord(0); + DeckItemPtr item = rec->getItem(0); + + BOOST_CHECK_EQUAL( 0.0 , item->getRawDouble(0) ); + BOOST_CHECK_EQUAL( 365.0, item->getRawDouble(1) ); + BOOST_CHECK_EQUAL( 200.0 , item->getRawDouble(5) ); +} diff --git a/opm/parser/share/keywords/000_Eclipse100/P/PLYDHFLF b/opm/parser/share/keywords/000_Eclipse100/P/PLYDHFLF new file mode 100644 index 000000000..655002214 --- /dev/null +++ b/opm/parser/share/keywords/000_Eclipse100/P/PLYDHFLF @@ -0,0 +1,7 @@ +{"name" : "PLYDHFLF" , "sections" : ["SPECIAL", "PROPS", "SCHEDULE"], "size" : {"keyword" : "TABDIMS" , "item" : "NTPVT"} , "items" : + [ + {"name":"DATA", "value_type":"DOUBLE", "size_type" : "ALL" , "dimension" : ["Temperature","Time"]} + ] +} + + diff --git a/testdata/integration_tests/POLYMER/plydhflf.data b/testdata/integration_tests/POLYMER/plydhflf.data new file mode 100644 index 000000000..db9ba1a8c --- /dev/null +++ b/testdata/integration_tests/POLYMER/plydhflf.data @@ -0,0 +1,10 @@ +TABDIMS +-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT + 1 1 100 50 1 / + + +PLYDHFLF + 0.0 365.0 + 50.0 240.0 + 150.0 200.0 / +/