diff --git a/ebos/alucartesianindexmapper.hh b/ebos/alucartesianindexmapper.hh index 5b02fabae..3214c2c1b 100644 --- a/ebos/alucartesianindexmapper.hh +++ b/ebos/alucartesianindexmapper.hh @@ -25,8 +25,7 @@ #include -#include -#include +#include #include #include @@ -226,7 +225,7 @@ namespace Ewoms coords[ 0 ] = gc ; } else - OPM_THROW(Opm::NotImplemented,"cartesianCoordinate not implemented for dimension " << dimension ); + throw std::invalid_argument("cartesianCoordinate not implemented for dimension " << dimension ); } template diff --git a/ebos/collecttoiorank.hh b/ebos/collecttoiorank.hh index 0dd3c6eea..1dc984794 100644 --- a/ebos/collecttoiorank.hh +++ b/ebos/collecttoiorank.hh @@ -37,8 +37,7 @@ #include #include -#include -#include +#include #include @@ -135,7 +134,7 @@ namespace Ewoms { // we should only get one link if( link != 0 ) { - OPM_THROW(std::logic_error,"link in method pack is not 0 as execpted"); + throw std::logic_error("link in method pack is not 0 as execpted"); } // pack all interior global cell id's @@ -328,7 +327,7 @@ namespace Ewoms { // we should only get one link if( link != 0 ) { - OPM_THROW(std::logic_error,"link in method pack is not 0 as expected"); + throw std::logic_error("link in method pack is not 0 as expected"); } // write all cell data registered in local state @@ -486,10 +485,10 @@ namespace Ewoms // the last indexMap is the local one const IndexMapType& indexMap = indexMaps_.back(); if( indexMap.empty() ) - OPM_THROW(std::logic_error,"index map is not created on this rank"); + throw std::logic_error("index map is not created on this rank"); if (localIdx > indexMap.size()) - OPM_THROW(std::logic_error,"local index is outside map range"); + throw std::logic_error("local index is outside map range"); return indexMap[localIdx]; } @@ -510,7 +509,7 @@ namespace Ewoms // the last indexMap is the local one const IndexMapType& indexMap = indexMaps_.back(); if( indexMap.empty() ) - OPM_THROW(std::logic_error,"index map is not created on this rank"); + throw std::logic_error("index map is not created on this rank"); return std::find(indexMap.begin(), indexMap.end(), globalIdx) != indexMap.end(); } diff --git a/ebos/ecldummygradientcalculator.hh b/ebos/ecldummygradientcalculator.hh index e1f112472..062479211 100644 --- a/ebos/ecldummygradientcalculator.hh +++ b/ebos/ecldummygradientcalculator.hh @@ -30,8 +30,7 @@ #include -#include -#include +#include #include @@ -71,8 +70,7 @@ public: unsigned fapIdx OPM_UNUSED, const QuantityCallback& quantityCallback OPM_UNUSED) const { - OPM_THROW(std::logic_error, - "Generic values are not supported by the ECL black-oil simulator"); + throw std::logic_error("Generic values are not supported by the ECL black-oil simulator"); } template @@ -81,8 +79,7 @@ public: unsigned fapIdx OPM_UNUSED, const QuantityCallback& quantityCallback OPM_UNUSED) const { - OPM_THROW(std::logic_error, - "Generic gradients are not supported by the ECL black-oil simulator"); + throw std::logic_error("Generic gradients are not supported by the ECL black-oil simulator"); } template @@ -90,8 +87,7 @@ public: unsigned fapIdx OPM_UNUSED, const QuantityCallback& quantityCallback OPM_UNUSED) { - OPM_THROW(std::logic_error, - "Generic boundary values are not supported by the ECL black-oil simulator"); + throw std::logic_error("Generic boundary values are not supported by the ECL black-oil simulator"); } template @@ -100,8 +96,7 @@ public: unsigned fapIdx OPM_UNUSED, const QuantityCallback& quantityCallback OPM_UNUSED) const { - OPM_THROW(std::logic_error, - "Generic boundary gradients are not supported by the ECL black-oil simulator"); + throw std::logic_error("Generic boundary gradients are not supported by the ECL black-oil simulator"); } }; } // namespace Ewoms diff --git a/ebos/eclfluxmodule.hh b/ebos/eclfluxmodule.hh index 2695092c6..5aac1b589 100644 --- a/ebos/eclfluxmodule.hh +++ b/ebos/eclfluxmodule.hh @@ -35,9 +35,8 @@ #include #include -#include -#include -#include +#include +#include #include #include @@ -128,8 +127,7 @@ public: */ const DimMatrix& intrinsicPermeability() const { - OPM_THROW(Opm::NotImplemented, - "The ECL transmissibility module does not provide an explicit intrinsic permeability"); + throw std::invalid_argument("The ECL transmissibility module does not provide an explicit intrinsic permeability"); } /*! @@ -140,8 +138,7 @@ public: */ const EvalDimVector& potentialGrad(unsigned phaseIdx OPM_UNUSED) const { - OPM_THROW(Opm::NotImplemented, - "The ECL transmissibility module does not provide explicit potential gradients"); + throw std::invalid_argument("The ECL transmissibility module does not provide explicit potential gradients"); } /*! @@ -161,8 +158,7 @@ public: */ const EvalDimVector& filterVelocity(unsigned phaseIdx OPM_UNUSED) const { - OPM_THROW(Opm::NotImplemented, - "The ECL transmissibility module does not provide explicit filter velocities"); + throw std::invalid_argument("The ECL transmissibility module does not provide explicit filter velocities"); } /*! diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index 087cf8a60..e8782e7f8 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include @@ -439,7 +439,7 @@ public: try { bubblePointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::bubblePointPressure(fs, intQuants.pvtRegionIndex())); } - catch (const Opm::NumericalProblem& e) { + catch (const Opm::NumericalIssue& e) { const auto globalIdx = elemCtx.simulator().gridManager().grid().globalCell()[globalDofIdx]; failedCellsPb_.push_back(globalIdx); } @@ -449,7 +449,7 @@ public: try { dewPointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::dewPointPressure(fs, intQuants.pvtRegionIndex())); } - catch (const Opm::NumericalProblem& e) { + catch (const Opm::NumericalIssue& e) { const auto globalIdx = elemCtx.simulator().gridManager().grid().globalCell()[globalDofIdx]; failedCellsPd_.push_back(globalIdx); } @@ -1154,7 +1154,7 @@ private: // nothing to do } else { - OPM_THROW(std::runtime_error, "Unsupported unit type for fluid in place output."); + throw std::runtime_error("Unsupported unit type for fluid in place output."); } } @@ -1166,7 +1166,7 @@ private: pav = Opm::unit::convert::to(pav, Opm::unit::barsa); } else { - OPM_THROW(std::runtime_error, "Unsupported unit type for fluid in place output."); + throw std::runtime_error("Unsupported unit type for fluid in place output."); } } diff --git a/ebos/eclpeacemanwell.hh b/ebos/eclpeacemanwell.hh index 7a0fb0d27..97378a72b 100644 --- a/ebos/eclpeacemanwell.hh +++ b/ebos/eclpeacemanwell.hh @@ -36,9 +36,8 @@ #include #include #include -#include -#include -#include +#include +#include #include #include @@ -1206,8 +1205,7 @@ protected: } } else - OPM_THROW(std::logic_error, - "Type of well \"" << name() << "\" is undefined"); + throw std::logic_error("Type of well \""+name()+"\" is undefined"); Opm::Valgrind::CheckDefined(pbh); Opm::Valgrind::CheckDefined(p); @@ -1426,9 +1424,8 @@ protected: const auto& f = wellResidual_(bhpEval); if (std::abs(f.derivative(0)) < 1e-20) - OPM_THROW(Opm::NumericalProblem, - "Cannot determine the bottom hole pressure for well " << name() - << ": Derivative of the well residual is too small"); + throw Opm::NumericalIssue("Cannot determine the bottom hole pressure for well "+name() + +": Derivative of the well residual is too small"); Scalar delta = f.value()/f.derivative(0); bhpEval.setValue(bhpEval.value() - delta); @@ -1446,9 +1443,8 @@ protected: return bhpEval.value(); } - OPM_THROW(Opm::NumericalProblem, - "Could not determine the bottom hole pressure of well '" << name() - << "' within 20 iterations."); + throw Opm::NumericalIssue("Could not determine the bottom hole pressure of well '"+name() + +"' within 20 iterations."); } template diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index ac8cf0f54..3e9364e4f 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -73,14 +73,13 @@ #include #include #include -#include +#include #include #include #include #include #include -#include -#include +#include #include #include @@ -358,7 +357,7 @@ public: boost::filesystem::create_directories(outputDir); } catch (...) { - OPM_THROW(std::runtime_error, "Creation of output directory '"<model().numGridDof(); diff --git a/ebos/eclthresholdpressure.hh b/ebos/eclthresholdpressure.hh index 5d0728c46..425b32eb1 100644 --- a/ebos/eclthresholdpressure.hh +++ b/ebos/eclthresholdpressure.hh @@ -39,8 +39,8 @@ #include #include #include -#include -#include + +#include #include #include @@ -113,8 +113,7 @@ public: if (numEquilRegions_ > 0xff) { // make sure that the index of an equilibration region can be stored in a // single byte - OPM_THROW(std::runtime_error, - "The maximum number of supported equilibration regions is 255!"); + throw std::runtime_error("The maximum number of supported equilibration regions is 255!"); } // allocate the array which specifies the threshold pressures diff --git a/ebos/ecltransmissibility.hh b/ebos/ecltransmissibility.hh index 02d967449..c412a3ef0 100644 --- a/ebos/ecltransmissibility.hh +++ b/ebos/ecltransmissibility.hh @@ -38,8 +38,7 @@ #include -#include -#include +#include #include @@ -255,7 +254,7 @@ public: break; default: - OPM_THROW(std::logic_error, "Could not determine a face direction"); + throw std::logic_error("Could not determine a face direction"); } trans *= transMult.getRegionMultiplier(insideCartElemIdx, @@ -343,9 +342,8 @@ private: // for now we don't care about non-diagonal entries } else - OPM_THROW(std::logic_error, - "Can't read the intrinsic permeability from the ecl state. " - "(The PERM{X,Y,Z} keywords are missing)"); + throw std::logic_error("Can't read the intrinsic permeability from the ecl state. " + "(The PERM{X,Y,Z} keywords are missing)"); } std::uint64_t isId_(unsigned elemIdx1, unsigned elemIdx2) const diff --git a/ebos/eclwellmanager.hh b/ebos/eclwellmanager.hh index 29d21fa6e..5f085432b 100644 --- a/ebos/eclwellmanager.hh +++ b/ebos/eclwellmanager.hh @@ -39,8 +39,7 @@ #include #include #include -#include -#include +#include #include #include @@ -183,8 +182,7 @@ public: well->setInjectedPhaseIndex(FluidSystem::oilPhaseIdx); break; case Opm::WellInjector::MULTI: - OPM_THROW(std::runtime_error, - "Not implemented: Multi-phase injector wells"); + throw std::runtime_error("Not implemented: Multi-phase injector wells"); } switch (injectProperties.controlMode) { @@ -205,8 +203,7 @@ public: break; case Opm::WellInjector::GRUP: - OPM_THROW(std::runtime_error, - "Not implemented: Well groups"); + throw std::runtime_error("Not implemented: Well groups"); case Opm::WellInjector::CMODE_UNDEFINED: std::cout << "Warning: Control mode of injection well " << well->name() @@ -229,8 +226,7 @@ public: break; case Opm::WellInjector::MULTI: - OPM_THROW(std::runtime_error, - "Not implemented: Multi-phase injection wells"); + throw std::runtime_error("Not implemented: Multi-phase injection wells"); } well->setMaximumSurfaceRate(injectProperties.surfaceInjectionRate); @@ -274,8 +270,7 @@ public: break; case Opm::WellProducer::CRAT: - OPM_THROW(std::runtime_error, - "Not implemented: Linearly combined rates"); + throw std::runtime_error("Not implemented: Linearly combined rates"); case Opm::WellProducer::RESV: well->setControlMode(Well::ControlMode::VolumetricReservoirRate); @@ -292,8 +287,7 @@ public: break; case Opm::WellProducer::GRUP: - OPM_THROW(std::runtime_error, - "Not implemented: Well groups"); + throw std::runtime_error("Not implemented: Well groups"); case Opm::WellProducer::NONE: // fall-through @@ -343,10 +337,7 @@ public: assert( hasWell( wellName ) ); const auto& it = wellNameToIndex_.find(wellName); if (it == wellNameToIndex_.end()) - { - OPM_THROW(std::runtime_error, - "No well called '" << wellName << "'found"); - } + throw std::runtime_error("No well called '"+wellName+"'found"); return it->second; } diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index 31f95c0e8..1871d8b33 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -36,9 +36,8 @@ #include -#include -#include -#include +#include +#include #include @@ -114,8 +113,7 @@ public: void writeInit() { #if !HAVE_OPM_OUTPUT - OPM_THROW(std::runtime_error, - "Opm-output must be available to write ECL output!"); + throw std::runtime_error("opm-output must be available to write ECL output!"); #else if (collectToIORank_.isIORank()) { std::map > integerVectors; @@ -132,8 +130,7 @@ public: void writeOutput(const Opm::data::Wells& dw, Scalar t, bool substep, Scalar totalSolverTime, Scalar nextstep) { #if !HAVE_OPM_OUTPUT - OPM_THROW(std::runtime_error, - "Opm-output must be available to write ECL output!"); + throw std::runtime_error("opm-output must be available to write ECL output!"); #else int episodeIdx = simulator_.episodeIndex() + 1; @@ -193,7 +190,6 @@ public: extraRestartData, enableDoublePrecisionOutput); } - #endif } diff --git a/ebos/equil/equilibrationhelpers.hh b/ebos/equil/equilibrationhelpers.hh index 92ba73f3d..4e2aa283d 100644 --- a/ebos/equil/equilibrationhelpers.hh +++ b/ebos/equil/equilibrationhelpers.hh @@ -751,10 +751,10 @@ double minSaturations(const MaterialLawManager& materialLawManager, const int ph return scaledDrainageInfo.Sgl; case FluidSystem::oilPhaseIdx: - OPM_THROW(std::runtime_error, "Min saturation not implemented for oil phase."); + throw std::runtime_error("Min saturation not implemented for oil phase."); default: - OPM_THROW(std::runtime_error, "Unknown phaseIdx ."); + throw std::runtime_error("Unknown phaseIdx ."); } return -1.0; } @@ -774,10 +774,10 @@ double maxSaturations(const MaterialLawManager& materialLawManager, const int ph return scaledDrainageInfo.Sgu; case FluidSystem::oilPhaseIdx: - OPM_THROW(std::runtime_error, "Max saturation not implemented for oil phase."); + throw std::runtime_error("Max saturation not implemented for oil phase."); default: - OPM_THROW(std::runtime_error, "Unknown phaseIdx ."); + throw std::runtime_error("Unknown phaseIdx ."); } return -1.0; } @@ -837,9 +837,8 @@ double satFromPc(const MaterialLawManager& materialLawManager, return (s1 + s0)/2; } - OPM_THROW(std::runtime_error, - "Could not find solution for PcEq = 0.0 after " << maxIter - << " iterations."); + throw std::runtime_error("Could not find solution for PcEq = 0.0 after "+std::to_string(maxIter) + +" iterations."); } @@ -946,9 +945,8 @@ double satFromSumOfPcs(const MaterialLawManager& materialLawManager, return (s1 + s0)/2; } - OPM_THROW(std::runtime_error, - "Could not find solution for PcEqSum = 0.0 after " << maxIter - << " iterations."); + throw std::runtime_error("Could not find solution for PcEqSum = 0.0 after "+std::to_string(maxIter) + +" iterations."); } /// Compute saturation from depth. Used for constant capillary pressure function diff --git a/ebos/equil/initstateequil.hh b/ebos/equil/initstateequil.hh index 37d109f81..7832e712a 100644 --- a/ebos/equil/initstateequil.hh +++ b/ebos/equil/initstateequil.hh @@ -705,7 +705,7 @@ phaseSaturations(const Grid& grid, std::vector< std::vector >& phasePressures) { if (!FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) { - OPM_THROW(std::runtime_error, "Cannot initialise: not handling water-gas cases."); + throw std::runtime_error("Cannot initialise: not handling water-gas cases."); } std::vector< std::vector > phaseSaturations = phasePressures; // Just to get the right size. @@ -898,7 +898,7 @@ getEquil(const Opm::EclipseState& state) const auto& init = state.getInitConfig(); if(!init.hasEquil()) { - OPM_THROW(std::domain_error, "Deck does not provide equilibration data."); + throw std::domain_error("Deck does not provide equilibration data."); } const auto& equil = init.getEquil(); @@ -1000,16 +1000,15 @@ public: depthColumn, pbubColumn)); } else { - OPM_THROW(std::runtime_error, "Cannot initialise: RSVD or PBVD table not available."); + throw std::runtime_error("Cannot initialise: RSVD or PBVD table not available."); } } else { if (rec[i].gasOilContactDepth() != rec[i].datumDepth()) { - OPM_THROW(std::runtime_error, - "Cannot initialise: when no explicit RSVD table is given, \n" - "datum depth must be at the gas-oil-contact. " - "In EQUIL region " << (i + 1) << " (counting from 1), this does not hold."); + throw std::runtime_error("Cannot initialise: when no explicit RSVD table is given, \n" + "datum depth must be at the gas-oil-contact. " + "In EQUIL region "+std::to_string(i + 1)+" (counting from 1), this does not hold."); } const double pContact = rec[i].datumDepthPressure(); const double TContact = 273.15 + 20; // standard temperature for now @@ -1048,15 +1047,15 @@ public: rvFunc_.push_back(std::make_shared>(pvtIdx, depthColumn, pdewColumn)); } else { - OPM_THROW(std::runtime_error, "Cannot initialise: RVVD or PDCD table not available."); + throw std::runtime_error("Cannot initialise: RVVD or PDCD table not available."); } } else { if (rec[i].gasOilContactDepth() != rec[i].datumDepth()) { - OPM_THROW(std::runtime_error, + throw std::runtime_error( "Cannot initialise: when no explicit RVVD table is given, \n" "datum depth must be at the gas-oil-contact. " - "In EQUIL region " << (i + 1) << " (counting from 1), this does not hold."); + "In EQUIL region "+std::to_string(i + 1)+" (counting from 1), this does not hold."); } const double pContact = rec[i].datumDepthPressure() + rec[i].gasOilContactCapillaryPressure(); const double TContact = 273.15 + 20; // standard temperature for now