mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move FlowLinearSolver parameters to TypeTag-free parameter system
This commit is contained in:
parent
280704e2e0
commit
3751ca6be4
@ -160,7 +160,7 @@ public:
|
|||||||
// only. This must be addressed before going parallel.
|
// only. This must be addressed before going parallel.
|
||||||
const auto& eclState = model_.simulator().vanguard().eclState();
|
const auto& eclState = model_.simulator().vanguard().eclState();
|
||||||
FlowLinearSolverParameters loc_param;
|
FlowLinearSolverParameters loc_param;
|
||||||
loc_param.template init<TypeTag>(eclState.getSimulationConfig().useCPR());
|
loc_param.init(eclState.getSimulationConfig().useCPR());
|
||||||
// Override solver type with umfpack if small domain.
|
// Override solver type with umfpack if small domain.
|
||||||
// Otherwise hardcode to ILU0
|
// Otherwise hardcode to ILU0
|
||||||
if (domains_[index].cells.size() < 200) {
|
if (domains_[index].cells.size() < 200) {
|
||||||
|
@ -63,154 +63,26 @@ struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams>
|
|||||||
|
|
||||||
namespace Opm::Parameters {
|
namespace Opm::Parameters {
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
struct LinearSolverReduction { static constexpr double value = 1e-2; };
|
||||||
struct LinearSolverReduction { using type = Properties::UndefinedProperty; };
|
struct RelaxedLinearSolverReduction { static constexpr double value = 1e-2; };
|
||||||
|
struct IluRelaxation { static constexpr double value = 0.9; };
|
||||||
template<class TypeTag, class MyTypeTag>
|
struct LinearSolverMaxIter { static constexpr int value = 200; };
|
||||||
struct RelaxedLinearSolverReduction { using type = Properties::UndefinedProperty; };
|
struct LinearSolverRestart { static constexpr int value = 40; };
|
||||||
|
struct IluFillinLevel { static constexpr int value = 0; };
|
||||||
template<class TypeTag, class MyTypeTag>
|
struct MiluVariant { static constexpr auto value = "ILU"; };
|
||||||
struct LinearSolverMaxIter { using type = Properties::UndefinedProperty; };
|
struct IluRedblack { static constexpr bool value = false; };
|
||||||
|
struct IluReorderSpheres { static constexpr bool value = false; };
|
||||||
template<class TypeTag, class MyTypeTag>
|
struct UseGmres { static constexpr bool value = false; };
|
||||||
struct LinearSolverRestart { using type = Properties::UndefinedProperty; };
|
struct LinearSolverIgnoreConvergenceFailure { static constexpr bool value = false; };
|
||||||
|
struct ScaleLinearSystem { static constexpr bool value = false; };
|
||||||
template<class TypeTag, class MyTypeTag>
|
struct LinearSolver { static constexpr auto value = "cprw"; };
|
||||||
struct IluRelaxation { using type = Properties::UndefinedProperty; };
|
struct LinearSolverPrintJsonDefinition { static constexpr auto value = true; };
|
||||||
|
struct CprReuseSetup { static constexpr int value = 4; };
|
||||||
template<class TypeTag, class MyTypeTag>
|
struct CprReuseInterval { static constexpr int value = 30; };
|
||||||
struct IluFillinLevel { using type = Properties::UndefinedProperty; };
|
struct AcceleratorMode { static constexpr auto value = "none"; };
|
||||||
|
struct BdaDeviceId { static constexpr int value = 0; };
|
||||||
template<class TypeTag, class MyTypeTag>
|
struct OpenclPlatformId { static constexpr int value = 0; };
|
||||||
struct MiluVariant { using type = Properties::UndefinedProperty; };
|
struct OpenclIluParallel { static constexpr bool value = true; }; // note: false should only be used in debug
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct IluRedblack { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct IluReorderSpheres { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct UseGmres { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct LinearSolverIgnoreConvergenceFailure { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct ScaleLinearSystem { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct LinearSolver { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct LinearSolverPrintJsonDefinition { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct CprReuseSetup { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct CprReuseInterval { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct AcceleratorMode { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct BdaDeviceId { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct OpenclPlatformId { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag, class MyTypeTag>
|
|
||||||
struct OpenclIluParallel { using type = Properties::UndefinedProperty; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct LinearSolverReduction<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{
|
|
||||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
|
||||||
static constexpr type value = 1e-2;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct RelaxedLinearSolverReduction<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{
|
|
||||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
|
||||||
static constexpr type value = 1e-2;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct LinearSolverMaxIter<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr int value = 200; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct LinearSolverRestart<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr int value = 40; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct IluRelaxation<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{
|
|
||||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
|
||||||
static constexpr type value = 0.9;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct IluFillinLevel<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr int value = 0; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct MiluVariant<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr auto value = "ILU"; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct IluRedblack<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr bool value = false; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct IluReorderSpheres<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr bool value = false; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct UseGmres<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr bool value = false; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct LinearSolverIgnoreConvergenceFailure<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr bool value = false; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct ScaleLinearSystem<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr bool value = false; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct LinearSolver<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr auto value = "cprw"; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct LinearSolverPrintJsonDefinition<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr auto value = true; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct CprReuseSetup<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr int value = 4; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct CprReuseInterval<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr int value = 30; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct AcceleratorMode<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr auto value = "none"; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct BdaDeviceId<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr int value = 0; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct OpenclPlatformId<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr int value = 0; };
|
|
||||||
|
|
||||||
template<class TypeTag>
|
|
||||||
struct OpenclIluParallel<TypeTag, Properties::TTag::FlowIstlSolverParams>
|
|
||||||
{ static constexpr bool value = true; }; // note: false should only be used in debug
|
|
||||||
|
|
||||||
} // namespace Opm::Parameters
|
} // namespace Opm::Parameters
|
||||||
|
|
||||||
@ -241,109 +113,107 @@ struct FlowLinearSolverParameters
|
|||||||
int opencl_platform_id_;
|
int opencl_platform_id_;
|
||||||
bool opencl_ilu_parallel_;
|
bool opencl_ilu_parallel_;
|
||||||
|
|
||||||
template <class TypeTag>
|
|
||||||
void init(bool cprRequestedInDataFile)
|
void init(bool cprRequestedInDataFile)
|
||||||
{
|
{
|
||||||
// TODO: these parameters have undocumented non-trivial dependencies
|
// TODO: these parameters have undocumented non-trivial dependencies
|
||||||
linear_solver_reduction_ = Parameters::get<TypeTag, Parameters::LinearSolverReduction>();
|
linear_solver_reduction_ = Parameters::Get<Parameters::LinearSolverReduction>();
|
||||||
relaxed_linear_solver_reduction_ = Parameters::get<TypeTag, Parameters::RelaxedLinearSolverReduction>();
|
relaxed_linear_solver_reduction_ = Parameters::Get<Parameters::RelaxedLinearSolverReduction>();
|
||||||
linear_solver_maxiter_ = Parameters::get<TypeTag, Parameters::LinearSolverMaxIter>();
|
linear_solver_maxiter_ = Parameters::Get<Parameters::LinearSolverMaxIter>();
|
||||||
linear_solver_restart_ = Parameters::get<TypeTag, Parameters::LinearSolverRestart>();
|
linear_solver_restart_ = Parameters::Get<Parameters::LinearSolverRestart>();
|
||||||
linear_solver_verbosity_ = Parameters::Get<Parameters::LinearSolverVerbosity>();
|
linear_solver_verbosity_ = Parameters::Get<Parameters::LinearSolverVerbosity>();
|
||||||
ilu_relaxation_ = Parameters::get<TypeTag, Parameters::IluRelaxation>();
|
ilu_relaxation_ = Parameters::Get<Parameters::IluRelaxation>();
|
||||||
ilu_fillin_level_ = Parameters::get<TypeTag, Parameters::IluFillinLevel>();
|
ilu_fillin_level_ = Parameters::Get<Parameters::IluFillinLevel>();
|
||||||
ilu_milu_ = convertString2Milu(Parameters::get<TypeTag, Parameters::MiluVariant>());
|
ilu_milu_ = convertString2Milu(Parameters::Get<Parameters::MiluVariant>());
|
||||||
ilu_redblack_ = Parameters::get<TypeTag, Parameters::IluRedblack>();
|
ilu_redblack_ = Parameters::Get<Parameters::IluRedblack>();
|
||||||
ilu_reorder_sphere_ = Parameters::get<TypeTag, Parameters::IluReorderSpheres>();
|
ilu_reorder_sphere_ = Parameters::Get<Parameters::IluReorderSpheres>();
|
||||||
newton_use_gmres_ = Parameters::get<TypeTag, Parameters::UseGmres>();
|
newton_use_gmres_ = Parameters::Get<Parameters::UseGmres>();
|
||||||
ignoreConvergenceFailure_ = Parameters::get<TypeTag, Parameters::LinearSolverIgnoreConvergenceFailure>();
|
ignoreConvergenceFailure_ = Parameters::Get<Parameters::LinearSolverIgnoreConvergenceFailure>();
|
||||||
scale_linear_system_ = Parameters::get<TypeTag, Parameters::ScaleLinearSystem>();
|
scale_linear_system_ = Parameters::Get<Parameters::ScaleLinearSystem>();
|
||||||
linsolver_ = Parameters::get<TypeTag, Parameters::LinearSolver>();
|
linsolver_ = Parameters::Get<Parameters::LinearSolver>();
|
||||||
linear_solver_print_json_definition_ = Parameters::get<TypeTag, Parameters::LinearSolverPrintJsonDefinition>();
|
linear_solver_print_json_definition_ = Parameters::Get<Parameters::LinearSolverPrintJsonDefinition>();
|
||||||
cpr_reuse_setup_ = Parameters::get<TypeTag, Parameters::CprReuseSetup>();
|
cpr_reuse_setup_ = Parameters::Get<Parameters::CprReuseSetup>();
|
||||||
cpr_reuse_interval_ = Parameters::get<TypeTag, Parameters::CprReuseInterval>();
|
cpr_reuse_interval_ = Parameters::Get<Parameters::CprReuseInterval>();
|
||||||
|
|
||||||
if (!Parameters::isSet<TypeTag, Parameters::LinearSolver>() && cprRequestedInDataFile) {
|
if (!Parameters::IsSet<Parameters::LinearSolver>() && cprRequestedInDataFile) {
|
||||||
linsolver_ = "cpr";
|
linsolver_ = "cpr";
|
||||||
} else {
|
} else {
|
||||||
linsolver_ = Parameters::get<TypeTag, Parameters::LinearSolver>();
|
linsolver_ = Parameters::Get<Parameters::LinearSolver>();
|
||||||
}
|
}
|
||||||
|
|
||||||
accelerator_mode_ = Parameters::get<TypeTag, Parameters::AcceleratorMode>();
|
accelerator_mode_ = Parameters::Get<Parameters::AcceleratorMode>();
|
||||||
bda_device_id_ = Parameters::get<TypeTag, Parameters::BdaDeviceId>();
|
bda_device_id_ = Parameters::Get<Parameters::BdaDeviceId>();
|
||||||
opencl_platform_id_ = Parameters::get<TypeTag, Parameters::OpenclPlatformId>();
|
opencl_platform_id_ = Parameters::Get<Parameters::OpenclPlatformId>();
|
||||||
opencl_ilu_parallel_ = Parameters::get<TypeTag, Parameters::OpenclIluParallel>();
|
opencl_ilu_parallel_ = Parameters::Get<Parameters::OpenclIluParallel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class TypeTag>
|
|
||||||
static void registerParameters()
|
static void registerParameters()
|
||||||
{
|
{
|
||||||
Parameters::registerParam<TypeTag, Parameters::LinearSolverReduction>
|
Parameters::Register<Parameters::LinearSolverReduction>
|
||||||
("The minimum reduction of the residual which the linear solver must achieve");
|
("The minimum reduction of the residual which the linear solver must achieve");
|
||||||
Parameters::registerParam<TypeTag, Parameters::RelaxedLinearSolverReduction>
|
Parameters::Register<Parameters::RelaxedLinearSolverReduction>
|
||||||
("The minimum reduction of the residual which the linear solver need to "
|
("The minimum reduction of the residual which the linear solver need to "
|
||||||
"achieve for the solution to be accepted");
|
"achieve for the solution to be accepted");
|
||||||
Parameters::registerParam<TypeTag, Parameters::LinearSolverMaxIter>
|
Parameters::Register<Parameters::LinearSolverMaxIter>
|
||||||
("The maximum number of iterations of the linear solver");
|
("The maximum number of iterations of the linear solver");
|
||||||
Parameters::registerParam<TypeTag, Parameters::LinearSolverRestart>
|
Parameters::Register<Parameters::LinearSolverRestart>
|
||||||
("The number of iterations after which GMRES is restarted");
|
("The number of iterations after which GMRES is restarted");
|
||||||
Parameters::Register<Parameters::LinearSolverVerbosity>
|
Parameters::Register<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, Parameters::IluRelaxation>
|
Parameters::Register<Parameters::IluRelaxation>
|
||||||
("The relaxation factor of the linear solver's ILU preconditioner");
|
("The relaxation factor of the linear solver's ILU preconditioner");
|
||||||
Parameters::registerParam<TypeTag, Parameters::IluFillinLevel>
|
Parameters::Register<Parameters::IluFillinLevel>
|
||||||
("The fill-in level of the linear solver's ILU preconditioner");
|
("The fill-in level of the linear solver's ILU preconditioner");
|
||||||
Parameters::registerParam<TypeTag, Parameters::MiluVariant>
|
Parameters::Register<Parameters::MiluVariant>
|
||||||
("Specify which variant of the modified-ILU preconditioner ought to be used. "
|
("Specify which variant of the modified-ILU preconditioner ought to be used. "
|
||||||
"Possible variants are: ILU (default, plain ILU), "
|
"Possible variants are: ILU (default, plain ILU), "
|
||||||
"MILU_1 (lump diagonal with dropped row entries), "
|
"MILU_1 (lump diagonal with dropped row entries), "
|
||||||
"MILU_2 (lump diagonal with the sum of the absolute values of the dropped row entries), "
|
"MILU_2 (lump diagonal with the sum of the absolute values of the dropped row entries), "
|
||||||
"MILU_3 (if diagonal is positive add sum of dropped row entries, otherwise subtract them), "
|
"MILU_3 (if diagonal is positive add sum of dropped row entries, otherwise subtract them), "
|
||||||
"MILU_4 (if diagonal is positive add sum of dropped row entries, otherwise do nothing");
|
"MILU_4 (if diagonal is positive add sum of dropped row entries, otherwise do nothing");
|
||||||
Parameters::registerParam<TypeTag, Parameters::IluRedblack>
|
Parameters::Register<Parameters::IluRedblack>
|
||||||
("Use red-black partitioning for the ILU preconditioner");
|
("Use red-black partitioning for the ILU preconditioner");
|
||||||
Parameters::registerParam<TypeTag, Parameters::IluReorderSpheres>
|
Parameters::Register<Parameters::IluReorderSpheres>
|
||||||
("Whether to reorder the entries of the matrix in the red-black "
|
("Whether to reorder the entries of the matrix in the red-black "
|
||||||
"ILU preconditioner in spheres starting at an edge. "
|
"ILU preconditioner in spheres starting at an edge. "
|
||||||
"If false the original ordering is preserved in each color. "
|
"If false the original ordering is preserved in each color. "
|
||||||
"Otherwise why try to ensure D4 ordering (in a 2D structured grid, "
|
"Otherwise why try to ensure D4 ordering (in a 2D structured grid, "
|
||||||
"the diagonal elements are consecutive).");
|
"the diagonal elements are consecutive).");
|
||||||
Parameters::registerParam<TypeTag, Parameters::UseGmres>
|
Parameters::Register<Parameters::UseGmres>
|
||||||
("Use GMRES as the linear solver");
|
("Use GMRES as the linear solver");
|
||||||
Parameters::registerParam<TypeTag, Parameters::LinearSolverIgnoreConvergenceFailure>
|
Parameters::Register<Parameters::LinearSolverIgnoreConvergenceFailure>
|
||||||
("Continue with the simulation like nothing happened "
|
("Continue with the simulation like nothing happened "
|
||||||
"after the linear solver did not converge");
|
"after the linear solver did not converge");
|
||||||
Parameters::registerParam<TypeTag, Parameters::ScaleLinearSystem>
|
Parameters::Register<Parameters::ScaleLinearSystem>
|
||||||
("Scale linear system according to equation scale and primary variable types");
|
("Scale linear system according to equation scale and primary variable types");
|
||||||
Parameters::registerParam<TypeTag, Parameters::LinearSolver>
|
Parameters::Register<Parameters::LinearSolver>
|
||||||
("Configuration of solver. Valid options are: ilu0 (default), "
|
("Configuration of solver. Valid options are: ilu0 (default), "
|
||||||
"dilu, cprw, cpr (an alias for cprw), cpr_quasiimpes, "
|
"dilu, cprw, cpr (an alias for cprw), cpr_quasiimpes, "
|
||||||
"cpr_trueimpes, cpr_trueimpesanalytic, amg or hybrid (experimental). "
|
"cpr_trueimpes, cpr_trueimpesanalytic, amg or hybrid (experimental). "
|
||||||
"Alternatively, you can request a configuration to be read from a "
|
"Alternatively, you can request a configuration to be read from a "
|
||||||
"JSON file by giving the filename here, ending with '.json.'");
|
"JSON file by giving the filename here, ending with '.json.'");
|
||||||
Parameters::registerParam<TypeTag, Parameters::LinearSolverPrintJsonDefinition>
|
Parameters::Register<Parameters::LinearSolverPrintJsonDefinition>
|
||||||
("Write the JSON definition of the linear solver setup to the DBG file.");
|
("Write the JSON definition of the linear solver setup to the DBG file.");
|
||||||
Parameters::registerParam<TypeTag, Parameters::CprReuseSetup>
|
Parameters::Register<Parameters::CprReuseSetup>
|
||||||
("Reuse preconditioner setup. Valid options are "
|
("Reuse preconditioner setup. Valid options are "
|
||||||
"0: recreate the preconditioner for every linear solve, "
|
"0: recreate the preconditioner for every linear solve, "
|
||||||
"1: recreate once every timestep, "
|
"1: recreate once every timestep, "
|
||||||
"2: recreate if last linear solve took more than 10 iterations, "
|
"2: recreate if last linear solve took more than 10 iterations, "
|
||||||
"3: never recreate, "
|
"3: never recreate, "
|
||||||
"4: recreated every CprReuseInterval");
|
"4: recreated every CprReuseInterval");
|
||||||
Parameters::registerParam<TypeTag, Parameters::CprReuseInterval>
|
Parameters::Register<Parameters::CprReuseInterval>
|
||||||
("Reuse preconditioner interval. Used when CprReuseSetup is set to 4, "
|
("Reuse preconditioner interval. Used when CprReuseSetup is set to 4, "
|
||||||
"then the preconditioner will be fully recreated instead of reused "
|
"then the preconditioner will be fully recreated instead of reused "
|
||||||
"every N linear solve, where N is this parameter.");
|
"every N linear solve, where N is this parameter.");
|
||||||
Parameters::registerParam<TypeTag, Parameters::AcceleratorMode>
|
Parameters::Register<Parameters::AcceleratorMode>
|
||||||
("Choose a linear solver, usage: "
|
("Choose a linear solver, usage: "
|
||||||
"'--accelerator-mode=[none|cusparse|opencl|amgcl|rocalution|rocsparse]'");
|
"'--accelerator-mode=[none|cusparse|opencl|amgcl|rocalution|rocsparse]'");
|
||||||
Parameters::registerParam<TypeTag, Parameters::BdaDeviceId>
|
Parameters::Register<Parameters::BdaDeviceId>
|
||||||
("Choose device ID for cusparseSolver or openclSolver, "
|
("Choose device ID for cusparseSolver or openclSolver, "
|
||||||
"use 'nvidia-smi' or 'clinfo' to determine valid IDs");
|
"use 'nvidia-smi' or 'clinfo' to determine valid IDs");
|
||||||
Parameters::registerParam<TypeTag, Parameters::OpenclPlatformId>
|
Parameters::Register<Parameters::OpenclPlatformId>
|
||||||
("Choose platform ID for openclSolver, use 'clinfo' "
|
("Choose platform ID for openclSolver, use 'clinfo' "
|
||||||
"to determine valid platform IDs");
|
"to determine valid platform IDs");
|
||||||
Parameters::registerParam<TypeTag, Parameters::OpenclIluParallel>
|
Parameters::Register<Parameters::OpenclIluParallel>
|
||||||
("Parallelize ILU decomposition and application on GPU");
|
("Parallelize ILU decomposition and application on GPU");
|
||||||
|
|
||||||
Parameters::SetDefault<Parameters::LinearSolverVerbosity>(0);
|
Parameters::SetDefault<Parameters::LinearSolverVerbosity>(0);
|
||||||
|
@ -170,7 +170,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
|
|||||||
|
|
||||||
static void registerParameters()
|
static void registerParameters()
|
||||||
{
|
{
|
||||||
FlowLinearSolverParameters::registerParameters<TypeTag>();
|
FlowLinearSolverParameters::registerParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construct a system solver.
|
/// Construct a system solver.
|
||||||
@ -203,7 +203,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
|
|||||||
matrix_(nullptr)
|
matrix_(nullptr)
|
||||||
{
|
{
|
||||||
parameters_.resize(1);
|
parameters_.resize(1);
|
||||||
parameters_[0].template init<TypeTag>(simulator_.vanguard().eclState().getSimulationConfig().useCPR());
|
parameters_[0].init(simulator_.vanguard().eclState().getSimulationConfig().useCPR());
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,21 +220,21 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
|
|||||||
parameters_.clear();
|
parameters_.clear();
|
||||||
{
|
{
|
||||||
FlowLinearSolverParameters para;
|
FlowLinearSolverParameters para;
|
||||||
para.init<TypeTag>(false);
|
para.init(false);
|
||||||
para.linsolver_ = "cprw";
|
para.linsolver_ = "cprw";
|
||||||
parameters_.push_back(para);
|
parameters_.push_back(para);
|
||||||
prm_.push_back(setupPropertyTree(parameters_[0],
|
prm_.push_back(setupPropertyTree(parameters_[0],
|
||||||
Parameters::isSet<TypeTag, Parameters::LinearSolverMaxIter>(),
|
Parameters::IsSet<Parameters::LinearSolverMaxIter>(),
|
||||||
Parameters::isSet<TypeTag, Parameters::LinearSolverReduction>()));
|
Parameters::IsSet<Parameters::LinearSolverReduction>()));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
FlowLinearSolverParameters para;
|
FlowLinearSolverParameters para;
|
||||||
para.init<TypeTag>(false);
|
para.init(false);
|
||||||
para.linsolver_ = "ilu0";
|
para.linsolver_ = "ilu0";
|
||||||
parameters_.push_back(para);
|
parameters_.push_back(para);
|
||||||
prm_.push_back(setupPropertyTree(parameters_[1],
|
prm_.push_back(setupPropertyTree(parameters_[1],
|
||||||
Parameters::isSet<TypeTag, Parameters::LinearSolverMaxIter>(),
|
Parameters::IsSet<Parameters::LinearSolverMaxIter>(),
|
||||||
Parameters::isSet<TypeTag, Parameters::LinearSolverReduction>()));
|
Parameters::IsSet<Parameters::LinearSolverReduction>()));
|
||||||
}
|
}
|
||||||
// ------------
|
// ------------
|
||||||
} else {
|
} else {
|
||||||
@ -242,8 +242,8 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
|
|||||||
assert(parameters_.size() == 1);
|
assert(parameters_.size() == 1);
|
||||||
assert(prm_.empty());
|
assert(prm_.empty());
|
||||||
prm_.push_back(setupPropertyTree(parameters_[0],
|
prm_.push_back(setupPropertyTree(parameters_[0],
|
||||||
Parameters::isSet<TypeTag, Parameters::LinearSolverMaxIter>(),
|
Parameters::IsSet<Parameters::LinearSolverMaxIter>(),
|
||||||
Parameters::isSet<TypeTag, Parameters::LinearSolverReduction>()));
|
Parameters::IsSet<Parameters::LinearSolverReduction>()));
|
||||||
}
|
}
|
||||||
flexibleSolver_.resize(prm_.size());
|
flexibleSolver_.resize(prm_.size());
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public:
|
|||||||
{
|
{
|
||||||
OPM_TIMEBLOCK(initializeBda);
|
OPM_TIMEBLOCK(initializeBda);
|
||||||
|
|
||||||
std::string accelerator_mode = Parameters::get<TypeTag, Parameters::AcceleratorMode>();
|
std::string accelerator_mode = Parameters::Get<Parameters::AcceleratorMode>();
|
||||||
// Force accelerator mode to none if using MPI.
|
// Force accelerator mode to none if using MPI.
|
||||||
if ((this->simulator_.vanguard().grid().comm().size() > 1) && (accelerator_mode != "none")) {
|
if ((this->simulator_.vanguard().grid().comm().size() > 1) && (accelerator_mode != "none")) {
|
||||||
const bool on_io_rank = (this->simulator_.gridView().comm().rank() == 0);
|
const bool on_io_rank = (this->simulator_.gridView().comm().rank() == 0);
|
||||||
@ -167,13 +167,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the BdaBridge
|
// Initialize the BdaBridge
|
||||||
const int platformID = Parameters::get<TypeTag, Parameters::OpenclPlatformId>();
|
const int platformID = Parameters::Get<Parameters::OpenclPlatformId>();
|
||||||
const int deviceID = Parameters::get<TypeTag, Parameters::BdaDeviceId>();
|
const int deviceID = Parameters::Get<Parameters::BdaDeviceId>();
|
||||||
const int maxit = Parameters::get<TypeTag, Parameters::LinearSolverMaxIter>();
|
const int maxit = Parameters::Get<Parameters::LinearSolverMaxIter>();
|
||||||
const double tolerance = Parameters::get<TypeTag, Parameters::LinearSolverReduction>();
|
const double tolerance = Parameters::Get<Parameters::LinearSolverReduction>();
|
||||||
const bool opencl_ilu_parallel = Parameters::get<TypeTag, Parameters::OpenclIluParallel>();
|
const bool opencl_ilu_parallel = Parameters::Get<Parameters::OpenclIluParallel>();
|
||||||
const int linear_solver_verbosity = this->parameters_[0].linear_solver_verbosity_;
|
const int linear_solver_verbosity = this->parameters_[0].linear_solver_verbosity_;
|
||||||
std::string linsolver = Parameters::get<TypeTag, Parameters::LinearSolver>();
|
std::string linsolver = Parameters::Get<Parameters::LinearSolver>();
|
||||||
bdaBridge_ = std::make_unique<detail::BdaSolverInfo<Matrix,Vector>>(accelerator_mode,
|
bdaBridge_ = std::make_unique<detail::BdaSolverInfo<Matrix,Vector>>(accelerator_mode,
|
||||||
linear_solver_verbosity,
|
linear_solver_verbosity,
|
||||||
maxit,
|
maxit,
|
||||||
|
Loading…
Reference in New Issue
Block a user