add the FILEUNIT keyword

currently, this keyword is basically ignored: setting the unit system
of a file to something different than the deck unit system will cause
`Opm::checkDeck()` to produce a warning.
This commit is contained in:
Andreas Lauser
2019-04-04 16:55:19 +02:00
parent c25275d0ee
commit fe1272a2e6
5 changed files with 34 additions and 0 deletions
@@ -217,6 +217,12 @@ namespace Opm {
*/
const static std::string PARSE_LONG_KEYWORD;
/*
The unit system specified via the FILEUNIT keyword is different from the unit
system used by the deck.
*/
const static std::string UNIT_SYSTEM_MISMATCH;
/*
Some property modfiers can be modified in the Schedule
section; this effectively means that Eclipse supports time
@@ -50,6 +50,21 @@ bool checkDeck( const Deck& deck, const Parser& parser, const ParseContext& pars
deckValid = deckValid && Section::checkSectionTopology(deck, parser, ensureKeywordSection);
}
const std::string& deckUnitSystem = deck.getActiveUnitSystem().getName();
for (const auto& keyword : deck.getKeywordList("FILEUNIT")) {
const std::string& fileUnitSystem =
keyword->getRecord(0).getItem("FILE_UNIT_SYSTEM").getTrimmedString(0);
if (fileUnitSystem != deckUnitSystem) {
std::string msg =
"Unit system " + fileUnitSystem + " specified via the FILEUNIT keyword at "
+ keyword->getFileName() + ":" + std::to_string(keyword->getLineNumber())
+ " does not correspond to the unit system used by the deck ("
+ deckUnitSystem + ")";
parseContext.handleError(ParseContext::UNIT_SYSTEM_MISMATCH, msg, errorGuard);
deckValid = false;
}
}
return deckValid;
}
}
@@ -79,6 +79,8 @@ namespace Opm {
addKey(PARSE_MISSING_INCLUDE, InputError::EXIT1);
addKey(PARSE_LONG_KEYWORD, InputError::WARN);
addKey(UNIT_SYSTEM_MISMATCH, InputError::THROW_EXCEPTION);
this->addKey(RUNSPEC_NUMWELLS_TOO_LARGE, InputError::DELAYED_EXIT1);
this->addKey(RUNSPEC_CONNS_PER_WELL_TOO_LARGE, InputError::DELAYED_EXIT1);
this->addKey(RUNSPEC_NUMGROUPS_TOO_LARGE, InputError::DELAYED_EXIT1);
@@ -310,6 +312,8 @@ namespace Opm {
const std::string ParseContext::PARSE_MISSING_INCLUDE = "PARSE_MISSING_INCLUDE";
const std::string ParseContext::PARSE_LONG_KEYWORD = "PARSE_LONG_KEYWORD";
const std::string ParseContext::UNIT_SYSTEM_MISMATCH = "UNIT_SYSTEM_MISMATCH";
const std::string ParseContext::RUNSPEC_NUMWELLS_TOO_LARGE = "RUNSPEC_NUMWELLS_TOO_LARGE";
const std::string ParseContext::RUNSPEC_CONNS_PER_WELL_TOO_LARGE = "RUNSPEC_CONNS_PER_WELL_TOO_LARGE";
const std::string ParseContext::RUNSPEC_NUMGROUPS_TOO_LARGE = "RUNSPEC_NUMGROUPS_TOO_LARGE";
@@ -0,0 +1,8 @@
{
"name": "FILEUNIT",
"sections": ["GRID", "EDIT", "PROPS", "REGIONS", "SOLUTION", "SCHEDULE"],
"size":1,
"items":[
{"name" : "FILE_UNIT_SYSTEM", "value_type" : "STRING"}
]}
@@ -98,6 +98,7 @@ set( keywords
000_Eclipse100/F/FAULTS
000_Eclipse100/F/FIELD
000_Eclipse100/F/FIELD_PROBE
000_Eclipse100/F/FILEUNIT
000_Eclipse100/F/FILLEPS
000_Eclipse100/F/FIPOWG
000_Eclipse100/F/FIP_PROBE