add support for DIFFC and DIFFUSE

This commit is contained in:
Tor Harald Sandve
2021-01-15 16:09:36 +01:00
parent 462ab5f44a
commit c8343d95f6
8 changed files with 108 additions and 6 deletions

View File

@@ -48,6 +48,7 @@ namespace Opm {
bool hasDISGAS() const;
bool hasVAPOIL() const;
bool isThermal() const;
bool isDiffusive() const;
bool operator==(const SimulationConfig& data) const;
@@ -61,6 +62,7 @@ namespace Opm {
serializer(m_DISGAS);
serializer(m_VAPOIL);
serializer(m_isThermal);
serializer(m_diffuse);
}
private:
@@ -71,6 +73,7 @@ namespace Opm {
bool m_DISGAS;
bool m_VAPOIL;
bool m_isThermal;
bool m_diffuse;
};
} //namespace Opm

View File

@@ -51,6 +51,52 @@ struct DensityTable : public FlatTable< DENSITYRecord > {
}
};
struct DiffCoeffRecord {
static constexpr std::size_t size = 8;
double oil_mw;
double gas_mw;
double gas_in_gas;
double oil_in_gas;
double gas_in_oil;
double oil_in_oil;
double gas_in_oil_cross_phase;
double oil_in_oil_cross_phase;
bool operator==(const DiffCoeffRecord& data) const {
return oil_mw == data.oil_mw &&
gas_mw == data.gas_mw &&
gas_in_gas == data.gas_in_gas &&
oil_in_gas == data.oil_in_gas &&
gas_in_oil == data.gas_in_oil &&
oil_in_oil == data.oil_in_oil &&
gas_in_oil_cross_phase == data.gas_in_oil_cross_phase &&
oil_in_oil_cross_phase == data.oil_in_oil_cross_phase;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(oil_mw);
serializer(gas_mw);
serializer(gas_in_gas);
serializer(oil_in_gas);
serializer(gas_in_oil);
serializer(oil_in_oil);
serializer(gas_in_oil_cross_phase);
serializer(oil_in_oil_cross_phase);
}
};
struct DiffCoeffTable : public FlatTable< DiffCoeffRecord > {
using FlatTable< DiffCoeffRecord >::FlatTable;
static DiffCoeffTable serializeObject()
{
return DiffCoeffTable({{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}});
}
};
struct PVTWRecord {
static constexpr std::size_t size = 5;

View File

@@ -162,6 +162,7 @@ namespace Opm {
const PvcdoTable& getPvcdoTable() const;
const DensityTable& getDensityTable() const;
const DiffCoeffTable& getDiffusionCoefficientTable() const;
const PlyvmhTable& getPlyvmhTable() const;
const RockTable& getRockTable() const;
const ViscrefTable& getViscrefTable() const;
@@ -215,6 +216,7 @@ namespace Opm {
m_pvtwTable.serializeOp(serializer);
m_pvcdoTable.serializeOp(serializer);
m_densityTable.serializeOp(serializer);
m_diffCoeffTable.serializeOp(serializer);
m_plyvmhTable.serializeOp(serializer);
m_rockTable.serializeOp(serializer);
m_plmixparTable.serializeOp(serializer);
@@ -514,6 +516,7 @@ namespace Opm {
PvtwTable m_pvtwTable;
PvcdoTable m_pvcdoTable;
DensityTable m_densityTable;
DiffCoeffTable m_diffCoeffTable;
PlyvmhTable m_plyvmhTable;
RockTable m_rockTable;
PlmixparTable m_plmixparTable;

View File

@@ -51,7 +51,8 @@ namespace Opm {
m_useCPR(false),
m_DISGAS(false),
m_VAPOIL(false),
m_isThermal(false)
m_isThermal(false),
m_diffuse(false)
{
}
@@ -64,7 +65,8 @@ namespace Opm {
m_useCPR(false),
m_DISGAS(false),
m_VAPOIL(false),
m_isThermal(false)
m_isThermal(false),
m_diffuse(false)
{
if (DeckSection::hasRUNSPEC(deck)) {
const RUNSPECSection runspec(deck);
@@ -81,7 +83,9 @@ namespace Opm {
if (runspec.hasKeyword<ParserKeywords::VAPOIL>()) {
m_VAPOIL = true;
}
if (runspec.hasKeyword<ParserKeywords::DIFFUSE>()) {
m_diffuse = true;
}
this->m_isThermal = runspec.hasKeyword<ParserKeywords::THERMAL>()
|| runspec.hasKeyword<ParserKeywords::TEMP>();
}
@@ -97,6 +101,7 @@ namespace Opm {
result.m_DISGAS = true;
result.m_VAPOIL = false;
result.m_isThermal = true;
result.m_diffuse = true;
return result;
}
@@ -133,6 +138,10 @@ namespace Opm {
return this->m_isThermal;
}
bool SimulationConfig::isDiffusive() const {
return this->m_diffuse;
}
bool SimulationConfig::operator==(const SimulationConfig& data) const {
return this->getThresholdPressure() == data.getThresholdPressure() &&
this->bcconfig() == data.bcconfig() &&
@@ -140,7 +149,8 @@ namespace Opm {
this->useCPR() == data.useCPR() &&
this->hasDISGAS() == data.hasDISGAS() &&
this->hasVAPOIL() == data.hasVAPOIL() &&
this->isThermal() == data.isThermal();
this->isThermal() == data.isThermal() &&
this->isDiffusive() == data.isDiffusive();
}
} //namespace Opm

View File

@@ -34,6 +34,7 @@
#include <opm/common/utility/OpmInputError.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/A.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/D.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/E.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/G.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/M.hpp>
@@ -150,6 +151,9 @@ namespace Opm {
if( deck.hasKeyword( "DENSITY" ) )
this->m_densityTable = DensityTable( deck.getKeyword( "DENSITY" ) );
if( deck.hasKeyword( "DIFFC" ) )
this->m_diffCoeffTable = DiffCoeffTable( deck.getKeyword( "DIFFC" ) );
if( deck.hasKeyword( "ROCK" ) )
this->m_rockTable = RockTable( deck.getKeyword( "ROCK" ) );
@@ -235,6 +239,7 @@ namespace Opm {
m_pvcdoTable = data.m_pvcdoTable;
m_plyvmhTable = data.m_plyvmhTable;
m_densityTable = data.m_densityTable;
m_diffCoeffTable = data.m_diffCoeffTable;
m_plmixparTable = data.m_plmixparTable;
m_shrateTable = data.m_shrateTable;
m_stone1exTable = data.m_stone1exTable;
@@ -282,6 +287,7 @@ namespace Opm {
result.m_pvtwTable = PvtwTable::serializeObject();
result.m_pvcdoTable = PvcdoTable::serializeObject();
result.m_densityTable = DensityTable::serializeObject();
result.m_diffCoeffTable = DiffCoeffTable::serializeObject();
result.m_plyvmhTable = PlyvmhTable::serializeObject();
result.m_rockTable = RockTable::serializeObject();
result.m_plmixparTable = PlmixparTable::serializeObject();
@@ -1087,6 +1093,10 @@ namespace Opm {
return this->m_densityTable;
}
const DiffCoeffTable& TableManager::getDiffusionCoefficientTable() const {
return this->m_diffCoeffTable;
}
const RockTable& TableManager::getRockTable() const {
return this->m_rockTable;
}
@@ -1222,6 +1232,7 @@ namespace Opm {
m_pvtwTable == data.m_pvtwTable &&
m_pvcdoTable == data.m_pvcdoTable &&
m_densityTable == data.m_densityTable &&
m_diffCoeffTable == data.m_diffCoeffTable &&
m_plmixparTable == data.m_plmixparTable &&
m_plyvmhTable == data.m_plyvmhTable &&
m_shrateTable == data.m_shrateTable &&

View File

@@ -1526,6 +1526,7 @@ FlatTable< T >::FlatTable( const DeckKeyword& kw ) :
{}
template FlatTable< DENSITYRecord >::FlatTable( const DeckKeyword& );
template FlatTable< DiffCoeffRecord >::FlatTable( const DeckKeyword& );
template FlatTable< PVTWRecord >::FlatTable( const DeckKeyword& );
template FlatTable< PVCDORecord >::FlatTable( const DeckKeyword& );
template FlatTable< ROCKRecord >::FlatTable( const DeckKeyword& );

View File

@@ -10,11 +10,13 @@
"items": [
{
"name": "OIL_MOL_WEIGHT",
"value_type": "DOUBLE"
"value_type": "DOUBLE",
"dimension": "1"
},
{
"name": "GAS_MOL_WEIGHT",
"value_type": "DOUBLE"
"value_type": "DOUBLE",
"dimension": "1"
},
{
"name": "GAS_GAS_DIFF_COEFF",
@@ -39,11 +41,13 @@
{
"name": "GAS_OIL_CROSS_DIFF_COEFF",
"value_type": "DOUBLE",
"default": 0.0,
"dimension": "Length*Length/Time"
},
{
"name": "OIL_OIL_CROSS_DIFF_COEFF",
"value_type": "DOUBLE",
"default": 0.0,
"dimension": "Length*Length/Time"
}
]

View File

@@ -1667,6 +1667,30 @@ BOOST_AUTO_TEST_CASE( TestParseDENSITY ) {
BOOST_CHECK_EQUAL( 1.3, density[0].gas );
}
BOOST_AUTO_TEST_CASE( TestParseDIFFC ) {
const std::string data = R"(
TABDIMS
1* 1 /
DIFFC
1.1 1.2 1.3 1.4 1.5 1.6 1* 1.8/
)";
Opm::Parser parser;
auto deck = parser.parseString(data);
Opm::TableManager tables( deck );
const auto& diffc = tables.getDiffusionCoefficientTable();
double conversion_factor = (60*60*24);
BOOST_CHECK_EQUAL( 1.1, diffc[0].oil_mw );
BOOST_CHECK_EQUAL( 1.2, diffc[0].gas_mw );
BOOST_CHECK_CLOSE( 1.3, diffc[0].gas_in_gas*conversion_factor, epsilon());
BOOST_CHECK_CLOSE( 1.4, diffc[0].oil_in_gas*conversion_factor, epsilon() );
BOOST_CHECK_CLOSE( 1.5, diffc[0].gas_in_oil*conversion_factor, epsilon() );
BOOST_CHECK_CLOSE( 1.6, diffc[0].oil_in_oil*conversion_factor, epsilon() );
BOOST_CHECK_CLOSE( 0.0, diffc[0].gas_in_oil_cross_phase*conversion_factor, epsilon() );
BOOST_CHECK_CLOSE( 1.8, diffc[0].oil_in_oil_cross_phase*conversion_factor, epsilon() );
}
BOOST_AUTO_TEST_CASE( TestParseROCK ) {
const std::string data = R"(
TABDIMS