Handle undefined fipnum definition in summary keywords like RPR__ABC
This commit is contained in:
parent
8a901f2700
commit
47f292bd93
@ -303,7 +303,7 @@ class KeywordLocation;
|
||||
const static std::string SUMMARY_UNHANDLED_KEYWORD;
|
||||
const static std::string SUMMARY_UNDEFINED_UDQ;
|
||||
const static std::string SUMMARY_UDQ_MISSING_UNIT;
|
||||
|
||||
const static std::string SUMMARY_INVALID_FIPNUM;
|
||||
/*
|
||||
A well must be specified (e.g. WELSPECS) and have completions
|
||||
(e.g. COMPDAT) to be able to set control mode (e.g. WCONPROD).
|
||||
|
@ -748,6 +748,7 @@ inline void keywordR2R( SummaryConfig::keyword_list& /* list */,
|
||||
inline void keywordR( SummaryConfig::keyword_list& list,
|
||||
const DeckKeyword& deck_keyword,
|
||||
const Schedule& schedule,
|
||||
const FieldPropsManager& field_props,
|
||||
const TableManager& tables,
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors ) {
|
||||
@ -758,8 +759,16 @@ inline void keywordR( SummaryConfig::keyword_list& list,
|
||||
return;
|
||||
}
|
||||
std::string region_name = "FIPNUM";
|
||||
if (keyword.size() > 5)
|
||||
if (keyword.size() > 5) {
|
||||
region_name = "FIP" + keyword.substr(5,3);
|
||||
if (!field_props.has_int(region_name)) {
|
||||
std::string msg_fmt = fmt::format("Problem with summary keyword {{keyword}}\n"
|
||||
"In {{file}} line {{line}}\n"
|
||||
"FIP region {} not defined in REGIONS section - {keyword} ignored", region_name);
|
||||
parseContext.handleError(ParseContext::SUMMARY_INVALID_FIPNUM, msg_fmt, deck_keyword.location(), errors);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const size_t numfip = tables.numFIPRegions( );
|
||||
const auto& item = deck_keyword.getDataRecord().getDataItem();
|
||||
@ -1075,6 +1084,7 @@ inline void keywordMISC( SummaryConfig::keyword_list& list,
|
||||
const std::vector<std::string>& node_names,
|
||||
const DeckKeyword& keyword,
|
||||
const Schedule& schedule,
|
||||
const FieldPropsManager& field_props,
|
||||
const TableManager& tables,
|
||||
const AquiferConfig& aquiferConfig,
|
||||
const ParseContext& parseContext,
|
||||
@ -1091,7 +1101,7 @@ inline void keywordMISC( SummaryConfig::keyword_list& list,
|
||||
case Cat::Group: return keywordG( list, parseContext, errors, keyword, schedule );
|
||||
case Cat::Field: return keywordF( list, keyword );
|
||||
case Cat::Block: return keywordB( list, keyword, dims );
|
||||
case Cat::Region: return keywordR( list, keyword, schedule, tables, parseContext, errors );
|
||||
case Cat::Region: return keywordR( list, keyword, schedule, field_props, tables, parseContext, errors );
|
||||
case Cat::Connection: return keywordC( list, parseContext, errors, keyword, schedule, dims);
|
||||
case Cat::Segment: return keywordS( list, parseContext, errors, keyword, schedule );
|
||||
case Cat::Node: return keyword_node( list, node_names, parseContext, errors, keyword );
|
||||
@ -1110,6 +1120,7 @@ inline void handleKW( SummaryConfig::keyword_list& list,
|
||||
const std::string& keyword,
|
||||
const KeywordLocation& location,
|
||||
const Schedule& schedule,
|
||||
const FieldPropsManager& field_props,
|
||||
const AquiferConfig& aquiferConfig,
|
||||
const ParseContext& /* parseContext */,
|
||||
ErrorGuard& /* errors */) {
|
||||
@ -1383,7 +1394,7 @@ SummaryConfig::SummaryConfig( const Deck& deck,
|
||||
if (is_processing_instruction(kw.name())) {
|
||||
handleProcessingInstruction(kw.name());
|
||||
} else {
|
||||
handleKW(this->m_keywords, node_names, kw, schedule, tables, aquiferConfig, parseContext, errors, dims);
|
||||
handleKW(this->m_keywords, node_names, kw, schedule, field_props, tables, aquiferConfig, parseContext, errors, dims);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1395,7 +1406,7 @@ SummaryConfig::SummaryConfig( const Deck& deck,
|
||||
KeywordLocation location = deck_keyword.location();
|
||||
location.keyword = fmt::format("{}/{}", meta_pair.first, kw);
|
||||
|
||||
handleKW(this->m_keywords, kw, location, schedule, aquiferConfig, parseContext, errors);
|
||||
handleKW(this->m_keywords, kw, location, schedule, field_props, aquiferConfig, parseContext, errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ namespace Opm {
|
||||
addKey(SUMMARY_UNHANDLED_KEYWORD, InputError::WARN);
|
||||
addKey(SUMMARY_UNDEFINED_UDQ, InputError::WARN);
|
||||
addKey(SUMMARY_UDQ_MISSING_UNIT, InputError::WARN);
|
||||
addKey(SCHEDULE_INVALID_NAME, InputError::THROW_EXCEPTION);
|
||||
this->addKey(SUMMARY_INVALID_FIPNUM, InputError::WARN);
|
||||
|
||||
addKey(ACTIONX_ILLEGAL_KEYWORD, InputError::THROW_EXCEPTION);
|
||||
|
||||
@ -122,6 +122,7 @@ namespace Opm {
|
||||
this->addKey(SCHEDULE_IGNORED_GUIDE_RATE, InputError::WARN);
|
||||
this->addKey(SCHEDULE_COMPSEGS_INVALID, InputError::THROW_EXCEPTION);
|
||||
this->addKey(SCHEDULE_COMPSEGS_NOT_SUPPORTED, InputError::THROW_EXCEPTION);
|
||||
addKey(SCHEDULE_INVALID_NAME, InputError::THROW_EXCEPTION);
|
||||
}
|
||||
|
||||
void ParseContext::initEnv() {
|
||||
@ -350,6 +351,7 @@ namespace Opm {
|
||||
const std::string ParseContext::SUMMARY_UNHANDLED_KEYWORD = "SUMMARY_UNHANDLED_KEYWORD";
|
||||
const std::string ParseContext::SUMMARY_UNDEFINED_UDQ = "SUMMARY_UNDEFINED_UDQ";
|
||||
const std::string ParseContext::SUMMARY_UDQ_MISSING_UNIT = "SUMMARY_UDQ_MISSING_UNIT";
|
||||
const std::string ParseContext::SUMMARY_INVALID_FIPNUM = "SUMMARY_INVALID_FIPNUM";
|
||||
|
||||
const std::string ParseContext::RPT_MIXED_STYLE = "RPT_MIXED_STYLE";
|
||||
const std::string ParseContext::RPT_UNKNOWN_MNEMONIC = "RPT_UNKNOWN_MNEMONIC";
|
||||
|
@ -1364,3 +1364,25 @@ WBP9
|
||||
BOOST_CHECK(summary_config.hasKeyword("WBP5"));
|
||||
BOOST_CHECK(summary_config.hasKeyword("WBP9"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( SUMMARY_INVALID_FIPNUM ) {
|
||||
const std::string input = R"(
|
||||
RPR__ABC
|
||||
1 2 3 /
|
||||
|
||||
RWIP_REG
|
||||
1 2 3 /
|
||||
)";
|
||||
|
||||
ParseContext parse_context;
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_INVALID_FIPNUM, InputError::IGNORE);
|
||||
const auto& summary_config = createSummary(input, parse_context);
|
||||
BOOST_CHECK(summary_config.hasKeyword("RWIP_REG"));
|
||||
BOOST_CHECK(!summary_config.hasKeyword("RPR__ABC"));
|
||||
}
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_INVALID_FIPNUM, InputError::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary(input, parse_context), std::exception);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user