From b23f0289e381d7148c1a23a392b025bd9ac62f7c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 1 Jul 2024 14:13:14 +0200 Subject: [PATCH] changed: move the LinearSolverMaxError parameter to Opm::Parameters --- opm/simulators/linalg/linalgparameters.hh | 3 ++ opm/simulators/linalg/linalgproperties.hh | 3 -- opm/simulators/linalg/parallelamgbackend.hh | 39 ++++++++++++------- .../linalg/parallelbicgstabbackend.hh | 27 ++++++++----- 4 files changed, 45 insertions(+), 27 deletions(-) diff --git a/opm/simulators/linalg/linalgparameters.hh b/opm/simulators/linalg/linalgparameters.hh index 13688f472..389e0d6c5 100644 --- a/opm/simulators/linalg/linalgparameters.hh +++ b/opm/simulators/linalg/linalgparameters.hh @@ -39,6 +39,9 @@ namespace Opm::Parameters { template struct LinearSolverAbsTolerance { using type = Properties::UndefinedProperty; }; +template +struct LinearSolverMaxError { using type = Properties::UndefinedProperty; }; + //! Maximum number of iterations eyecuted by the linear solver template struct LinearSolverMaxIterations { using type = Properties::UndefinedProperty; }; diff --git a/opm/simulators/linalg/linalgproperties.hh b/opm/simulators/linalg/linalgproperties.hh index 780f01342..3e27f56cd 100644 --- a/opm/simulators/linalg/linalgproperties.hh +++ b/opm/simulators/linalg/linalgproperties.hh @@ -64,9 +64,6 @@ struct GlobalEqVector { using type = UndefinedProperty; }; template struct AmgCoarsenTarget { using type = UndefinedProperty; }; -template -struct LinearSolverMaxError { using type = UndefinedProperty; }; - template struct LinearSolverWrapper { using type = UndefinedProperty; }; diff --git a/opm/simulators/linalg/parallelamgbackend.hh b/opm/simulators/linalg/parallelamgbackend.hh index d543b6169..b56834f5f 100644 --- a/opm/simulators/linalg/parallelamgbackend.hh +++ b/opm/simulators/linalg/parallelamgbackend.hh @@ -43,28 +43,27 @@ #include namespace Opm::Linear { + template class ParallelAmgBackend; + } // namespace Opm::Linear namespace Opm::Properties { // Create new type tags namespace TTag { -struct ParallelAmgLinearSolver { using InheritsFrom = std::tuple; }; + +struct ParallelAmgLinearSolver +{ using InheritsFrom = std::tuple; }; + } // end namespace TTag //! The target number of DOFs per processor for the parallel algebraic //! multi-grid solver template -struct AmgCoarsenTarget { static constexpr int value = 5000; }; - -template -struct LinearSolverMaxError -{ - using type = GetPropType; - static constexpr type value = 1e7; -}; +struct AmgCoarsenTarget +{ static constexpr int value = 5000; }; template struct LinearSolverBackend @@ -72,8 +71,19 @@ struct LinearSolverBackend } // namespace Opm::Properties -namespace Opm { -namespace Linear { +namespace Opm::Parameters { + +template +struct LinearSolverMaxError +{ + using type = GetPropType; + static constexpr type value = 1e7; +}; + +} + +namespace Opm::Linear { + /*! * \ingroup Linear * @@ -150,7 +160,7 @@ public: { ParentType::registerParameters(); - Parameters::registerParam + Parameters::registerParam ("The maximum residual error which the linear solver tolerates " "without giving up"); Parameters::registerParam @@ -201,7 +211,7 @@ protected: convCrit_.reset(new CCC(gridView.comm(), /*residualReductionTolerance=*/linearSolverTolerance, /*absoluteResidualTolerance=*/linearSolverAbsTolerance, - Parameters::get())); + Parameters::get())); auto bicgstabSolver = std::make_shared(parPreCond, *convCrit_, parScalarProduct); @@ -323,7 +333,6 @@ protected: #endif }; -} // namespace Linear -} // namespace Opm +} // namespace Opm::Linear #endif diff --git a/opm/simulators/linalg/parallelbicgstabbackend.hh b/opm/simulators/linalg/parallelbicgstabbackend.hh index f03ed609c..b0747dc74 100644 --- a/opm/simulators/linalg/parallelbicgstabbackend.hh +++ b/opm/simulators/linalg/parallelbicgstabbackend.hh @@ -37,32 +37,41 @@ #include namespace Opm::Linear { + template class ParallelBiCGStabSolverBackend; + } // namespace Opm::Linear namespace Opm::Properties { // Create new type tags namespace TTag { -struct ParallelBiCGStabLinearSolver { using InheritsFrom = std::tuple; }; + +struct ParallelBiCGStabLinearSolver +{ using InheritsFrom = std::tuple; }; + } // end namespace TTag template struct LinearSolverBackend { using type = Opm::Linear::ParallelBiCGStabSolverBackend; }; +} // namespace Opm::Properties + +namespace Opm::Parameters { + template -struct LinearSolverMaxError +struct LinearSolverMaxError { - using type = GetPropType; + using type = GetPropType; static constexpr type value = 1e7; }; -} // namespace Opm::Properties +} + +namespace Opm::Linear { -namespace Opm { -namespace Linear { /*! * \ingroup Linear * @@ -122,7 +131,7 @@ public: { ParentType::registerParameters(); - Parameters::registerParam + Parameters::registerParam ("The maximum residual error which the linear solver tolerates" " without giving up"); } @@ -145,7 +154,7 @@ protected: convCrit_.reset(new CCC(gridView.comm(), /*residualReductionTolerance=*/linearSolverTolerance, /*absoluteResidualTolerance=*/linearSolverAbsTolerance, - Parameters::get())); + Parameters::get())); auto bicgstabSolver = std::make_shared(parPreCond, *convCrit_, parScalarProduct); @@ -173,6 +182,6 @@ protected: std::unique_ptr > convCrit_; }; -}} // namespace Linear, Opm +} // namespace Opm::Linear #endif