Internalize PPCWMAX as vector of structs
This commit is contained in:
@@ -245,6 +245,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/input/eclipse/EclipseState/Tables/TableContainer.cpp
|
||||
src/opm/input/eclipse/EclipseState/Tables/TableIndex.cpp
|
||||
src/opm/input/eclipse/EclipseState/Tables/TLMixpar.cpp
|
||||
src/opm/input/eclipse/EclipseState/Tables/Ppcwmax.cpp
|
||||
src/opm/input/eclipse/EclipseState/Tables/TableManager.cpp
|
||||
src/opm/input/eclipse/EclipseState/Tables/TableSchema.cpp
|
||||
src/opm/input/eclipse/EclipseState/Tables/Tables.cpp
|
||||
@@ -1122,6 +1123,7 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/input/eclipse/EclipseState/Tables/SgcwmisTable.hpp
|
||||
opm/input/eclipse/EclipseState/Tables/Sof2Table.hpp
|
||||
opm/input/eclipse/EclipseState/Tables/TLMixpar.hpp
|
||||
opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp
|
||||
opm/input/eclipse/EclipseState/Tables/TableManager.hpp
|
||||
opm/input/eclipse/EclipseState/Tables/SwfnTable.hpp
|
||||
opm/input/eclipse/EclipseState/Tables/EnptvdTable.hpp
|
||||
|
||||
76
opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp
Normal file
76
opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (C) 2023 NORCE
|
||||
|
||||
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 PPCWMAX_HPP
|
||||
#define PPCWMAX_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
class Deck;
|
||||
|
||||
struct PpcwmaxRecord {
|
||||
double max_cap_pres;
|
||||
bool option;
|
||||
|
||||
PpcwmaxRecord() = default;
|
||||
PpcwmaxRecord(double pres, bool optn) :
|
||||
max_cap_pres(pres),
|
||||
option(optn)
|
||||
{};
|
||||
|
||||
bool operator==(const PpcwmaxRecord& other) const {
|
||||
return this->max_cap_pres == other.max_cap_pres &&
|
||||
this->option == other.option;
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(max_cap_pres);
|
||||
serializer(option);
|
||||
}
|
||||
};
|
||||
|
||||
class Ppcwmax {
|
||||
public:
|
||||
Ppcwmax() = default;
|
||||
explicit Ppcwmax(const Deck& deck);
|
||||
static Ppcwmax serializationTestObject();
|
||||
std::size_t size() const;
|
||||
bool empty() const;
|
||||
const PpcwmaxRecord& operator[](const std::size_t index) const;
|
||||
|
||||
bool operator==(const Ppcwmax& other) const {
|
||||
return this->data == other.data;
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(data);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<PpcwmaxRecord> data;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -57,6 +57,7 @@
|
||||
#include <opm/input/eclipse/EclipseState/Tables/Eqldims.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Tables/Regdims.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Tables/TLMixpar.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -78,6 +79,7 @@ namespace Opm {
|
||||
const Aqudims& getAqudims() const;
|
||||
const Regdims& getRegdims() const;
|
||||
const TLMixpar& getTLMixpar() const;
|
||||
const Ppcwmax& getPpcwmax() const;
|
||||
/*
|
||||
WIll return max{ Tabdims::NTFIP , Regdims::NTFIP }.
|
||||
*/
|
||||
@@ -260,6 +262,7 @@ namespace Opm {
|
||||
serializer(m_rtemp);
|
||||
serializer(m_salinity);
|
||||
serializer(m_tlmixpar);
|
||||
serializer(m_ppcwmax);
|
||||
if (!serializer.isSerializing()) {
|
||||
m_simpleTables = simpleTables;
|
||||
if (split.plyshMax > 0) {
|
||||
@@ -391,6 +394,7 @@ namespace Opm {
|
||||
Eqldims m_eqldims;
|
||||
Aqudims m_aqudims;
|
||||
TLMixpar m_tlmixpar;
|
||||
Ppcwmax m_ppcwmax;
|
||||
|
||||
bool hasImptvd = false;// if deck has keyword IMPTVD
|
||||
bool hasEnptvd = false;// if deck has keyword ENPTVD
|
||||
|
||||
70
src/opm/input/eclipse/EclipseState/Tables/Ppcwmax.cpp
Normal file
70
src/opm/input/eclipse/EclipseState/Tables/Ppcwmax.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright 2023 NORCE
|
||||
|
||||
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/>.
|
||||
*/
|
||||
#include <opm/input/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/input/eclipse/Parser/ParserKeywords/P.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
Ppcwmax::Ppcwmax(const Deck& deck) {
|
||||
using PPCWMAX = ParserKeywords::PPCWMAX;
|
||||
if (!deck.hasKeyword<PPCWMAX>())
|
||||
return;
|
||||
|
||||
const auto& keyword = deck.get<PPCWMAX>().back();
|
||||
for (const auto& record : keyword) {
|
||||
// Get first column value, which is max. allowable capillary pressure
|
||||
const double max_cap_pres = record.getItem<PPCWMAX::MAXIMUM_CAPILLARY_PRESSURE>().getSIDouble(0);
|
||||
|
||||
// Store second column value as bool (yes/no = true/false)
|
||||
bool option;
|
||||
const auto& optn = record.getItem<PPCWMAX::MODIFY_CONNATE_SATURATION>().get< std::string >(0);
|
||||
if (optn == "YES")
|
||||
option = true;
|
||||
else if (optn == "NO")
|
||||
option = false;
|
||||
else
|
||||
throw std::runtime_error("Second column input in PPCWMAX must be YES or NO!");
|
||||
|
||||
// Store input data
|
||||
this->data.emplace_back(max_cap_pres, option);
|
||||
}
|
||||
}
|
||||
|
||||
bool Ppcwmax::empty() const {
|
||||
return this->data.empty();
|
||||
}
|
||||
|
||||
std::size_t Ppcwmax::size() const {
|
||||
return this->data.size();
|
||||
}
|
||||
|
||||
Ppcwmax Ppcwmax::serializationTestObject() {
|
||||
Ppcwmax ppcwmax;
|
||||
return ppcwmax;
|
||||
}
|
||||
|
||||
|
||||
const PpcwmaxRecord& Ppcwmax::operator[](const std::size_t index) const {
|
||||
return this->data.at(index);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -135,6 +135,7 @@ std::optional<JFunc> make_jfunc(const Deck& deck) {
|
||||
m_tabdims( Tabdims(deck)),
|
||||
m_aqudims( Aqudims(deck)),
|
||||
m_tlmixpar( deck ),
|
||||
m_ppcwmax( deck ),
|
||||
hasImptvd (deck.hasKeyword("IMPTVD")),
|
||||
hasEnptvd (deck.hasKeyword("ENPTVD")),
|
||||
hasEqlnum (deck.hasKeyword("EQLNUM")),
|
||||
@@ -322,6 +323,7 @@ std::optional<JFunc> make_jfunc(const Deck& deck) {
|
||||
result.m_rtemp = 1.0;
|
||||
result.m_salinity = 1.0;
|
||||
result.m_tlmixpar = TLMixpar::serializationTestObject();
|
||||
result.m_ppcwmax = Ppcwmax::serializationTestObject();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1174,6 +1176,10 @@ std::optional<JFunc> make_jfunc(const Deck& deck) {
|
||||
return m_tlmixpar;
|
||||
}
|
||||
|
||||
const Ppcwmax& TableManager::getPpcwmax() const {
|
||||
return m_ppcwmax;
|
||||
}
|
||||
|
||||
const JFunc& TableManager::getJFunc() const {
|
||||
if (!this->jfunc.has_value())
|
||||
throw std::invalid_argument("Cannot get JFUNC table when JFUNC not in deck");
|
||||
@@ -1275,6 +1281,7 @@ std::optional<JFunc> make_jfunc(const Deck& deck) {
|
||||
m_skprwatTables == data.m_skprwatTables &&
|
||||
m_skprpolyTables == data.m_skprpolyTables &&
|
||||
m_tlmixpar == data.m_tlmixpar &&
|
||||
m_ppcwmax == data.m_ppcwmax &&
|
||||
m_tabdims == data.m_tabdims &&
|
||||
m_regdims == data.m_regdims &&
|
||||
m_eqldims == data.m_eqldims &&
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
{
|
||||
"name": "MAXIMUM_CAPILLARY_PRESSURE",
|
||||
"value_type": "DOUBLE",
|
||||
"dimension": "Pressure",
|
||||
"default": 1e+20
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2374,6 +2374,29 @@ BOOST_AUTO_TEST_CASE( TestParseDIFFCWATGAS ) {
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TestParsePPCWMAX) {
|
||||
const std::string data = R"(
|
||||
TABDIMS
|
||||
2 /
|
||||
|
||||
PPCWMAX
|
||||
10.0 /
|
||||
1* YES/
|
||||
)";
|
||||
|
||||
Opm::Parser parser;
|
||||
auto deck = parser.parseString(data);
|
||||
Opm::TableManager tables(deck);
|
||||
|
||||
const auto& ppcwmax = tables.getPpcwmax();
|
||||
BOOST_CHECK_CLOSE(10.0e5, ppcwmax[0].max_cap_pres, epsilon());
|
||||
BOOST_CHECK_EQUAL(false, ppcwmax[0].option);
|
||||
|
||||
BOOST_CHECK_CLOSE(1e+25, ppcwmax[1].max_cap_pres, epsilon());
|
||||
BOOST_CHECK_EQUAL(true, ppcwmax[1].option);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( TestParseROCK ) {
|
||||
const std::string data = R"(
|
||||
TABDIMS
|
||||
|
||||
Reference in New Issue
Block a user