From 82cd3a2e01f848ad0eb271452dc921850db14eeb Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 28 Jun 2024 12:17:13 +0200 Subject: [PATCH] changed: NewtonMaxIterations parameter moved to Opm::Parameters namespace --- flowexperimental/flowexp.hpp | 13 +++++----- opm/simulators/flow/NonlinearSolver.hpp | 32 +++++++++++++++---------- tests/TestTypeTag.hpp | 13 +++++----- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/flowexperimental/flowexp.hpp b/flowexperimental/flowexp.hpp index 1fa76b148..c64131238 100644 --- a/flowexperimental/flowexp.hpp +++ b/flowexperimental/flowexp.hpp @@ -160,13 +160,6 @@ struct EclNewtonStrictIterations { static constexpr int value = 100; }; -// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit -// relatively often) -template -struct NewtonMaxIterations { - static constexpr int value = 8; -}; - template struct LinearSolverBackend { using type = ISTLSolver; @@ -198,6 +191,12 @@ struct NewtonTolerance static constexpr type value = 1e-1; }; +// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit +// relatively often) +template +struct NewtonMaxIterations +{ static constexpr int value = 8; }; + } // namespace Opm::Parameters namespace Opm::Properties { diff --git a/opm/simulators/flow/NonlinearSolver.hpp b/opm/simulators/flow/NonlinearSolver.hpp index 2b85becfe..5daf6c656 100644 --- a/opm/simulators/flow/NonlinearSolver.hpp +++ b/opm/simulators/flow/NonlinearSolver.hpp @@ -21,18 +21,22 @@ #ifndef OPM_NON_LINEAR_SOLVER_HPP #define OPM_NON_LINEAR_SOLVER_HPP -#include +#include +#include + #include -#include +#include + +#include +#include #include #include #include -#include -#include -#include -#include +#include +#include + #include namespace Opm::Properties { @@ -64,10 +68,6 @@ struct NewtonMaxRelax { static constexpr type value = 0.5; }; template -struct NewtonMaxIterations { - static constexpr int value = 20; -}; -template struct NewtonMinIterations { static constexpr int value = 2; }; @@ -78,6 +78,14 @@ struct NewtonRelaxationType { } // namespace Opm::Properties +namespace Opm::Parameters { + +template +struct NewtonMaxIterations +{ static constexpr int value = 20; }; + +} // namespace Opm::Parameters + namespace Opm { // Available relaxation scheme types. @@ -128,7 +136,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld, // overload with given parameters relaxMax_ = Parameters::get(); - maxIter_ = Parameters::get(); + maxIter_ = Parameters::get(); minIter_ = Parameters::get(); const auto& relaxationTypeString = Parameters::get(); @@ -146,7 +154,7 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld, { Parameters::registerParam ("The maximum relaxation factor of a Newton iteration"); - Parameters::registerParam + Parameters::registerParam ("The maximum number of Newton iterations per time step"); Parameters::registerParam ("The minimum number of Newton iterations per time step"); diff --git a/tests/TestTypeTag.hpp b/tests/TestTypeTag.hpp index 3c3868685..1499979ea 100644 --- a/tests/TestTypeTag.hpp +++ b/tests/TestTypeTag.hpp @@ -112,13 +112,6 @@ struct LinearSolverBackend { using type = ISTLSolver; }; -// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit -// relatively often) -template -struct NewtonMaxIterations { - static constexpr int value = 8; -}; - } // namespace Opm::Properties namespace Opm::Parameters { @@ -145,6 +138,12 @@ struct NewtonTolerance static constexpr type value = 1e-1; }; +// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit +// relatively often) +template +struct NewtonMaxIterations +{ static constexpr int value = 8; }; + } // namespace Opm::Parameters #endif // OPM_TEST_TYPETAG_HPP