diff --git a/opm/core/utility/thresholdPressures.hpp b/opm/core/utility/thresholdPressures.hpp index 51ec4a52..87e62ea2 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,11 +46,10 @@ 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 = simulationConfig->getThresholdPressureTable(); std::vector thpres_vals; if (thresholdPressureTable.size() > 0) { @@ -73,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;