From 4fe559ba3ca0c8d8b0fb5ead13499fa8b5002828 Mon Sep 17 00:00:00 2001 From: OPMUSER Date: Mon, 11 Jul 2022 15:02:10 +0800 Subject: [PATCH] Remove C++ Code and Place Conditions in JSON Files Remove the C++ code checks and instead place the logic in the keyword JSON files. This is a cleaner approach. Note we force that only one of the keywords is allowed in the deck to avoid confusion on what cut-off is actually being applied. --- src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp | 8 -------- .../input/eclipse/share/keywords/000_Eclipse100/M/MINPORV | 1 + .../input/eclipse/share/keywords/000_Eclipse100/M/MINPV | 1 + src/opm/input/eclipse/share/keywords/900_OPM/M/MINPVFIL | 1 + 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp b/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp index 1b7b67f88..6d976b03d 100644 --- a/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp +++ b/src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp @@ -344,14 +344,6 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum) m_pinchGapMode = PinchMode::PinchModeFromString(pinchGapString); } - if (deck.hasKeyword() && deck.hasKeyword()) { - throw std::invalid_argument("Can not have both MINPV and MINPVFIL in the deck."); - } else if(deck.hasKeyword() && deck.hasKeyword()) { - throw std::invalid_argument("Can not have both MINPV and MINPORV in the deck."); - } else if(deck.hasKeyword() && deck.hasKeyword()) { - throw std::invalid_argument("Can not have both MINPORV and MINPVFIL in the deck."); - } - m_minpvVector.resize(getCartesianSize(), 0.0); if (deck.hasKeyword()) { const auto& record = deck.get( ).back().getRecord(0); diff --git a/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPORV b/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPORV index ab679d585..f8cd0bd2f 100644 --- a/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPORV +++ b/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPORV @@ -3,6 +3,7 @@ "sections": [ "GRID" ], + "prohibits" : ["MINPV", "MINPVFIL"], "size": 1, "items": [ { diff --git a/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPV b/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPV index 8787949fb..228fe7576 100644 --- a/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPV +++ b/src/opm/input/eclipse/share/keywords/000_Eclipse100/M/MINPV @@ -3,6 +3,7 @@ "sections": [ "GRID" ], + "prohibits" : ["MINPORV", "MINPVFIL"], "size": 1, "items": [ { diff --git a/src/opm/input/eclipse/share/keywords/900_OPM/M/MINPVFIL b/src/opm/input/eclipse/share/keywords/900_OPM/M/MINPVFIL index 7ff5854f9..e5b39a225 100644 --- a/src/opm/input/eclipse/share/keywords/900_OPM/M/MINPVFIL +++ b/src/opm/input/eclipse/share/keywords/900_OPM/M/MINPVFIL @@ -3,6 +3,7 @@ "sections": [ "GRID" ], + "prohibits" : ["MINPV", "MINPORV"], "size": 1, "items": [ {