changed: move the NewtonTargetIterations parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-07-01 10:20:05 +02:00
parent 526aac8865
commit 7a4a91c3bf
5 changed files with 29 additions and 25 deletions

View File

@ -194,12 +194,6 @@ struct NewtonMaxIterations<TypeTag, TTag::CO2PTBaseProblem> {
static constexpr int value = 30;
};
template <class TypeTag>
struct NewtonTargetIterations<TypeTag, TTag::CO2PTBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 6;
};
// output
template <class TypeTag>
struct VtkWriteFilterVelocities<TypeTag, TTag::CO2PTBaseProblem> {
@ -300,6 +294,13 @@ struct NewtonTolerance<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;
};
} // namespace Opm::Parameters
namespace Opm {

View File

@ -111,10 +111,6 @@ struct NumericDifferenceMethod<TypeTag, TTag::RichardsLensProblem> { static cons
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, TTag::RichardsLensProblem> { static constexpr int value = 28; };
// Set the "desireable" number of newton iterations of a time step
template<class TypeTag>
struct NewtonTargetIterations<TypeTag, TTag::RichardsLensProblem> { static constexpr int value = 18; };
// The default for the end time of the simulation
template<class TypeTag>
struct EndTime<TypeTag, TTag::RichardsLensProblem>
@ -144,6 +140,11 @@ template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::RichardsLensProblem>
{ static constexpr bool value = false; };
// 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; };
} // namespace Opm::Parameters
namespace Opm {

View File

@ -79,8 +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 NewtonTargetIterations<TypeTag, TTag::NewtonMethod> { static constexpr int value = 10; };
template<class TypeTag>
struct NewtonMaxIterations<TypeTag, TTag::NewtonMethod> { static constexpr int value = 20; };
} // namespace Opm::Properties
@ -109,6 +107,10 @@ struct NewtonMaxError<TypeTag, Properties::TTag::NewtonMethod>
static constexpr type value = 1e100;
};
template<class TypeTag>
struct NewtonTargetIterations<TypeTag, Properties::TTag::NewtonMethod>
{ static constexpr int value = 10; };
} // namespace Opm::Parameters
namespace Opm {
@ -168,7 +170,7 @@ public:
Parameters::registerParam<TypeTag, Parameters::NewtonWriteConvergence>
("Write the convergence behaviour of the Newton "
"method to a VTK file");
Parameters::registerParam<TypeTag, Properties::NewtonTargetIterations>
Parameters::registerParam<TypeTag, Parameters::NewtonTargetIterations>
("The 'optimum' number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Properties::NewtonMaxIterations>
("The maximum number of Newton iterations per time step");
@ -864,7 +866,7 @@ protected:
// optimal number of iterations we want to achieve
int targetIterations_() const
{ return Parameters::get<TypeTag, Properties::NewtonTargetIterations>(); }
{ return Parameters::get<TypeTag, Parameters::NewtonTargetIterations>(); }
// maximum number of iterations we do before giving up
int maxIterations_() const
{ return Parameters::get<TypeTag, Properties::NewtonMaxIterations>(); }

View File

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

View File

@ -44,17 +44,6 @@ struct NewtonConvergenceWriter { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ConvergenceWriter { using type = UndefinedProperty; };
/*!
* \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 = UndefinedProperty; };
//! Number of maximum iterations for the Newton method.
template<class TypeTag, class MyTypeTag>
struct NewtonMaxIterations { using type = UndefinedProperty; };