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

View File

@ -76,6 +76,10 @@ struct LinearSolverVerbosity { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
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
#endif

View File

@ -45,10 +45,6 @@ struct PreconditionerWrapper { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
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
template<class TypeTag, class MyTypeTag>
struct GMResRestart { using type = UndefinedProperty; };

View File

@ -27,7 +27,6 @@
#ifndef 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/version.hh>
@ -41,6 +40,7 @@
#include <opm/simulators/linalg/istlpreconditionerwrappers.hh>
#include <opm/simulators/linalg/istlsparsematrixadapter.hh>
#include <opm/simulators/linalg/linalgparameters.hh>
#include <opm/simulators/linalg/linalgproperties.hh>
#include <opm/simulators/linalg/matrixblock.hh>
#include <opm/simulators/linalg/overlappingbcrsmatrix.hh>
@ -388,14 +388,6 @@ protected:
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
//! the linear solve
template<class TypeTag>
@ -474,6 +466,14 @@ template<class TypeTag>
struct PreconditionerOrder<TypeTag, Properties::TTag::ParallelBaseLinearSolver>
{ 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
#endif