From e28284b68a1cfe5257c0ba369ced072b6404f8c2 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 1 Jul 2024 10:20:05 +0200 Subject: [PATCH] changed: move the NewtonMaxIterations parameter to Opm::Parameters --- examples/problems/co2ptflashproblem.hh | 9 ++++----- examples/problems/richardslensproblem.hh | 9 +++++---- opm/models/nonlinear/newtonmethod.hh | 14 ++++++++------ opm/models/nonlinear/newtonmethodparameters.hh | 4 ++++ opm/models/nonlinear/newtonmethodproperties.hh | 4 ---- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/examples/problems/co2ptflashproblem.hh b/examples/problems/co2ptflashproblem.hh index a1c17e872..5c271f26a 100644 --- a/examples/problems/co2ptflashproblem.hh +++ b/examples/problems/co2ptflashproblem.hh @@ -189,11 +189,6 @@ struct LinearSolverAbsTolerance { static constexpr type value = 0.; }; -template -struct NewtonMaxIterations { - static constexpr int value = 30; -}; - // output template struct VtkWriteFilterVelocities { @@ -301,6 +296,10 @@ struct NewtonTargetIterations static constexpr type value = 6; }; +template +struct NewtonMaxIterations +{ static constexpr int value = 30; }; + } // namespace Opm::Parameters namespace Opm { diff --git a/examples/problems/richardslensproblem.hh b/examples/problems/richardslensproblem.hh index 2942016c8..638496a47 100644 --- a/examples/problems/richardslensproblem.hh +++ b/examples/problems/richardslensproblem.hh @@ -107,10 +107,6 @@ struct EnableGravity { static constexpr bool template struct NumericDifferenceMethod { static constexpr int value = 0; }; -// Set the maximum number of newton iterations of a time step -template -struct NewtonMaxIterations { static constexpr int value = 28; }; - // The default for the end time of the simulation template struct EndTime @@ -145,6 +141,11 @@ template struct NewtonTargetIterations { static constexpr int value = 18; }; +// Set the maximum number of newton iterations of a time step +template +struct NewtonMaxIterations +{ static constexpr int value = 28; }; + } // namespace Opm::Parameters namespace Opm { diff --git a/opm/models/nonlinear/newtonmethod.hh b/opm/models/nonlinear/newtonmethod.hh index 855fbd481..206294821 100644 --- a/opm/models/nonlinear/newtonmethod.hh +++ b/opm/models/nonlinear/newtonmethod.hh @@ -76,10 +76,6 @@ template struct NewtonMethod { using type = ::Opm::NewtonMethod; }; template struct NewtonConvergenceWriter { using type = NullConvergenceWriter; }; -// set the abortion tolerace to some very large value. if not -// overwritten at run-time this basically disables abortions -template -struct NewtonMaxIterations { static constexpr int value = 20; }; } // namespace Opm::Properties @@ -100,6 +96,8 @@ struct NewtonTolerance 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 struct NewtonMaxError { @@ -111,6 +109,10 @@ template struct NewtonTargetIterations { static constexpr int value = 10; }; +template +struct NewtonMaxIterations +{ static constexpr int value = 20; }; + } // namespace Opm::Parameters namespace Opm { @@ -172,7 +174,7 @@ public: "method to a VTK file"); Parameters::registerParam ("The 'optimum' number of Newton iterations per time step"); - Parameters::registerParam + Parameters::registerParam ("The maximum number of Newton iterations per time step"); Parameters::registerParam ("The maximum raw error tolerated by the Newton" @@ -869,7 +871,7 @@ protected: { return Parameters::get(); } // maximum number of iterations we do before giving up int maxIterations_() const - { return Parameters::get(); } + { return Parameters::get(); } static bool enableConstraints_() { return getPropValue(); } diff --git a/opm/models/nonlinear/newtonmethodparameters.hh b/opm/models/nonlinear/newtonmethodparameters.hh index e73273370..1019636ee 100644 --- a/opm/models/nonlinear/newtonmethodparameters.hh +++ b/opm/models/nonlinear/newtonmethodparameters.hh @@ -61,6 +61,10 @@ struct NewtonMaxError { using type = Properties::UndefinedProperty; }; template struct NewtonTargetIterations { using type = Properties::UndefinedProperty; }; +//! Number of maximum iterations for the Newton method. +template +struct NewtonMaxIterations { using type = Properties::UndefinedProperty; }; + } // end namespace Opm::Parameters #endif diff --git a/opm/models/nonlinear/newtonmethodproperties.hh b/opm/models/nonlinear/newtonmethodproperties.hh index 07adeb3dc..2bd213cc7 100644 --- a/opm/models/nonlinear/newtonmethodproperties.hh +++ b/opm/models/nonlinear/newtonmethodproperties.hh @@ -44,10 +44,6 @@ struct NewtonConvergenceWriter { using type = UndefinedProperty; }; template struct ConvergenceWriter { using type = UndefinedProperty; }; -//! Number of maximum iterations for the Newton method. -template -struct NewtonMaxIterations { using type = UndefinedProperty; }; - } // end namespace Opm::Properties #endif