mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 18:50:19 -06:00
move NewtonMaxError parameter to TypeTag-free parameter system
This commit is contained in:
parent
73344cfb60
commit
8285d999e8
@ -117,10 +117,10 @@ protected:
|
|||||||
|
|
||||||
// make sure that the error never grows beyond the maximum
|
// make sure that the error never grows beyond the maximum
|
||||||
// allowed one
|
// allowed one
|
||||||
if (this->error_ > Parameters::get<TypeTag, Parameters::NewtonMaxError>())
|
if (this->error_ > Parameters::Get<Parameters::NewtonMaxError<Scalar>>())
|
||||||
throw Opm::NumericalProblem("Newton: Error "+std::to_string(double(this->error_))+
|
throw Opm::NumericalProblem("Newton: Error "+std::to_string(double(this->error_))+
|
||||||
+ " is larger than maximum allowed error of "
|
+ " is larger than maximum allowed error of "
|
||||||
+ std::to_string(Parameters::get<TypeTag, Parameters::NewtonMaxError>()));
|
+ std::to_string(Parameters::Get<Parameters::NewtonMaxError<Scalar>>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -81,15 +81,6 @@ struct NewtonConvergenceWriter<TypeTag, TTag::NewtonMethod> { using type = NullC
|
|||||||
|
|
||||||
namespace Opm::Parameters {
|
namespace Opm::Parameters {
|
||||||
|
|
||||||
// set the abortion tolerance to some very large value. if not
|
|
||||||
// overwritten at run-time this basically disables abortions
|
|
||||||
template<class TypeTag>
|
|
||||||
struct NewtonMaxError<TypeTag, Properties::TTag::NewtonMethod>
|
|
||||||
{
|
|
||||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
|
||||||
static constexpr type value = 1e100;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class TypeTag>
|
template<class TypeTag>
|
||||||
struct NewtonTargetIterations<TypeTag, Properties::TTag::NewtonMethod>
|
struct NewtonTargetIterations<TypeTag, Properties::TTag::NewtonMethod>
|
||||||
{ static constexpr int value = 10; };
|
{ static constexpr int value = 10; };
|
||||||
@ -164,7 +155,7 @@ public:
|
|||||||
Parameters::Register<Parameters::NewtonTolerance<Scalar>>
|
Parameters::Register<Parameters::NewtonTolerance<Scalar>>
|
||||||
("The maximum raw error tolerated by the Newton"
|
("The maximum raw error tolerated by the Newton"
|
||||||
"method for considering a solution to be converged");
|
"method for considering a solution to be converged");
|
||||||
Parameters::registerParam<TypeTag, Parameters::NewtonMaxError>
|
Parameters::Register<Parameters::NewtonMaxError<Scalar>>
|
||||||
("The maximum error tolerated by the Newton "
|
("The maximum error tolerated by the Newton "
|
||||||
"method to which does not cause an abort");
|
"method to which does not cause an abort");
|
||||||
}
|
}
|
||||||
@ -595,7 +586,7 @@ protected:
|
|||||||
{
|
{
|
||||||
const auto& constraintsMap = model().linearizer().constraintsMap();
|
const auto& constraintsMap = model().linearizer().constraintsMap();
|
||||||
lastError_ = error_;
|
lastError_ = error_;
|
||||||
Scalar newtonMaxError = Parameters::get<TypeTag, Parameters::NewtonMaxError>();
|
Scalar newtonMaxError = Parameters::Get<Parameters::NewtonMaxError<Scalar>>();
|
||||||
|
|
||||||
// calculate the error as the maximum weighted tolerance of
|
// calculate the error as the maximum weighted tolerance of
|
||||||
// the solution's residual
|
// the solution's residual
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
namespace Opm::Parameters {
|
namespace Opm::Parameters {
|
||||||
|
|
||||||
|
//! The maximum error which may occur in a simulation before the
|
||||||
|
//! Newton method for the time step is aborted
|
||||||
|
template<class Scalar>
|
||||||
|
struct NewtonMaxError { static constexpr Scalar value = 1e100; };
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The value for the error below which convergence is declared
|
* \brief The value for the error below which convergence is declared
|
||||||
*
|
*
|
||||||
@ -43,11 +48,6 @@ struct NewtonVerbose { static constexpr bool value = true; };
|
|||||||
//! gets written out to disk for every Newton iteration
|
//! gets written out to disk for every Newton iteration
|
||||||
struct NewtonWriteConvergence { static constexpr bool value = false; };
|
struct NewtonWriteConvergence { static constexpr bool value = false; };
|
||||||
|
|
||||||
//! The maximum error which may occur in a simulation before the
|
|
||||||
//! Newton method for the time step is aborted
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct NewtonMaxError { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The number of iterations at which the Newton method
|
* \brief The number of iterations at which the Newton method
|
||||||
* should aim at.
|
* should aim at.
|
||||||
|
Loading…
Reference in New Issue
Block a user