adapt to the move of code from opm-common to opm-material

This commit is contained in:
Andreas Lauser 2018-02-01 14:40:01 +01:00
parent d3cb81a7ba
commit 260d62c2b8
13 changed files with 80 additions and 121 deletions

View File

@ -25,8 +25,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <array>
#include <vector>
@ -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 <class GridView>

View File

@ -37,8 +37,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <dune/grid/common/mcmgmapper.hh>
@ -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();
}

View File

@ -30,8 +30,7 @@
#include <ewoms/disc/common/fvbaseproperties.hh>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <dune/common/fvector.hh>
@ -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 <class QuantityCallback>
@ -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 <class QuantityCallback>
@ -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 <class QuantityCallback>
@ -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

View File

@ -35,9 +35,8 @@
#include <ewoms/models/blackoil/blackoilproperties.hh>
#include <ewoms/common/signum.hh>
#include <opm/common/Valgrind.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
@ -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");
}
/*!

View File

@ -32,7 +32,7 @@
#include <ewoms/common/propertysystem.hh>
#include <ewoms/common/parametersystem.hh>
#include <opm/common/Valgrind.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/output/data/Cells.hpp>
@ -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.");
}
}

View File

@ -36,9 +36,8 @@
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
#include <opm/material/densead/Evaluation.hpp>
#include <opm/material/densead/Math.hpp>
#include <opm/common/Valgrind.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <dune/common/fmatrix.hh>
#include <dune/common/version.hh>
@ -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>(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 <class BhpEval>

View File

@ -73,14 +73,13 @@
#include <opm/material/fluidsystems/blackoilpvt/DeadOilPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.hpp>
#include <opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.hpp>
#include <opm/common/Valgrind.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <dune/common/version.hh>
#include <dune/common/fvector.hh>
@ -358,7 +357,7 @@ public:
boost::filesystem::create_directories(outputDir);
}
catch (...) {
OPM_THROW(std::runtime_error, "Creation of output directory '"<<outputDir<<"' failed\n");
throw std::runtime_error("Creation of output directory '"+outputDir+"' failed\n");
}
}
}
@ -1343,9 +1342,8 @@ private:
else if (rockTableType == "ROCKNUM")
propName = "ROCKNUM";
else {
OPM_THROW(std::runtime_error,
"Unknown table type '" << rockTableType
<< " for the ROCKOPTS keyword given");
throw std::runtime_error("Unknown table type '"+rockTableType
+" for the ROCKOPTS keyword given");
}
}
@ -1535,26 +1533,21 @@ private:
// make sure all required quantities are enables
if (FluidSystem::phaseIsActive(waterPhaseIdx) && !eclProps.hasDeckDoubleGridProperty("SWAT"))
OPM_THROW(std::runtime_error,
"The ECL input file requires the presence of the SWAT keyword if "
"the water phase is active");
throw std::runtime_error("The ECL input file requires the presence of the SWAT keyword if "
"the water phase is active");
if (FluidSystem::phaseIsActive(gasPhaseIdx) && !eclProps.hasDeckDoubleGridProperty("SGAS"))
OPM_THROW(std::runtime_error,
"The ECL input file requires the presence of the SGAS keyword if "
"the gas phase is active");
throw std::runtime_error("The ECL input file requires the presence of the SGAS keyword if "
"the gas phase is active");
if (!eclProps.hasDeckDoubleGridProperty("PRESSURE"))
OPM_THROW(std::runtime_error,
"The ECL input file requires the presence of the PRESSURE "
"keyword if the model is initialized explicitly");
throw std::runtime_error("The ECL input file requires the presence of the PRESSURE "
"keyword if the model is initialized explicitly");
if (FluidSystem::enableDissolvedGas() && !eclProps.hasDeckDoubleGridProperty("RS"))
OPM_THROW(std::runtime_error,
"The ECL input file requires the RS keyword to be present if"
" dissolved gas is enabled");
throw std::runtime_error("The ECL input file requires the RS keyword to be present if"
" dissolved gas is enabled");
if (FluidSystem::enableVaporizedOil() && !eclProps.hasDeckDoubleGridProperty("RV"))
OPM_THROW(std::runtime_error,
"The ECL input file requires the RV keyword to be present if"
" vaporized oil is enabled");
throw std::runtime_error("The ECL input file requires the RV keyword to be present if"
" vaporized oil is enabled");
size_t numDof = this->model().numGridDof();

View File

@ -39,8 +39,8 @@
#include <opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <dune/grid/common/gridenums.hh>
#include <dune/common/version.hh>
@ -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

View File

@ -38,8 +38,7 @@
#include <dune/grid/CpGrid.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <dune/grid/common/mcmgmapper.hh>
@ -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

View File

@ -39,8 +39,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <ewoms/common/propertysystem.hh>
#include <ewoms/parallel/threadedentityiterator.hh>
@ -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;
}

View File

@ -36,9 +36,8 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/common/Valgrind.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/material/common/Valgrind.hpp>
#include <opm/material/common/Exceptions.hpp>
#include <boost/algorithm/string.hpp>
@ -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<std::string, std::vector<int> > 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
}

View File

@ -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

View File

@ -705,7 +705,7 @@ phaseSaturations(const Grid& grid,
std::vector< std::vector<double> >& 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<double> > 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<Miscibility::PDVD<FluidSystem>>(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