Understand PVDCO, VISCREF, WATDENT

This commit is contained in:
Jørgen Kvalsvik
2016-12-22 15:12:08 +01:00
parent 295a808310
commit 45cfedb183
5 changed files with 121 additions and 1 deletions

View File

@@ -48,6 +48,43 @@ struct RockTable : public FlatTable< ROCKRecord > {
using FlatTable< ROCKRecord >::FlatTable;
};
struct PVCDORecord {
static constexpr std::size_t size = 5;
double reference_pressure;
double volume_factor;
double compressibility;
double viscosity;
double viscosibility;
};
struct PvcdoTable : public FlatTable< PVCDORecord > {
using FlatTable< PVCDORecord >::FlatTable;
};
struct VISCREFRecord {
static constexpr std::size_t size = 2;
double reference_pressure;
double reference_rs;
};
struct ViscrefTable : public FlatTable< VISCREFRecord > {
using FlatTable< VISCREFRecord >::FlatTable;
};
struct WATDENTRecord {
static constexpr std::size_t size = 3;
double reference_temperature;
double first_coefficient;
double second_coefficient;
};
struct WatdentTable : public FlatTable< WATDENTRecord > {
using FlatTable< WATDENTRecord >::FlatTable;
};
}
#endif //OPM_FLAT_TABLE_HPP

View File

@@ -87,12 +87,21 @@ namespace Opm {
if( deck.hasKeyword( "PVTW" ) )
this->m_pvtwTable = PvtwTable( deck.getKeyword( "PVTW" ) );
if( deck.hasKeyword( "PVCDO" ) )
this->m_pvcdoTable = PvcdoTable( deck.getKeyword( "PVCDO" ) );
if( deck.hasKeyword( "DENSITY" ) )
this->m_densityTable = DensityTable( deck.getKeyword( "DENSITY" ) );
if( deck.hasKeyword( "ROCK" ) )
this->m_rockTable = RockTable( deck.getKeyword( "ROCK" ) );
if( deck.hasKeyword( "VISCREF" ) )
this->m_viscrefTable = ViscrefTable( deck.getKeyword( "VISCREF" ) );
if( deck.hasKeyword( "WATDENT" ) )
this->m_watdentTable = WatdentTable( deck.getKeyword( "WATDENT" ) );
initVFPProdTables(deck, m_vfpprodTables);
initVFPInjTables(deck, m_vfpinjTables);
}
@@ -643,6 +652,10 @@ namespace Opm {
return this->m_pvtwTable;
}
const PvcdoTable& TableManager::getPvcdoTable() const {
return this->m_pvcdoTable;
}
const DensityTable& TableManager::getDensityTable() const {
return this->m_densityTable;
}
@@ -651,6 +664,14 @@ namespace Opm {
return this->m_rockTable;
}
const ViscrefTable& TableManager::getViscrefTable() const {
return this->m_viscrefTable;
}
const WatdentTable& TableManager::getWatdentTable() const {
return this->m_watdentTable;
}
const TableContainer& TableManager::getMsfnTables() const {
return getTables("MSFN");
}

View File

