changed: move the NewtonMaxError parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-07-01 10:20:05 +02:00
parent 2a133b615e
commit 526aac8865
4 changed files with 16 additions and 15 deletions

View File

@ -117,10 +117,10 @@ protected:
// make sure that the error never grows beyond the maximum
// allowed one
if (this->error_ > Parameters::get<TypeTag, Properties::NewtonMaxError>())
if (this->error_ > Parameters::get<TypeTag, Parameters::NewtonMaxError>())
throw Opm::NumericalProblem("Newton: Error "+std::to_string(double(this->error_))+
+ " is larger than maximum allowed error of "
+ std::to_string(Parameters::get<TypeTag, Properties::NewtonMaxError>()));
+ std::to_string(Parameters::get<TypeTag, Parameters::NewtonMaxError>()));
}
/*!

View File

@ -79,12 +79,6 @@ struct NewtonConvergenceWriter<TypeTag, TTag::NewtonMethod> { using type = NullC
// set the abortion tolerace to some very large value. if not
// overwritten at run-time this basically disables abortions
template<class TypeTag>
struct NewtonMaxError<TypeTag, TTag::NewtonMethod>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e100;
};
template<class TypeTag>
struct NewtonTargetIterations<TypeTag, TTag::NewtonMethod> { static constexpr int value = 10; };
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, TTag::NewtonMethod> { static constexpr int value = 20; };
@ -108,6 +102,13 @@ struct NewtonTolerance<TypeTag, Properties::TTag::NewtonMethod>
static constexpr type value = 1e-8;
};
template<class TypeTag>
struct NewtonMaxError<TypeTag, Properties::TTag::NewtonMethod>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e100;
};
} // namespace Opm::Parameters
namespace Opm {
@ -174,7 +175,7 @@ public:
Parameters::registerParam<TypeTag, Parameters::NewtonTolerance>
("The maximum raw error tolerated by the Newton"
"method for considering a solution to be converged");
Parameters::registerParam<TypeTag, Properties::NewtonMaxError>
Parameters::registerParam<TypeTag, Parameters::NewtonMaxError>
("The maximum error tolerated by the Newton "
"method to which does not cause an abort");
}
@ -604,7 +605,7 @@ protected:
{
const auto& constraintsMap = model().linearizer().constraintsMap();
lastError_ = error_;
Scalar newtonMaxError = Parameters::get<TypeTag, Properties::NewtonMaxError>();
Scalar newtonMaxError = Parameters::get<TypeTag, Parameters::NewtonMaxError>();
// calculate the error as the maximum weighted tolerance of
// the solution's residual

View File

@ -45,6 +45,11 @@ struct NewtonWriteConvergence { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct NewtonTolerance { using type = Properties::UndefinedProperty; };
//! 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; };
} // end namespace Opm::Parameters
#endif

View File

@ -44,11 +44,6 @@ struct NewtonConvergenceWriter { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ConvergenceWriter { using type = UndefinedProperty; };
//! 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 = UndefinedProperty; };
/*!
* \brief The number of iterations at which the Newton method
* should aim at.