mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
use exception classes from opm-common
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "blackoilproperties.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/utils/signum.hh>
|
||||
#include <opm/models/nonlinear/newtonmethod.hh>
|
||||
#include "blackoilmicpmodules.hh"
|
||||
@@ -227,7 +229,7 @@ public:
|
||||
succeeded = comm.min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("A process did not succeed in adapting the primary variables");
|
||||
throw NumericalProblem("A process did not succeed in adapting the primary variables");
|
||||
|
||||
numPriVarsSwitched_ = comm.sum(numPriVarsSwitched_);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "blackoilproperties.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/blackoil/blackoilsolventparams.hh>
|
||||
#include <opm/models/io/vtkblackoilsolventmodule.hh>
|
||||
#include <opm/models/common/quantitycallbacks.hh>
|
||||
@@ -49,7 +51,6 @@
|
||||
#endif
|
||||
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
@@ -1189,7 +1190,7 @@ public:
|
||||
solventPGrad[dimIdx] += f[dimIdx];
|
||||
|
||||
if (!isfinite(solventPGrad[dimIdx]))
|
||||
throw NumericalIssue("Non-finite potential gradient for solvent 'phase'");
|
||||
throw NumericalProblem("Non-finite potential gradient for solvent 'phase'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,12 @@
|
||||
#define EWOMS_DARCY_FLUX_MODULE_HH
|
||||
|
||||
#include "multiphasebaseproperties.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/common/quantitycallbacks.hh>
|
||||
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
@@ -280,8 +282,8 @@ protected:
|
||||
|
||||
for (unsigned dimIdx = 0; dimIdx < potentialGrad_[phaseIdx].size(); ++dimIdx) {
|
||||
if (!isfinite(potentialGrad_[phaseIdx][dimIdx])) {
|
||||
throw NumericalIssue("Non-finite potential gradient for phase '"
|
||||
+std::string(FluidSystem::phaseName(phaseIdx))+"'");
|
||||
throw NumericalProblem("Non-finite potential gradient for phase '"
|
||||
+ std::string(FluidSystem::phaseName(phaseIdx))+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -399,8 +401,8 @@ protected:
|
||||
Valgrind::CheckDefined(potentialGrad_[phaseIdx]);
|
||||
for (unsigned dimIdx = 0; dimIdx < potentialGrad_[phaseIdx].size(); ++dimIdx) {
|
||||
if (!isfinite(potentialGrad_[phaseIdx][dimIdx])) {
|
||||
throw NumericalIssue("Non finite potential gradient for phase '"
|
||||
+std::string(FluidSystem::phaseName(phaseIdx))+"'");
|
||||
throw NumericalProblem("Non-finite potential gradient for phase '"
|
||||
+ std::string(FluidSystem::phaseName(phaseIdx))+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
|
||||
#include "darcyfluxmodule.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseproperties.hh>
|
||||
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
@@ -448,8 +449,8 @@ protected:
|
||||
unsigned newtonIter = 0;
|
||||
while (deltaV.one_norm() > 1e-11) {
|
||||
if (newtonIter >= 50)
|
||||
throw NumericalIssue("Could not determine Forchheimer velocity within "
|
||||
+std::to_string(newtonIter)+" iterations");
|
||||
throw NumericalProblem("Could not determine Forchheimer velocity within "
|
||||
+ std::to_string(newtonIter)+" iterations");
|
||||
++newtonIter;
|
||||
|
||||
// calculate the residual and its Jacobian matrix
|
||||
|
||||
@@ -40,8 +40,7 @@
|
||||
#include <opm/models/immiscible/immisciblemodel.hh>
|
||||
#include <opm/models/io/vtkdiscretefracturemodule.hh>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
|
||||
#include <opm/material/common/MathToolbox.hpp>
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/version.hh>
|
||||
#include <dune/common/fvector.hh>
|
||||
@@ -74,6 +73,7 @@
|
||||
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
#include "fvbaseproperties.hh"
|
||||
#include "linearizationtype.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/parallel/gridcommhandles.hh>
|
||||
#include <opm/models/parallel/threadmanager.hh>
|
||||
#include <opm/models/parallel/threadedentityiterator.hh>
|
||||
#include <opm/models/discretization/common/baseauxiliarymodule.hh>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/version.hh>
|
||||
#include <dune/common/fvector.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
succeeded = gridView_().comm().min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("A process did not succeed in linearizing the system");
|
||||
throw NumericalProblem("A process did not succeed in linearizing the system");
|
||||
}
|
||||
|
||||
void finalize()
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
succeeded = comm.min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("linearization of an auxiliary equation failed");
|
||||
throw NumericalProblem("linearization of an auxiliary equation failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,11 @@
|
||||
#include "fvbaseproperties.hh"
|
||||
#include "linearizationtype.hh"
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*!
|
||||
|
||||
@@ -31,9 +31,10 @@
|
||||
#include "fvbaseproperties.hh"
|
||||
#include "linearizationtype.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/discretization/common/baseauxiliarymodule.hh>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
#include <opm/grid/utility/SparseTable.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
|
||||
@@ -202,7 +203,7 @@ public:
|
||||
succeeded = gridView_().comm().min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("A process did not succeed in linearizing the system");
|
||||
throw NumericalProblem("A process did not succeed in linearizing the system");
|
||||
}
|
||||
|
||||
void finalize()
|
||||
@@ -235,7 +236,7 @@ public:
|
||||
succeeded = comm.min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("linearization of an auxiliary equation failed");
|
||||
throw NumericalProblem("linearization of an auxiliary equation failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <opm/models/utils/quadraturegeometries.hh>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/grid/common/intersectioniterator.hh>
|
||||
#include <dune/grid/common/mcmgmapper.hh>
|
||||
#include <dune/geometry/referenceelements.hh>
|
||||
@@ -42,6 +40,7 @@
|
||||
|
||||
#include <dune/common/version.hh>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -34,10 +34,9 @@
|
||||
#include <dune/common/fvector.hh>
|
||||
#include <dune/common/version.hh>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -34,10 +34,9 @@
|
||||
#include <dune/common/fvector.hh>
|
||||
#include <dune/common/version.hh>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include "ncpnewtonmethod.hh"
|
||||
#include "ncpindices.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/common/multiphasebasemodel.hh>
|
||||
#include <opm/models/common/energymodule.hh>
|
||||
#include <opm/models/common/diffusionmodule.hh>
|
||||
@@ -48,7 +50,6 @@
|
||||
#include <opm/models/io/vtkdiffusionmodule.hh>
|
||||
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
@@ -381,8 +382,8 @@ public:
|
||||
Opm::Valgrind::CheckDefined(minActivityCoeff_[globalIdx][compIdx]);
|
||||
}
|
||||
if (minActivityCoeff_[globalIdx][compIdx] <= 0)
|
||||
throw Opm::NumericalIssue("The minimum activity coefficient for component "+std::to_string(compIdx)
|
||||
+" on DOF "+std::to_string(globalIdx)+" is negative or zero!");
|
||||
throw NumericalProblem("The minimum activity coefficient for component "+std::to_string(compIdx)
|
||||
+" on DOF "+std::to_string(globalIdx)+" is negative or zero!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
#include "ncpproperties.hh"
|
||||
|
||||
#include <opm/models/nonlinear/newtonmethod.hh>
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
#include <opm/models/nonlinear/newtonmethod.hh>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -118,9 +118,9 @@ protected:
|
||||
// make sure that the error never grows beyond the maximum
|
||||
// allowed one
|
||||
if (this->error_ > EWOMS_GET_PARAM(TypeTag, Scalar, NewtonMaxError))
|
||||
throw Opm::NumericalIssue("Newton: Error "+std::to_string(double(this->error_))+
|
||||
+" is larger than maximum allowed error of "
|
||||
+std::to_string(double(EWOMS_GET_PARAM(TypeTag, Scalar, NewtonMaxError))));
|
||||
throw Opm::NumericalProblem("Newton: Error "+std::to_string(double(this->error_))+
|
||||
+ " is larger than maximum allowed error of "
|
||||
+ std::to_string(double(EWOMS_GET_PARAM(TypeTag, Scalar, NewtonMaxError))));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -30,13 +30,15 @@
|
||||
#include "nullconvergencewriter.hh"
|
||||
|
||||
#include "newtonmethodproperties.hh"
|
||||
#include <opm/models/utils/timer.hh>
|
||||
#include <opm/models/utils/timerguard.hh>
|
||||
#include <opm/simulators/linalg/linalgproperties.hh>
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/material/densead/Math.hpp>
|
||||
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
#include <opm/models/utils/timer.hh>
|
||||
#include <opm/models/utils/timerguard.hh>
|
||||
|
||||
#include <opm/simulators/linalg/linalgproperties.hh>
|
||||
|
||||
#include <dune/istl/istlexception.hh>
|
||||
#include <dune/common/classname.hh>
|
||||
@@ -407,7 +409,7 @@ public:
|
||||
|
||||
return false;
|
||||
}
|
||||
catch (const NumericalIssue& e)
|
||||
catch (const NumericalProblem& e)
|
||||
{
|
||||
if (asImp_().verbose_())
|
||||
std::cout << "Newton method caught exception: \""
|
||||
@@ -574,7 +576,7 @@ protected:
|
||||
succeeded = comm.min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("pre processing of the problem failed");
|
||||
throw NumericalProblem("pre processing of the problem failed");
|
||||
|
||||
lastError_ = error_;
|
||||
}
|
||||
@@ -626,9 +628,9 @@ protected:
|
||||
// make sure that the error never grows beyond the maximum
|
||||
// allowed one
|
||||
if (error_ > newtonMaxError)
|
||||
throw NumericalIssue("Newton: Error "+std::to_string(double(error_))
|
||||
+" is larger than maximum allowed error of "
|
||||
+std::to_string(double(newtonMaxError)));
|
||||
throw NumericalProblem("Newton: Error "+std::to_string(double(error_))
|
||||
+ " is larger than maximum allowed error of "
|
||||
+ std::to_string(double(newtonMaxError)));
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -669,7 +671,7 @@ protected:
|
||||
succeeded = comm.min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("post processing of an auxilary equation failed");
|
||||
throw NumericalProblem("post processing of an auxilary equation failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,7 +702,7 @@ protected:
|
||||
|
||||
// make sure not to swallow non-finite values at this point
|
||||
if (!std::isfinite(solutionUpdate.one_norm()))
|
||||
throw NumericalIssue("Non-finite update!");
|
||||
throw NumericalProblem("Non-finite update!");
|
||||
|
||||
size_t numGridDof = model().numGridDof();
|
||||
for (unsigned dofIdx = 0; dofIdx < numGridDof; ++dofIdx) {
|
||||
@@ -798,7 +800,7 @@ protected:
|
||||
succeeded = comm.min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw NumericalIssue("post processing of the problem failed");
|
||||
throw NumericalProblem("post processing of the problem failed");
|
||||
|
||||
if (asImp_().verbose_()) {
|
||||
std::cout << "Newton iteration " << numIterations_ << ""
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include "pvsextensivequantities.hh"
|
||||
#include "pvsindices.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/common/multiphasebasemodel.hh>
|
||||
#include <opm/models/common/diffusionmodule.hh>
|
||||
#include <opm/models/common/energymodule.hh>
|
||||
@@ -49,7 +51,6 @@
|
||||
|
||||
#include <opm/material/fluidmatrixinteractions/NullMaterial.hpp>
|
||||
#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -545,7 +546,7 @@ public:
|
||||
succeeded = this->simulator_.gridView().comm().min(succeeded);
|
||||
|
||||
if (!succeeded)
|
||||
throw Opm::NumericalIssue("A process did not succeed in adapting the primary variables");
|
||||
throw NumericalProblem("A process did not succeed in adapting the primary variables");
|
||||
|
||||
// make sure that if there was a variable switch in an
|
||||
// other partition we will also set the switch flag
|
||||
|
||||
@@ -31,13 +31,14 @@
|
||||
#include "pvsindices.hh"
|
||||
#include "pvsproperties.hh"
|
||||
|
||||
#include <opm/common/Exceptions.hpp>
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseprimaryvariables.hh>
|
||||
#include <opm/models/common/energymodule.hh>
|
||||
|
||||
#include <opm/material/constraintsolvers/NcpFlash.hpp>
|
||||
#include <opm/material/fluidstates/CompositionalFluidState.hpp>
|
||||
#include <opm/material/common/Valgrind.hpp>
|
||||
#include <opm/material/common/Exceptions.hpp>
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
@@ -303,7 +304,7 @@ public:
|
||||
|
||||
// some phase must be present
|
||||
if (phasePresence_ == 0)
|
||||
throw Opm::NumericalIssue("Phase state was 0, i.e., no fluid is present");
|
||||
throw NumericalProblem("Phase state was 0, i.e., no fluid is present");
|
||||
|
||||
// set the primary variables which correspond to mole
|
||||
// fractions of the present phase which has the lowest index.
|
||||
|
||||
Reference in New Issue
Block a user