From 09aa2b7bf74ffd1873af6806920f540cfba64065 Mon Sep 17 00:00:00 2001 From: Fredrik Gundersen Date: Thu, 20 Aug 2015 13:00:01 +0200 Subject: [PATCH 1/2] Added suport for new Threshold Pressure behavior --- opm/core/utility/thresholdPressures.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/opm/core/utility/thresholdPressures.hpp b/opm/core/utility/thresholdPressures.hpp index 51ec4a52..9a308bca 100644 --- a/opm/core/utility/thresholdPressures.hpp +++ b/opm/core/utility/thresholdPressures.hpp @@ -19,7 +19,7 @@ #include #include - +#include #ifndef OPM_THRESHOLDPRESSURES_HEADER_INCLUDED #define OPM_THRESHOLDPRESSURES_HEADER_INCLUDED @@ -46,10 +46,16 @@ namespace Opm template - std::vector thresholdPressures(EclipseStateConstPtr eclipseState, const Grid& grid) + std::vector thresholdPressures(const ParseMode& parseMode ,EclipseStateConstPtr eclipseState, const Grid& grid) { SimulationConfigConstPtr simulationConfig = eclipseState->getSimulationConfig(); - const std::vector& thresholdPressureTable = simulationConfig->getThresholdPressureTable(); + const std::vector& thresholdPressureTable; + if(simulationConfig->hasThresholdPressure()){ + thresholdPressureTable = simulationConfig->getThresholdPressureTable(); + }else{ + std::string msg = "Inferring threshold pressure from the initial state is not supported."; + parseMode.handleError( ParseMode::UNSUPPORTED_INITIAL_THPRES , msg ); + } std::vector thpres_vals; From 352a5d826bfff65e0cd15349b637a38e3cd859bd Mon Sep 17 00:00:00 2001 From: Fredrik Gundersen Date: Mon, 24 Aug 2015 15:37:49 +0200 Subject: [PATCH 2/2] Updated as needed by new opm-parser functinality --- opm/core/utility/thresholdPressures.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/opm/core/utility/thresholdPressures.hpp b/opm/core/utility/thresholdPressures.hpp index 9a308bca..87e62ea2 100644 --- a/opm/core/utility/thresholdPressures.hpp +++ b/opm/core/utility/thresholdPressures.hpp @@ -49,14 +49,7 @@ namespace Opm std::vector thresholdPressures(const ParseMode& parseMode ,EclipseStateConstPtr eclipseState, const Grid& grid) { SimulationConfigConstPtr simulationConfig = eclipseState->getSimulationConfig(); - const std::vector& thresholdPressureTable; - if(simulationConfig->hasThresholdPressure()){ - thresholdPressureTable = simulationConfig->getThresholdPressureTable(); - }else{ - std::string msg = "Inferring threshold pressure from the initial state is not supported."; - parseMode.handleError( ParseMode::UNSUPPORTED_INITIAL_THPRES , msg ); - } - + const std::vector>& thresholdPressureTable = simulationConfig->getThresholdPressureTable(); std::vector thpres_vals; if (thresholdPressureTable.size() > 0) { @@ -79,7 +72,13 @@ namespace Opm } const int eq1 = eqlnumData[gc[c1]] - 1; const int eq2 = eqlnumData[gc[c2]] - 1; - thpres_vals[face] = thresholdPressureTable[eq1 + maxEqlnum*eq2]; + std::pair value = thresholdPressureTable[eq1 + maxEqlnum*eq2]; + if(value.first){ + thpres_vals[face] = value.second; + }else{ + std::string msg = "Inferring threshold pressure from the initial state is not supported."; + parseMode.handleError( ParseMode::UNSUPPORTED_INITIAL_THPRES , msg ); + } } } return thpres_vals;