Check required restart fields for summary.

This commit is contained in:
Joakim Hove
2017-02-06 23:52:39 +01:00
parent 4543de807b
commit 5ea448ac93
3 changed files with 149 additions and 1 deletions

View File

@@ -80,6 +80,30 @@ namespace {
"FMWIS", "FMWIV", "FMWIP", "FMWDR", "FMWDT", "FMWWO", "FMWWT"
};
/*
This is a hardcoded mapping between 3D field keywords,
e.g. 'PRESSURE' and 'SWAT' and summary keywords like 'RPR' and
'BPR'. The purpose of this mapping is to maintain an overview of
which 3D field keywords are needed by the Summary calculation
machinery, based on which summary keywords are requested. The
Summary calculations are implemented in the opm-output
repository.
*/
const std::map<std::string , std::set<std::string>> required_fields = {
{"PRESSURE", {"FPR" , "RPR" , "BPR"}},
{"OIP" , {"ROIP" , "FOIP" , "FOE"}},
{"OIPL" , {"ROIPL"}},
{"OIPG" , {"ROIPG"}},
{"GIP" , {"RGIP" , "FGIP"}},
{"GIPL" , {"RGIPL"}},
{"GIPG" , {"RGIPG"}},
{"WIP" , {"RWIP"}},
{"SWAT" , {"BSWAT"}},
{"SGAS" , {"BSGAS"}}
};
/*
When the error handling config says that the error should be
logged, the handleMissingWell and handleMissingGroup routines
@@ -98,6 +122,9 @@ namespace {
all the way down here.
*/
void handleMissingWell( const ParseContext& parseContext , const std::string& keyword, const std::string& well) {
std::string msg = std::string("Error in keyword:") + keyword + std::string(" No such well: ") + well;
MessageContainer msgContainer;
@@ -322,7 +349,8 @@ SummaryConfig::SummaryConfig( const Deck& deck,
const Schedule& schedule,
const Eclipse3DProperties& props,
const ParseContext& parseContext,
std::array< int, 3 > n_xyz ) {
std::array< int, 3 > n_xyz )
{
SUMMARYSection section( deck );
for( auto& x : section )
@@ -373,4 +401,40 @@ bool SummaryConfig::hasKeyword( const std::string& keyword ) const {
return (this->short_keywords.count( keyword ) == 1);
}
/*
Can be used to query if a certain 3D field, e.g. PRESSURE, is
required to calculate the summary variables.
The implementation is based on the hardcoded datastructure
required_fields defined in a anonymous namespaces at the top of this
file; the content of this datastructure again is based on the
implementation of the Summary calculations in the opm-output
repository: opm/output/eclipse/Summary.cpp.
*/
bool SummaryConfig::require3DField( const std::string& keyword ) const {
const auto iter = required_fields.find( keyword );
if (iter == required_fields.end())
return false;
for (const auto& kw : iter->second) {
if (this->hasKeyword( kw ))
return true;
}
return false;
}
bool SummaryConfig::requireFIPNUM( ) const {
return this->hasKeyword("ROIP") ||
this->hasKeyword("ROIPL") ||
this->hasKeyword("RGIP") ||
this->hasKeyword("RGIPL") ||
this->hasKeyword("RGIPG") ||
this->hasKeyword("RWIP") ||
this->hasKeyword("RPR");
}
}

View File

@@ -58,6 +58,13 @@ namespace Opm {
identifiers like 'WWCT:OPX' and 'BPR:10,12,3'.
*/
bool hasKeyword( const std::string& keyword ) const;
/*
Can be used to query if a certain 3D field, e.g. PRESSURE,
is required to calculate the summary variables.
*/
bool require3DField( const std::string& keyword) const;
bool requireFIPNUM( ) const;
private:
/*

View File

@@ -465,3 +465,80 @@ BOOST_AUTO_TEST_CASE( summary_FMWSET ) {
BOOST_CHECK( !summary.hasKeyword("NO-NOT-THIS") );
}
BOOST_AUTO_TEST_CASE( summary_require3DField ) {
{
const auto input = "WWCT\n/\n";
const auto summary = createSummary( input );
BOOST_CHECK( !summary.require3DField( "NO-NOT-THIS"));
BOOST_CHECK( !summary.require3DField( "PRESSURE"));
BOOST_CHECK( !summary.require3DField( "OIP"));
BOOST_CHECK( !summary.require3DField( "GIP"));
BOOST_CHECK( !summary.require3DField( "WIP"));
BOOST_CHECK( !summary.require3DField( "OIPL"));
BOOST_CHECK( !summary.require3DField( "OIPG"));
BOOST_CHECK( !summary.require3DField( "GIPL"));
BOOST_CHECK( !summary.require3DField( "GIPG"));
BOOST_CHECK( !summary.require3DField( "SWAT"));
BOOST_CHECK( !summary.require3DField( "SGAS"));
}
{
const auto input = "BPR\n"
"3 3 6 /\n"
"4 3 6 /\n"
"/";
const auto summary = createSummary( input );
BOOST_CHECK( summary.require3DField( "PRESSURE"));
BOOST_CHECK( !summary.requireFIPNUM( ));
}
{
const auto input = "FPR\n";
const auto summary = createSummary( input );
BOOST_CHECK( summary.require3DField( "PRESSURE"));
}
{
const auto input = "BSWAT\n"
"3 3 6 /\n"
"4 3 6 /\n"
"/";
const auto summary = createSummary( input );
BOOST_CHECK( summary.require3DField( "SWAT"));
}
{
const auto input = "BSGAS\n"
"3 3 6 /\n"
"4 3 6 /\n"
"/";
const auto summary = createSummary( input );
BOOST_CHECK( summary.require3DField( "SGAS"));
}
{
const auto input = "RPR\n/\n";
const auto summary = createSummary( input );
BOOST_CHECK( summary.require3DField( "PRESSURE"));
BOOST_CHECK( summary.requireFIPNUM( ));
}
{
const auto input = "RGIPL\n/\n";
const auto summary = createSummary( input );
BOOST_CHECK( summary.require3DField( "GIPL"));
BOOST_CHECK( summary.requireFIPNUM( ));
}
}