mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move NewtonTargetIterations to TypeTag-free parameter system
This commit is contained in:
parent
8285d999e8
commit
930e6c8adf
@ -190,13 +190,6 @@ struct LinearSolverTolerance<TypeTag, Properties::TTag::CO2PTBaseProblem>
|
||||
static constexpr type value = 1e-3;
|
||||
};
|
||||
|
||||
template <class TypeTag>
|
||||
struct NewtonTargetIterations<TypeTag, Properties::TTag::CO2PTBaseProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 6;
|
||||
};
|
||||
|
||||
template <class TypeTag>
|
||||
struct NewtonMaxIterations<TypeTag, Properties::TTag::CO2PTBaseProblem>
|
||||
{ static constexpr int value = 30; };
|
||||
@ -374,6 +367,7 @@ public:
|
||||
Parameters::SetDefault<Parameters::EndTime<Scalar>>(60. * 60.);
|
||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(0.1 * 60. * 60.);
|
||||
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-3);
|
||||
Parameters::SetDefault<Parameters::NewtonTargetIterations>(6);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -108,12 +108,6 @@ template<class TypeTag>
|
||||
struct EnableGravity<TypeTag, Properties::TTag::RichardsLensProblem>
|
||||
{ static constexpr bool value = true; };
|
||||
|
||||
// Set the "desireable" number of newton iterations of a time step
|
||||
template<class TypeTag>
|
||||
struct NewtonTargetIterations<TypeTag, Properties::TTag::RichardsLensProblem>
|
||||
{ static constexpr int value = 18; };
|
||||
|
||||
// Set the maximum number of newton iterations of a time step
|
||||
template<class TypeTag>
|
||||
struct NewtonMaxIterations<TypeTag, Properties::TTag::RichardsLensProblem>
|
||||
{ static constexpr int value = 28; };
|
||||
@ -254,6 +248,7 @@ public:
|
||||
|
||||
Parameters::SetDefault<Parameters::EndTime<Scalar>>(3000.0);
|
||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100.0);
|
||||
Parameters::SetDefault<Parameters::NewtonTargetIterations>(18);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -81,10 +81,6 @@ struct NewtonConvergenceWriter<TypeTag, TTag::NewtonMethod> { using type = NullC
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
template<class TypeTag>
|
||||
struct NewtonTargetIterations<TypeTag, Properties::TTag::NewtonMethod>
|
||||
{ static constexpr int value = 10; };
|
||||
|
||||
template<class TypeTag>
|
||||
struct NewtonMaxIterations<TypeTag, Properties::TTag::NewtonMethod>
|
||||
{ static constexpr int value = 20; };
|
||||
@ -148,7 +144,7 @@ public:
|
||||
Parameters::Register<Parameters::NewtonWriteConvergence>
|
||||
("Write the convergence behaviour of the Newton "
|
||||
"method to a VTK file");
|
||||
Parameters::registerParam<TypeTag, Parameters::NewtonTargetIterations>
|
||||
Parameters::Register<Parameters::NewtonTargetIterations>
|
||||
("The 'optimum' number of Newton iterations per time step");
|
||||
Parameters::registerParam<TypeTag, Parameters::NewtonMaxIterations>
|
||||
("The maximum number of Newton iterations per time step");
|
||||
@ -846,7 +842,7 @@ protected:
|
||||
|
||||
// optimal number of iterations we want to achieve
|
||||
int targetIterations_() const
|
||||
{ return Parameters::get<TypeTag, Parameters::NewtonTargetIterations>(); }
|
||||
{ return Parameters::Get<Parameters::NewtonTargetIterations>(); }
|
||||
// maximum number of iterations we do before giving up
|
||||
int maxIterations_() const
|
||||
{ return Parameters::get<TypeTag, Parameters::NewtonMaxIterations>(); }
|
||||
|
@ -32,6 +32,16 @@ namespace Opm::Parameters {
|
||||
template<class Scalar>
|
||||
struct NewtonMaxError { static constexpr Scalar value = 1e100; };
|
||||
|
||||
/*!
|
||||
* \brief The number of iterations at which the Newton method
|
||||
* should aim at.
|
||||
*
|
||||
* This is used to control the time-step size. The heuristic used
|
||||
* is to scale the last time-step size by the deviation of the
|
||||
* number of iterations used from the target steps.
|
||||
*/
|
||||
struct NewtonTargetIterations { static constexpr int value = 10; };
|
||||
|
||||
/*!
|
||||
* \brief The value for the error below which convergence is declared
|
||||
*
|
||||
@ -48,17 +58,6 @@ struct NewtonVerbose { static constexpr bool value = true; };
|
||||
//! gets written out to disk for every Newton iteration
|
||||
struct NewtonWriteConvergence { static constexpr bool value = false; };
|
||||
|
||||
/*!
|
||||
* \brief The number of iterations at which the Newton method
|
||||
* should aim at.
|
||||
*
|
||||
* This is used to control the time-step size. The heuristic used
|
||||
* is to scale the last time-step size by the deviation of the
|
||||
* number of iterations used from the target steps.
|
||||
*/
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct NewtonTargetIterations { using type = Properties::UndefinedProperty; };
|
||||
|
||||
//! Number of maximum iterations for the Newton method.
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct NewtonMaxIterations { using type = Properties::UndefinedProperty; };
|
||||
|
Loading…
Reference in New Issue
Block a user