move NewtonTolerance to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving
2024-07-05 17:49:51 +02:00
parent 6d649be5db
commit 73344cfb60
9 changed files with 31 additions and 85 deletions

View File

@@ -81,13 +81,6 @@ struct NewtonConvergenceWriter<TypeTag, TTag::NewtonMethod> { using type = NullC
namespace Opm::Parameters {
template<class TypeTag>
struct NewtonTolerance<TypeTag, Properties::TTag::NewtonMethod>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-8;
};
// set the abortion tolerance to some very large value. if not
// overwritten at run-time this basically disables abortions
template<class TypeTag>
@@ -146,7 +139,7 @@ public:
{
lastError_ = 1e100;
error_ = 1e100;
tolerance_ = Parameters::get<TypeTag, Parameters::NewtonTolerance>();
tolerance_ = Parameters::Get<Parameters::NewtonTolerance<Scalar>>();
numIterations_ = 0;
}
@@ -168,7 +161,7 @@ public:
("The 'optimum' number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Parameters::NewtonMaxIterations>
("The maximum number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Parameters::NewtonTolerance>
Parameters::Register<Parameters::NewtonTolerance<Scalar>>
("The maximum raw error tolerated by the Newton"
"method for considering a solution to be converged");
Parameters::registerParam<TypeTag, Parameters::NewtonMaxError>

View File

@@ -27,21 +27,21 @@
namespace Opm::Parameters {
//! Specifies whether the Newton method should print messages or not
struct NewtonVerbose { static constexpr bool value = true; };
//! Specifies whether the convergence rate and the global residual
//! gets written out to disk for every Newton iteration
struct NewtonWriteConvergence { static constexpr bool value = false; };
/*!
* \brief The value for the error below which convergence is declared
*
* This value can (and for the porous media models will) be changed to account for grid
* scaling and other effects.
*/
template<class TypeTag, class MyTypeTag>
struct NewtonTolerance { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct NewtonTolerance { static constexpr Scalar value = 1e-8; };
//! Specifies whether the Newton method should print messages or not
struct NewtonVerbose { static constexpr bool value = true; };
//! Specifies whether the convergence rate and the global residual
//! gets written out to disk for every Newton iteration
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