changed: LinearSolverVerbosity parameter moved to Opm::Parameters namespace

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:17:13 +02:00
parent f251370a52
commit 22a116728c

View File

@ -26,215 +26,203 @@
#include <opm/simulators/linalg/MILU.hpp> #include <opm/simulators/linalg/MILU.hpp>
#include <opm/simulators/linalg/linalgparameters.hh>
#include <opm/simulators/linalg/linalgproperties.hh> #include <opm/simulators/linalg/linalgproperties.hh>
#include <opm/models/utils/parametersystem.hh> #include <opm/models/utils/parametersystem.hh>
namespace Opm { namespace Opm {
template <class TypeTag> template <class TypeTag>
class ISTLSolverBda; class ISTLSolverBda;
template <class TypeTag> template <class TypeTag>
class ISTLSolver; class ISTLSolver;
} }
namespace Opm::Properties { namespace Opm::Properties {
namespace TTag { namespace TTag {
struct FlowIstlSolverParams {}; struct FlowIstlSolverParams {};
} }
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct LinearSolverReduction { struct LinearSolverReduction { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct RelaxedLinearSolverReduction { struct RelaxedLinearSolverReduction { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct LinearSolverMaxIter { struct LinearSolverMaxIter { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct LinearSolverRestart { struct LinearSolverRestart { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
//
// LinearSolverVerbosity defined in opm-models
//
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct IluRelaxation { struct IluRelaxation { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct IluFillinLevel { struct IluFillinLevel { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct MiluVariant { struct MiluVariant { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct IluRedblack { struct IluRedblack { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct IluReorderSpheres { struct IluReorderSpheres { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct UseGmres { struct UseGmres { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct LinearSolverIgnoreConvergenceFailure{ struct LinearSolverIgnoreConvergenceFailure { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct ScaleLinearSystem { struct ScaleLinearSystem { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct LinearSolver { struct LinearSolver { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct LinearSolverPrintJsonDefinition { struct LinearSolverPrintJsonDefinition { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct CprReuseSetup { struct CprReuseSetup { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct CprReuseInterval { struct CprReuseInterval { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct AcceleratorMode { struct AcceleratorMode { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct BdaDeviceId { struct BdaDeviceId { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct OpenclPlatformId { struct OpenclPlatformId { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct OpenclIluParallel { struct OpenclIluParallel { using type = UndefinedProperty; };
using type = UndefinedProperty;
};
template<class TypeTag> template<class TypeTag>
struct LinearSolverReduction<TypeTag, TTag::FlowIstlSolverParams> { struct LinearSolverReduction<TypeTag, TTag::FlowIstlSolverParams>
{
using type = GetPropType<TypeTag, Scalar>; using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-2; static constexpr type value = 1e-2;
}; };
template<class TypeTag> template<class TypeTag>
struct RelaxedLinearSolverReduction<TypeTag, TTag::FlowIstlSolverParams> { struct RelaxedLinearSolverReduction<TypeTag, TTag::FlowIstlSolverParams>
{
using type = GetPropType<TypeTag, Scalar>; using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-2; static constexpr type value = 1e-2;
}; };
template<class TypeTag> template<class TypeTag>
struct LinearSolverMaxIter<TypeTag, TTag::FlowIstlSolverParams> { struct LinearSolverMaxIter<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 200; { static constexpr int value = 200; };
};
template<class TypeTag> template<class TypeTag>
struct LinearSolverRestart<TypeTag, TTag::FlowIstlSolverParams> { struct LinearSolverRestart<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 40; { static constexpr int value = 40; };
};
template<class TypeTag> template<class TypeTag>
struct LinearSolverVerbosity<TypeTag, TTag::FlowIstlSolverParams> { struct IluRelaxation<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 0; {
};
template<class TypeTag>
struct IluRelaxation<TypeTag, TTag::FlowIstlSolverParams> {
using type = GetPropType<TypeTag, Scalar>; using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 0.9; static constexpr type value = 0.9;
}; };
template<class TypeTag> template<class TypeTag>
struct IluFillinLevel<TypeTag, TTag::FlowIstlSolverParams> { struct IluFillinLevel<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 0; { static constexpr int value = 0; };
};
template<class TypeTag> template<class TypeTag>
struct MiluVariant<TypeTag, TTag::FlowIstlSolverParams> { struct MiluVariant<TypeTag, TTag::FlowIstlSolverParams>
static constexpr auto value = "ILU"; { static constexpr auto value = "ILU"; };
};
template<class TypeTag> template<class TypeTag>
struct IluRedblack<TypeTag, TTag::FlowIstlSolverParams> { struct IluRedblack<TypeTag, TTag::FlowIstlSolverParams>
static constexpr bool value = false; { static constexpr bool value = false; };
};
template<class TypeTag> template<class TypeTag>
struct IluReorderSpheres<TypeTag, TTag::FlowIstlSolverParams> { struct IluReorderSpheres<TypeTag, TTag::FlowIstlSolverParams>
static constexpr bool value = false; { static constexpr bool value = false; };
};
template<class TypeTag> template<class TypeTag>
struct UseGmres<TypeTag, TTag::FlowIstlSolverParams> { struct UseGmres<TypeTag, TTag::FlowIstlSolverParams>
static constexpr bool value = false; { static constexpr bool value = false; };
};
template<class TypeTag> template<class TypeTag>
struct LinearSolverIgnoreConvergenceFailure<TypeTag, TTag::FlowIstlSolverParams> { struct LinearSolverIgnoreConvergenceFailure<TypeTag, TTag::FlowIstlSolverParams>
static constexpr bool value = false; { static constexpr bool value = false; };
};
template<class TypeTag> template<class TypeTag>
struct ScaleLinearSystem<TypeTag, TTag::FlowIstlSolverParams> { struct ScaleLinearSystem<TypeTag, TTag::FlowIstlSolverParams>
static constexpr bool value = false; { static constexpr bool value = false; };
};
template<class TypeTag> template<class TypeTag>
struct LinearSolver<TypeTag, TTag::FlowIstlSolverParams> { struct LinearSolver<TypeTag, TTag::FlowIstlSolverParams>
static constexpr auto value = "ilu0"; { static constexpr auto value = "ilu0"; };
};
template<class TypeTag> template<class TypeTag>
struct LinearSolverPrintJsonDefinition<TypeTag, TTag::FlowIstlSolverParams> { struct LinearSolverPrintJsonDefinition<TypeTag, TTag::FlowIstlSolverParams>
static constexpr auto value = true; { static constexpr auto value = true; };
};
template<class TypeTag> template<class TypeTag>
struct CprReuseSetup<TypeTag, TTag::FlowIstlSolverParams> { struct CprReuseSetup<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 4; { static constexpr int value = 4; };
};
template<class TypeTag> template<class TypeTag>
struct CprReuseInterval<TypeTag, TTag::FlowIstlSolverParams> { struct CprReuseInterval<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 30; { static constexpr int value = 30; };
};
template<class TypeTag> template<class TypeTag>
struct AcceleratorMode<TypeTag, TTag::FlowIstlSolverParams> { struct AcceleratorMode<TypeTag, TTag::FlowIstlSolverParams>
static constexpr auto value = "none"; { static constexpr auto value = "none"; };
};
template<class TypeTag> template<class TypeTag>
struct BdaDeviceId<TypeTag, TTag::FlowIstlSolverParams> { struct BdaDeviceId<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 0; { static constexpr int value = 0; };
};
template<class TypeTag> template<class TypeTag>
struct OpenclPlatformId<TypeTag, TTag::FlowIstlSolverParams> { struct OpenclPlatformId<TypeTag, TTag::FlowIstlSolverParams>
static constexpr int value = 0; { static constexpr int value = 0; };
};
template<class TypeTag> template<class TypeTag>
struct OpenclIluParallel<TypeTag, TTag::FlowIstlSolverParams> { struct OpenclIluParallel<TypeTag, TTag::FlowIstlSolverParams>
static constexpr bool value = true; // note: false should only be used in debug { static constexpr bool value = true; }; // note: false should only be used in debug
};
// Set the backend to be used. // Set the backend to be used.
template<class TypeTag> template<class TypeTag>
struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams> { struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams>
{
#if COMPILE_BDA_BRIDGE #if COMPILE_BDA_BRIDGE
using type = ISTLSolverBda<TypeTag>; using type = ISTLSolverBda<TypeTag>;
#else #else
using type = ISTLSolver<TypeTag>; using type = ISTLSolver<TypeTag>;
#endif #endif
}; };
} // namespace Opm::Properties } // namespace Opm::Properties
namespace Opm namespace Opm::Parameters {
template<class TypeTag>
struct LinearSolverVerbosity<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 0; };
} // namespace Opm::Properties
namespace Opm {
/// This class carries all parameters for the NewtonIterationBlackoilInterleaved class.
struct FlowLinearSolverParameters
{ {
/// This class carries all parameters for the NewtonIterationBlackoilInterleaved class.
struct FlowLinearSolverParameters
{
double linear_solver_reduction_; double linear_solver_reduction_;
double relaxed_linear_solver_reduction_; double relaxed_linear_solver_reduction_;
int linear_solver_maxiter_; int linear_solver_maxiter_;
@ -265,7 +253,7 @@ namespace Opm
relaxed_linear_solver_reduction_ = Parameters::get<TypeTag, Properties::RelaxedLinearSolverReduction>(); relaxed_linear_solver_reduction_ = Parameters::get<TypeTag, Properties::RelaxedLinearSolverReduction>();
linear_solver_maxiter_ = Parameters::get<TypeTag, Properties::LinearSolverMaxIter>(); linear_solver_maxiter_ = Parameters::get<TypeTag, Properties::LinearSolverMaxIter>();
linear_solver_restart_ = Parameters::get<TypeTag, Properties::LinearSolverRestart>(); linear_solver_restart_ = Parameters::get<TypeTag, Properties::LinearSolverRestart>();
linear_solver_verbosity_ = Parameters::get<TypeTag, Properties::LinearSolverVerbosity>(); linear_solver_verbosity_ = Parameters::get<TypeTag, Parameters::LinearSolverVerbosity>();
ilu_relaxation_ = Parameters::get<TypeTag, Properties::IluRelaxation>(); ilu_relaxation_ = Parameters::get<TypeTag, Properties::IluRelaxation>();
ilu_fillin_level_ = Parameters::get<TypeTag, Properties::IluFillinLevel>(); ilu_fillin_level_ = Parameters::get<TypeTag, Properties::IluFillinLevel>();
ilu_milu_ = convertString2Milu(Parameters::get<TypeTag, Properties::MiluVariant>()); ilu_milu_ = convertString2Milu(Parameters::get<TypeTag, Properties::MiluVariant>());
@ -303,7 +291,7 @@ namespace Opm
("The maximum number of iterations of the linear solver"); ("The maximum number of iterations of the linear solver");
Parameters::registerParam<TypeTag, Properties::LinearSolverRestart> Parameters::registerParam<TypeTag, Properties::LinearSolverRestart>
("The number of iterations after which GMRES is restarted"); ("The number of iterations after which GMRES is restarted");
Parameters::registerParam<TypeTag, Properties::LinearSolverVerbosity> Parameters::registerParam<TypeTag, Parameters::LinearSolverVerbosity>
("The verbosity level of the linear solver (0: off, 2: all)"); ("The verbosity level of the linear solver (0: off, 2: all)");
Parameters::registerParam<TypeTag, Properties::IluRelaxation> Parameters::registerParam<TypeTag, Properties::IluRelaxation>
("The relaxation factor of the linear solver's ILU preconditioner"); ("The relaxation factor of the linear solver's ILU preconditioner");
@ -390,12 +378,8 @@ namespace Opm
opencl_platform_id_ = 0; opencl_platform_id_ = 0;
opencl_ilu_parallel_ = true; opencl_ilu_parallel_ = true;
} }
}; };
} // namespace Opm } // namespace Opm
#endif // OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED #endif // OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED