changed: move the PreconditionerOrder parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-07-01 14:13:14 +02:00
parent 0e06d6491b
commit 5cab2e668a
5 changed files with 19 additions and 22 deletions

View File

@ -127,8 +127,6 @@ struct LinearSolverWrapper<TypeTag, TTag::WaterAirBaseProblem>
template<class TypeTag>
struct PreconditionerWrapper<TypeTag, TTag::WaterAirBaseProblem>
{ using type = Opm::Linear::PreconditionerWrapperILU<TypeTag>; };
template<class TypeTag>
struct PreconditionerOrder<TypeTag, TTag::WaterAirBaseProblem> { static constexpr int value = 2; };
} // namespace Opm::Properties
@ -165,11 +163,6 @@ template<class TypeTag>
struct NewtonWriteConvergence<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr bool value = false; };
// Use forward differences instead of central differences
template<class TypeTag>
struct NumericDifferenceMethod<TypeTag, Properties::TTag::WaterAirBaseProblem>
{ static constexpr int value = +1; };
} // namespace Opm::Parameters
namespace Opm {

View File

@ -44,13 +44,16 @@
#ifndef EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
#define EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
#include <dune/common/version.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/parametersystem.hh>
#include <opm/simulators/linalg/linalgproperties.hh>
#include <opm/simulators/linalg/ilufirstelement.hh> //definitions needed in next header
#include <dune/istl/preconditioners.hh>
#include <dune/common/version.hh>
#include <opm/simulators/linalg/linalgparameters.hh>
#include <opm/simulators/linalg/linalgproperties.hh>
#include <opm/simulators/linalg/ilufirstelement.hh> // definitions needed in next header
#include <dune/istl/preconditioners.hh>
namespace Opm {
namespace Linear {
@ -72,7 +75,7 @@ namespace Linear {
\
static void registerParameters() \
{ \
Parameters::registerParam<TypeTag, Properties::PreconditionerOrder> \
Parameters::registerParam<TypeTag, Parameters::PreconditionerOrder> \
("The order of the preconditioner"); \
Parameters::registerParam<TypeTag, Properties::PreconditionerRelaxation> \
("The relaxation factor of the preconditioner"); \
@ -80,7 +83,7 @@ namespace Linear {
\
void prepare(IstlMatrix& matrix) \
{ \
int order = Parameters::get<TypeTag, Properties::PreconditionerOrder>(); \
int order = Parameters::get<TypeTag, Parameters::PreconditionerOrder>(); \
Scalar relaxationFactor = Parameters::get<TypeTag, Properties::PreconditionerRelaxation>(); \
seqPreCond_ = new SequentialPreconditioner(matrix, order, \
relaxationFactor); \
@ -152,7 +155,7 @@ class PreconditionerWrapperILU
using OverlappingMatrix = GetPropType<TypeTag, Properties::OverlappingMatrix>;
using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>;
static constexpr int order = getPropValue<TypeTag, Properties::PreconditionerOrder>();
static constexpr int order = getPropValue<TypeTag, Parameters::PreconditionerOrder>();
public:
using SequentialPreconditioner = Dune::SeqILU<OverlappingMatrix, OverlappingVector, OverlappingVector, order>;

View File

@ -69,6 +69,10 @@ struct LinearSolverTolerance { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LinearSolverVerbosity { using type = Properties::UndefinedProperty; };
//! The order of the sequential preconditioner
template<class TypeTag, class MyTypeTag>
struct PreconditionerOrder { 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 order of the sequential preconditioner
template<class TypeTag, class MyTypeTag>
struct PreconditionerOrder { using type = UndefinedProperty; };
//! The relaxation factor of the preconditioner
template<class TypeTag, class MyTypeTag>
struct PreconditionerRelaxation { using type = UndefinedProperty; };

View File

@ -396,10 +396,6 @@ struct PreconditionerRelaxation<TypeTag, TTag::ParallelBaseLinearSolver>
static constexpr type value = 1.0;
};
//! set the preconditioner order to 0 by default
template<class TypeTag>
struct PreconditionerOrder<TypeTag, TTag::ParallelBaseLinearSolver> { static constexpr int value = 0; };
//! by default use the same kind of floating point values for the linearization and for
//! the linear solve
template<class TypeTag>
@ -473,6 +469,11 @@ template<class TypeTag>
struct LinearSolverVerbosity<TypeTag, Properties::TTag::ParallelBaseLinearSolver>
{ static constexpr int value = 0; };
//! set the preconditioner order to 0 by default
template<class TypeTag>
struct PreconditionerOrder<TypeTag, Properties::TTag::ParallelBaseLinearSolver>
{ static constexpr int value = 0; };
} // namespace Opm::Parameters
#endif