@@ -102,8 +102,11 @@ namespace Opm {
const std::vector<PvtgTable>& getPvtgTables() const;
const std::vector<PvtoTable>& getPvtoTables() const;
const PvtwTable& getPvtwTable() const;
const PvcdoTable& getPvcdoTable() const;
const DensityTable& getDensityTable() const;
const RockTable& getRockTable() const;
const ViscrefTable& getViscrefTable() const;
const WatdentTable& getWatdentTable() const;
const std::map<int, VFPProdTable>& getVFPProdTables() const;
const std::map<int, VFPInjTable>& getVFPInjTables() const;
@@ -233,8 +236,11 @@ namespace Opm {
std::vector<PvtgTable> m_pvtgTables;
std::vector<PvtoTable> m_pvtoTables;
PvtwTable m_pvtwTable;
PvcdoTable m_pvcdoTable;
DensityTable m_densityTable;
RockTable m_rockTable;
ViscrefTable m_viscrefTable;
WatdentTable m_watdentTable;
Tabdims m_tabdims;
std::shared_ptr<Regdims> m_regdims;

View File

@@ -1085,6 +1085,22 @@ struct flat_props< PVTWRecord, 0 > {
}
};
constexpr const char* pvcdo_err[] = {
"PVCDO reference pressure cannot be defaulted",
"PVCDO oil volume factor cannot be defaulted",
"PVCDO compressibility cannot be defaulted",
"PVCDO viscosity cannot be defaulted",
"PVCDO viscosibility cannot be defaulted",
};
template< std::size_t N >
struct flat_props< PVCDORecord, N > {
static constexpr bool can_default() { return false; }
static constexpr const char* errmsg() {
return pvcdo_err[ N ];
}
};
}
template< typename T >
@@ -1094,6 +1110,9 @@ FlatTable< T >::FlatTable( const DeckKeyword& kw ) :
template FlatTable< DENSITYRecord >::FlatTable( const DeckKeyword& );
template FlatTable< PVTWRecord >::FlatTable( const DeckKeyword& );
template FlatTable< PVCDORecord >::FlatTable( const DeckKeyword& );
template FlatTable< ROCKRecord >::FlatTable( const DeckKeyword& );
template FlatTable< VISCREFRecord >::FlatTable( const DeckKeyword& );
template FlatTable< WATDENTRecord >::FlatTable( const DeckKeyword& );
} // namespace Opm

View File

@@ -45,6 +45,8 @@
#include <stdexcept>
#include <iostream>
using namespace Opm;
namespace {
Opm::Deck createSingleRecordDeck() {
@@ -842,7 +844,7 @@ VFPINJ \n\
BOOST_AUTO_TEST_CASE(TableContainer) {
BOOST_AUTO_TEST_CASE(TestTableContainer) {
auto deck = createSingleRecordDeck();
Opm::TableManager tables( deck );
BOOST_CHECK_EQUAL( false , tables.hasTables("SGOF") );
@@ -1101,6 +1103,41 @@ BOOST_AUTO_TEST_CASE( TestParseROCK ) {
BOOST_CHECK_THROW( rock.at( 2 ), std::out_of_range );
}
BOOST_AUTO_TEST_CASE( TestParsePVCDO ) {
const std::string data = R"(
TABDIMS
1* 1 /
PVCDO
3600 1.12 1.6e-5 0.88 0.0 /
)";
Opm::Parser parser;
auto deck = parser.parseString(data, Opm::ParseContext());
Opm::TableManager tables( deck );
const auto& pvcdo = tables.getPvcdoTable();
BOOST_CHECK_CLOSE( 3600.00, pvcdo[ 0 ].reference_pressure / 1e5, 1e-5 );
BOOST_CHECK_CLOSE( 1.12, pvcdo[ 0 ].volume_factor, 1e-5 );
BOOST_CHECK_CLOSE( 1.6e-5, pvcdo[ 0 ].compressibility * 1e5, 1e-5 );
BOOST_CHECK_CLOSE( 0.88, pvcdo[ 0 ].viscosity * 1e3, 1e-5 );
BOOST_CHECK_CLOSE( 0.0, pvcdo[ 0 ].viscosibility * 1e5, 1e-5 );
BOOST_CHECK_THROW( pvcdo.at( 1 ), std::out_of_range );
const std::string malformed = R"(
TABDIMS
1* 1 /
PVCDO
-- cannot be defaulted
3600 1* 1.6e-5 0.88 0.0 /
)";
auto illegal_default = parser.parseString( malformed, ParseContext() );
BOOST_CHECK_THROW( TableManager{ illegal_default }, std::invalid_argument );
}
BOOST_AUTO_TEST_CASE( TestParseTABDIMS ) {
const char *data =