From 9ab48975872d59c10dd973735a0a3fb98dfbbe28 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Mon, 1 Dec 2014 18:33:56 +0100 Subject: [PATCH] add a table for RTEMPVD --- opm/parser/eclipse/CMakeLists.txt | 1 + .../eclipse/EclipseState/EclipseState.cpp | 15 ++++ .../eclipse/EclipseState/EclipseState.hpp | 3 + .../EclipseState/Tables/RtempvdTable.hpp | 68 +++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp diff --git a/opm/parser/eclipse/CMakeLists.txt b/opm/parser/eclipse/CMakeLists.txt index f2a300605..417273eb5 100644 --- a/opm/parser/eclipse/CMakeLists.txt +++ b/opm/parser/eclipse/CMakeLists.txt @@ -182,6 +182,7 @@ EclipseState/Tables/ImptvdTable.hpp EclipseState/Tables/RsvdTable.hpp EclipseState/Tables/PvtoInnerTable.hpp EclipseState/Tables/RvvdTable.hpp +EclipseState/Tables/RtempvdTable.hpp EclipseState/Tables/PvtgOuterTable.hpp # Utility/WconinjeWrapper.hpp diff --git a/opm/parser/eclipse/EclipseState/EclipseState.cpp b/opm/parser/eclipse/EclipseState/EclipseState.cpp index 2fc856b2b..1ba63e8bd 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -200,6 +200,10 @@ namespace Opm { return m_rvvdTables; } + const std::vector& EclipseState::getRtempvdTables() const { + return m_rtempvdTables; + } + const std::vector& EclipseState::getSgofTables() const { return m_sgofTables; } @@ -244,6 +248,17 @@ namespace Opm { //depends on the presence of the RKTRMDIR keyword... initRocktabTables(deck, parserLog); + // the temperature vs depth table. the problem here is that + // the TEMPVD (E300) and RTEMPVD (E300 + E100) keywords are + // synonymous, but we want to provide only a single cannonical + // API here, so we jump through some small hoops... + if (deck->hasKeyword("TEMPVD") && deck->hasKeyword("RTEMPVD")) + throw std::invalid_argument("The TEMPVD and RTEMPVD tables are mutually exclusive!"); + else if (deck->hasKeyword("TEMPVD")) + initSimpleTables(deck, parserLog, "TEMPVD", m_rtempvdTables); + else if (deck->hasKeyword("RTEMPVD")) + initSimpleTables(deck, parserLog, "RTEMPVD", m_rtempvdTables); + initFullTables(deck, parserLog, "PVTG", m_pvtgTables); initFullTables(deck, parserLog, "PVTO", m_pvtoTables); } diff --git a/opm/parser/eclipse/EclipseState/EclipseState.hpp b/opm/parser/eclipse/EclipseState/EclipseState.hpp index a6586ae4c..9ec740d0c 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.hpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.hpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -104,6 +105,7 @@ namespace Opm { const std::vector& getRocktabTables() const; const std::vector& getRsvdTables() const; const std::vector& getRvvdTables() const; + const std::vector& getRtempvdTables() const; const std::vector& getSgofTables() const; const std::vector& getSwofTables() const; @@ -219,6 +221,7 @@ namespace Opm { std::vector m_rocktabTables; std::vector m_rsvdTables; std::vector m_rvvdTables; + std::vector m_rtempvdTables; std::vector m_sgofTables; std::vector m_swofTables; diff --git a/opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp b/opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp new file mode 100644 index 000000000..a5db388bc --- /dev/null +++ b/opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp @@ -0,0 +1,68 @@ +/* + Copyright (C) 2014 by Andreas Lauser + + 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_RTEMPVD_TABLE_HPP +#define OPM_PARSER_RTEMPVD_TABLE_HPP + +#include "SingleRecordTable.hpp" + +namespace Opm { + // forward declaration + class EclipseState; + + class RtempvdTable : protected SingleRecordTable { + typedef SingleRecordTable ParentType; + + friend class EclipseState; + RtempvdTable() = default; + + /*! + * \brief Read the RTEMPVD keyword and provide some convenience + * methods for it. + */ + void init(Opm::DeckKeywordConstPtr keyword, int recordIdx) + { + ParentType::init(keyword, + std::vector{ + "Depth", + "Temperature" + }, + recordIdx, + /*firstEntityOffset=*/0); + + ParentType::checkNonDefaultable("Depth"); + ParentType::checkMonotonic("Depth", /*isAscending=*/true); + + ParentType::checkNonDefaultable("Temperature"); + } + + public: + using ParentType::numTables; + using ParentType::numRows; + using ParentType::numColumns; + using ParentType::evaluate; + + const std::vector &getDepthColumn() const + { return ParentType::getColumn(0); } + + const std::vector &getTemperatureColumn() const + { return ParentType::getColumn(1); } + }; +} + +#endif