diff --git a/opm/simulators/flow/FlowGenericProblem_impl.hpp b/opm/simulators/flow/FlowGenericProblem_impl.hpp index e15d5e351c6..bebcfa1963b 100644 --- a/opm/simulators/flow/FlowGenericProblem_impl.hpp +++ b/opm/simulators/flow/FlowGenericProblem_impl.hpp @@ -81,9 +81,25 @@ FlowGenericProblem(const EclipseState& eclState, // 2. EQLDIMS item 2. Default value from // opm-common/opm/input/eclipse/share/keywords/000_Eclipse100/E/EQLDIMS - numPressurePointsEquil_ = Parameters::IsSet() - ? Parameters::Get() - : eclState.getTableManager().getEqldims().getNumDepthNodesP(); + if (Parameters::IsSet()) { + numPressurePointsEquil_ = Parameters::Get(); + if (numPressurePointsEquil_ < 1) { + throw std::invalid_argument { + fmt::format("--num-pressure-points-equil must be at least 1, " + "but {} was given.", numPressurePointsEquil_) + }; + } + } + else { + numPressurePointsEquil_ = eclState.getTableManager().getEqldims().getNumDepthNodesP(); + if (numPressurePointsEquil_ < 1) { + throw std::invalid_argument { + fmt::format("EQLDIMS item 2, the number of depth nodes in the " + "equilibration pressure tables, must be at least 1, " + "but {} was given.", numPressurePointsEquil_) + }; + } + } explicitRockCompaction_ = Parameters::Get(); } diff --git a/opm/simulators/flow/equil/InitStateEquil_impl.hpp b/opm/simulators/flow/equil/InitStateEquil_impl.hpp index 0ee10d8b119..db6ccd49292 100644 --- a/opm/simulators/flow/equil/InitStateEquil_impl.hpp +++ b/opm/simulators/flow/equil/InitStateEquil_impl.hpp @@ -323,6 +323,11 @@ RK4IVP::RK4IVP(const RHS& f, : N_(N) , span_(span) { + // stepsize() divides by N_ and operator() evaluates interval N_ - 1. A + // non-positive sample count is rejected when the value is loaded in + // FlowGenericProblem, where its source is known. + assert(N >= 1); + const Scalar h = stepsize(); const Scalar h2 = h / 2; const Scalar h6 = h / 6;