changed: move the PreconditionerRelaxation parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-07-01 14:13:14 +02:00
parent b23f0289e3
commit b5470dc3eb
4 changed files with 19 additions and 19 deletions

View File

@ -77,14 +77,14 @@ namespace Linear {
{ \ { \
Parameters::registerParam<TypeTag, Parameters::PreconditionerOrder> \ Parameters::registerParam<TypeTag, Parameters::PreconditionerOrder> \
("The order of the preconditioner"); \ ("The order of the preconditioner"); \
Parameters::registerParam<TypeTag, Properties::PreconditionerRelaxation> \ Parameters::registerParam<TypeTag, Parameters::PreconditionerRelaxation> \
("The relaxation factor of the preconditioner"); \ ("The relaxation factor of the preconditioner"); \
} \ } \
\ \
void prepare(IstlMatrix& matrix) \ void prepare(IstlMatrix& matrix) \
{ \ { \
int order = Parameters::get<TypeTag, Parameters::PreconditionerOrder>(); \ int order = Parameters::get<TypeTag, Parameters::PreconditionerOrder>(); \
Scalar relaxationFactor = Parameters::get<TypeTag, Properties::PreconditionerRelaxation>(); \ Scalar relaxationFactor = Parameters::get<TypeTag, Parameters::PreconditionerRelaxation>(); \
seqPreCond_ = new SequentialPreconditioner(matrix, order, \ seqPreCond_ = new SequentialPreconditioner(matrix, order, \
relaxationFactor); \ relaxationFactor); \
} \ } \
@ -118,14 +118,14 @@ namespace Linear {
\ \
static void registerParameters() \ static void registerParameters() \
{ \ { \
Parameters::registerParam<TypeTag, Properties::PreconditionerRelaxation> \ Parameters::registerParam<TypeTag, Parameters::PreconditionerRelaxation> \
("The relaxation factor of the preconditioner"); \ ("The relaxation factor of the preconditioner"); \
} \ } \
\ \
void prepare(OverlappingMatrix& matrix) \ void prepare(OverlappingMatrix& matrix) \
{ \ { \
Scalar relaxationFactor = \ Scalar relaxationFactor = \
Parameters::get<TypeTag, Properties::PreconditionerRelaxation>(); \ Parameters::get<TypeTag, Parameters::PreconditionerRelaxation>(); \
seqPreCond_ = new SequentialPreconditioner(matrix, \ seqPreCond_ = new SequentialPreconditioner(matrix, \
relaxationFactor); \ relaxationFactor); \
} \ } \
@ -165,13 +165,13 @@ public:
static void registerParameters() static void registerParameters()
{ {
Parameters::registerParam<TypeTag, Properties::PreconditionerRelaxation> Parameters::registerParam<TypeTag, Parameters::PreconditionerRelaxation>
("The relaxation factor of the preconditioner"); ("The relaxation factor of the preconditioner");
} }
void prepare(OverlappingMatrix& matrix) void prepare(OverlappingMatrix& matrix)
{ {
Scalar relaxationFactor = Parameters::get<TypeTag, Properties::PreconditionerRelaxation>(); Scalar relaxationFactor = Parameters::get<TypeTag, Parameters::PreconditionerRelaxation>();
// create the sequential preconditioner. // create the sequential preconditioner.
seqPreCond_ = new SequentialPreconditioner(matrix, relaxationFactor); seqPreCond_ = new SequentialPreconditioner(matrix, relaxationFactor);

View File

@ -76,6 +76,10 @@ struct LinearSolverVerbosity { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct PreconditionerOrder { using type = Properties::UndefinedProperty; }; struct PreconditionerOrder { using type = Properties::UndefinedProperty; };
//! The relaxation factor of the preconditioner
template<class TypeTag, class MyTypeTag>
struct PreconditionerRelaxation { using type = Properties::UndefinedProperty; };
} // namespace Opm::Parameters } // namespace Opm::Parameters
#endif #endif

View File

@ -45,10 +45,6 @@ struct PreconditionerWrapper { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct LinearSolverScalar { using type = UndefinedProperty; }; struct LinearSolverScalar { using type = UndefinedProperty; };
//! The relaxation factor of the preconditioner
template<class TypeTag, class MyTypeTag>
struct PreconditionerRelaxation { using type = UndefinedProperty; };
//! number of iterations between solver restarts for the GMRES solver //! number of iterations between solver restarts for the GMRES solver
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct GMResRestart { using type = UndefinedProperty; }; struct GMResRestart { using type = UndefinedProperty; };

View File

@ -27,7 +27,6 @@
#ifndef EWOMS_PARALLEL_BASE_BACKEND_HH #ifndef EWOMS_PARALLEL_BASE_BACKEND_HH
#define EWOMS_PARALLEL_BASE_BACKEND_HH #define EWOMS_PARALLEL_BASE_BACKEND_HH
#include "opm/simulators/linalg/linalgparameters.hh"
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <dune/common/version.hh> #include <dune/common/version.hh>
@ -41,6 +40,7 @@
#include <opm/simulators/linalg/istlpreconditionerwrappers.hh> #include <opm/simulators/linalg/istlpreconditionerwrappers.hh>
#include <opm/simulators/linalg/istlsparsematrixadapter.hh> #include <opm/simulators/linalg/istlsparsematrixadapter.hh>
#include <opm/simulators/linalg/linalgparameters.hh>
#include <opm/simulators/linalg/linalgproperties.hh> #include <opm/simulators/linalg/linalgproperties.hh>
#include <opm/simulators/linalg/matrixblock.hh> #include <opm/simulators/linalg/matrixblock.hh>
#include <opm/simulators/linalg/overlappingbcrsmatrix.hh> #include <opm/simulators/linalg/overlappingbcrsmatrix.hh>
@ -388,14 +388,6 @@ protected:
namespace Opm::Properties { namespace Opm::Properties {
//! set the preconditioner relaxation parameter to 1.0 by default
template<class TypeTag>
struct PreconditionerRelaxation<TypeTag, TTag::ParallelBaseLinearSolver>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1.0;
};
//! by default use the same kind of floating point values for the linearization and for //! by default use the same kind of floating point values for the linearization and for
//! the linear solve //! the linear solve
template<class TypeTag> template<class TypeTag>
@ -474,6 +466,14 @@ template<class TypeTag>
struct PreconditionerOrder<TypeTag, Properties::TTag::ParallelBaseLinearSolver> struct PreconditionerOrder<TypeTag, Properties::TTag::ParallelBaseLinearSolver>
{ static constexpr int value = 0; }; { static constexpr int value = 0; };
//! set the preconditioner relaxation parameter to 1.0 by default
template<class TypeTag>
struct PreconditionerRelaxation<TypeTag, Properties::TTag::ParallelBaseLinearSolver>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
} // namespace Opm::Parameters } // namespace Opm::Parameters
#endif #endif