Add INVALID_WELL context for WCONPROD

Handle invalid wellpatterns for WCONPROD.

Given a deck with:

----
WELSPECS
  'PROD' 'G1'  10 10 8400 'OIL' /
/
COMPDAT
  'PROD' 10 10 3 3 'OPEN' 1* 1* 0.5 /
/
WCONPROD
  'SOMETHINGELSE' 'OPEN' 'ORAT' 20000 4* 1000 /
 /
----

OPM will now by default abort and inform the user that no well match
"SOMETHINGELSE".
This commit is contained in:
Lars Petter Øren Hauge
2018-04-23 12:45:57 +02:00
parent f2cb5fe9de
commit 183fd4eabb
3 changed files with 24 additions and 11 deletions

View File

@@ -146,9 +146,9 @@ namespace Opm
void addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, WellCompletion::CompletionOrderEnum wellCompletionOrder);
void handleCOMPORD(const ParseContext& parseContext, const DeckKeyword& compordKeyword, size_t currentStep);
void handleWELSPECS( const SCHEDULESection&, size_t, size_t );
void handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode);
void handleWCONHIST( const DeckKeyword& keyword, size_t currentStep);
void handleWCONPROD( const DeckKeyword& keyword, size_t currentStep);
void handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode, const ParseContext& parseContext);
void handleWCONHIST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWGRUPCON( const DeckKeyword& keyword, size_t currentStep);
void handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, const ParseContext& parseContext);
void handleCOMPLUMP( const DeckKeyword& keyword, size_t currentStep );

View File

@@ -166,10 +166,10 @@ namespace Opm {
handleWHISTCTL(parseContext, keyword);
else if (keyword.name() == "WCONHIST")
handleWCONHIST(keyword, currentStep);
handleWCONHIST(keyword, currentStep, parseContext);
else if (keyword.name() == "WCONPROD")
handleWCONPROD(keyword, currentStep);
handleWCONPROD(keyword, currentStep, parseContext);
else if (keyword.name() == "WCONINJE")
handleWCONINJE(section, keyword, currentStep);
@@ -475,7 +475,7 @@ namespace Opm {
}
}
void Schedule::handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode) {
void Schedule::handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode, const ParseContext& parseContext) {
for( const auto& record : keyword ) {
const std::string& wellNamePattern =
record.getItem("WELL").getTrimmedString(0);
@@ -484,8 +484,10 @@ namespace Opm {
WellCommon::StatusFromString(record.getItem("STATUS").getTrimmedString(0));
auto wells = getWells(wellNamePattern);
if (wells.empty())
InvalidWellPattern(wellNamePattern, parseContext, keyword);
for( auto* well : getWells( wellNamePattern ) ) {
for( auto* well : wells ) {
WellProductionProperties properties;
@@ -528,12 +530,12 @@ namespace Opm {
}
void Schedule::handleWCONHIST(const DeckKeyword& keyword, size_t currentStep) {
handleWCONProducer(keyword, currentStep, false);
void Schedule::handleWCONHIST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext) {
handleWCONProducer(keyword, currentStep, false, parseContext);
}
void Schedule::handleWCONPROD( const DeckKeyword& keyword, size_t currentStep) {
handleWCONProducer(keyword, currentStep, true);
void Schedule::handleWCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext) {
handleWCONProducer( keyword, currentStep, true, parseContext);
}
static Opm::Value<int> getValueItem( const DeckItem& item ){

View File

@@ -515,6 +515,17 @@ BOOST_AUTO_TEST_CASE( test_invalid_wtemplate_config ) {
)";
testSamples.push_back(testSample);
// Invalid well name in WCONPROD
testSample = R"(
COMPDAT
'PROD' 10 10 3 3 'OPEN' 1* 1* 0.5 /
/
WCONPROD
'SOMETHINGELSE' 'OPEN' 'ORAT' 20000 4* 1000 /
/
)";
testSamples.push_back(testSample);
std::string deckinput;
for (std::string sample : testSamples) {