24#ifndef OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED
25#define OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED
29#include <opm/simulators/linalg/linalgproperties.hh>
30#include <opm/models/utils/parametersystem.hh>
33template <
class TypeTag>
35template <
class TypeTag>
47template<
class TypeTag,
class MyTypeTag>
49 using type = UndefinedProperty;
52template<
class TypeTag,
class MyTypeTag>
54 using type = UndefinedProperty;
57template<
class TypeTag,
class MyTypeTag>
59 using type = UndefinedProperty;
61template<
class TypeTag,
class MyTypeTag>
63 using type = UndefinedProperty;
68template<
class TypeTag,
class MyTypeTag>
70 using type = UndefinedProperty;
72template<
class TypeTag,
class MyTypeTag>
74 using type = UndefinedProperty;
76template<
class TypeTag,
class MyTypeTag>
78 using type = UndefinedProperty;
80template<
class TypeTag,
class MyTypeTag>
82 using type = UndefinedProperty;
84template<
class TypeTag,
class MyTypeTag>
86 using type = UndefinedProperty;
88template<
class TypeTag,
class MyTypeTag>
90 using type = UndefinedProperty;
92template<
class TypeTag,
class MyTypeTag>
94 using type = UndefinedProperty;
96template<
class TypeTag,
class MyTypeTag>
98 using type = UndefinedProperty;
100template<
class TypeTag,
class MyTypeTag>
102 using type = UndefinedProperty;
104template<
class TypeTag,
class MyTypeTag>
106 using type = UndefinedProperty;
108template<
class TypeTag,
class MyTypeTag>
110 using type = UndefinedProperty;
112template<
class TypeTag,
class MyTypeTag>
114 using type = UndefinedProperty;
116template<
class TypeTag,
class MyTypeTag>
118 using type = UndefinedProperty;
120template<
class TypeTag,
class MyTypeTag>
122 using type = UndefinedProperty;
124template<
class TypeTag,
class MyTypeTag>
126 using type = UndefinedProperty;
128template<
class TypeTag,
class MyTypeTag>
130 using type = UndefinedProperty;
132template<
class TypeTag>
134 using type = GetPropType<TypeTag, Scalar>;
135 static constexpr type value = 1e-2;
137template<
class TypeTag>
139 using type = GetPropType<TypeTag, Scalar>;
140 static constexpr type value = 1e-2;
142template<
class TypeTag>
144 static constexpr int value = 200;
146template<
class TypeTag>
148 static constexpr int value = 40;
150template<
class TypeTag>
151struct LinearSolverVerbosity<TypeTag, TTag::FlowIstlSolverParams> {
152 static constexpr int value = 0;
154template<
class TypeTag>
156 using type = GetPropType<TypeTag, Scalar>;
157 static constexpr type value = 0.9;
159template<
class TypeTag>
161 static constexpr int value = 0;
163template<
class TypeTag>
165 static constexpr auto value =
"ILU";
167template<
class TypeTag>
169 static constexpr bool value =
false;
171template<
class TypeTag>
173 static constexpr bool value =
false;
175template<
class TypeTag>
176struct UseGmres<TypeTag, TTag::FlowIstlSolverParams> {
177 static constexpr bool value =
false;
179template<
class TypeTag>
181 static constexpr bool value =
false;
183template<
class TypeTag>
185 static constexpr bool value =
false;
187template<
class TypeTag>
189 static constexpr auto value =
"ilu0";
191template<
class TypeTag>
193 static constexpr auto value =
true;
195template<
class TypeTag>
197 static constexpr int value = 4;
199template<
class TypeTag>
201 static constexpr int value = 30;
203template<
class TypeTag>
205 static constexpr auto value =
"none";
207template<
class TypeTag>
209 static constexpr int value = 0;
211template<
class TypeTag>
213 static constexpr int value = 0;
215template<
class TypeTag>
217 static constexpr bool value =
true;
221template<
class TypeTag>
222struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams> {
223#if COMPILE_BDA_BRIDGE
260 template <
class TypeTag>
261 void init(
bool cprRequestedInDataFile)
269 ilu_relaxation_ = Parameters::get<TypeTag, Properties::IluRelaxation>();
272 ilu_redblack_ = Parameters::get<TypeTag, Properties::IluRedblack>();
277 linsolver_ = Parameters::get<TypeTag, Properties::LinearSolver>();
282 if (!Parameters::isSet<TypeTag, Properties::LinearSolver>() && cprRequestedInDataFile) {
285 linsolver_ = Parameters::get<TypeTag, Properties::LinearSolver>();
289 bda_device_id_ = Parameters::get<TypeTag, Properties::BdaDeviceId>();
294 template <
class TypeTag>
297 Parameters::registerParam<TypeTag, Properties::LinearSolverReduction>
298 (
"The minimum reduction of the residual which the linear solver must achieve");
299 Parameters::registerParam<TypeTag, Properties::RelaxedLinearSolverReduction>
300 (
"The minimum reduction of the residual which the linear solver need to "
301 "achieve for the solution to be accepted");
302 Parameters::registerParam<TypeTag, Properties::LinearSolverMaxIter>
303 (
"The maximum number of iterations of the linear solver");
304 Parameters::registerParam<TypeTag, Properties::LinearSolverRestart>
305 (
"The number of iterations after which GMRES is restarted");
306 Parameters::registerParam<TypeTag, Properties::LinearSolverVerbosity>
307 (
"The verbosity level of the linear solver (0: off, 2: all)");
308 Parameters::registerParam<TypeTag, Properties::IluRelaxation>
309 (
"The relaxation factor of the linear solver's ILU preconditioner");
310 Parameters::registerParam<TypeTag, Properties::IluFillinLevel>
311 (
"The fill-in level of the linear solver's ILU preconditioner");
312 Parameters::registerParam<TypeTag, Properties::MiluVariant>
313 (
"Specify which variant of the modified-ILU preconditioner ought to be used. "
314 "Possible variants are: ILU (default, plain ILU), "
315 "MILU_1 (lump diagonal with dropped row entries), "
316 "MILU_2 (lump diagonal with the sum of the absolute values of the dropped row entries), "
317 "MILU_3 (if diagonal is positive add sum of dropped row entries, otherwise subtract them), "
318 "MILU_4 (if diagonal is positive add sum of dropped row entries, otherwise do nothing");
319 Parameters::registerParam<TypeTag, Properties::IluRedblack>
320 (
"Use red-black partitioning for the ILU preconditioner");
321 Parameters::registerParam<TypeTag, Properties::IluReorderSpheres>
322 (
"Whether to reorder the entries of the matrix in the red-black "
323 "ILU preconditioner in spheres starting at an edge. "
324 "If false the original ordering is preserved in each color. "
325 "Otherwise why try to ensure D4 ordering (in a 2D structured grid, "
326 "the diagonal elements are consecutive).");
327 Parameters::registerParam<TypeTag, Properties::UseGmres>
328 (
"Use GMRES as the linear solver");
329 Parameters::registerParam<TypeTag, Properties::LinearSolverIgnoreConvergenceFailure>
330 (
"Continue with the simulation like nothing happened "
331 "after the linear solver did not converge");
332 Parameters::registerParam<TypeTag, Properties::ScaleLinearSystem>
333 (
"Scale linear system according to equation scale and primary variable types");
334 Parameters::registerParam<TypeTag, Properties::LinearSolver>
335 (
"Configuration of solver. Valid options are: ilu0 (default), "
336 "dilu, cprw, cpr (an alias for cprw), cpr_quasiimpes, "
337 "cpr_trueimpes, cpr_trueimpesanalytic, amg or hybrid (experimental). "
338 "Alternatively, you can request a configuration to be read from a "
339 "JSON file by giving the filename here, ending with '.json.'");
340 Parameters::registerParam<TypeTag, Properties::LinearSolverPrintJsonDefinition>
341 (
"Write the JSON definition of the linear solver setup to the DBG file.");
342 Parameters::registerParam<TypeTag, Properties::CprReuseSetup>
343 (
"Reuse preconditioner setup. Valid options are "
344 "0: recreate the preconditioner for every linear solve, "
345 "1: recreate once every timestep, "
346 "2: recreate if last linear solve took more than 10 iterations, "
347 "3: never recreate, "
348 "4: recreated every CprReuseInterval");
349 Parameters::registerParam<TypeTag, Properties::CprReuseInterval>
350 (
"Reuse preconditioner interval. Used when CprReuseSetup is set to 4, "
351 "then the preconditioner will be fully recreated instead of reused "
352 "every N linear solve, where N is this parameter.");
353 Parameters::registerParam<TypeTag, Properties::AcceleratorMode>
354 (
"Choose a linear solver, usage: "
355 "'--accelerator-mode=[none|cusparse|opencl|amgcl|rocalution|rocsparse]'");
356 Parameters::registerParam<TypeTag, Properties::BdaDeviceId>
357 (
"Choose device ID for cusparseSolver or openclSolver, "
358 "use 'nvidia-smi' or 'clinfo' to determine valid IDs");
359 Parameters::registerParam<TypeTag, Properties::OpenclPlatformId>
360 (
"Choose platform ID for openclSolver, use 'clinfo' "
361 "to determine valid platform IDs");
362 Parameters::registerParam<TypeTag, Properties::OpenclIluParallel>
363 (
"Parallelize ILU decomposition and application on GPU");
Definition: ISTLSolverBda.hpp:102
Definition: ISTLSolver.hpp:143
Definition: AluGridVanguard.hpp:57
Definition: BlackoilPhases.hpp:27
MILU_VARIANT
Definition: MILU.hpp:34
@ ILU
Do not perform modified ILU.
MILU_VARIANT convertString2Milu(const std::string &milu)
This class carries all parameters for the NewtonIterationBlackoilInterleaved class.
Definition: FlowLinearSolverParameters.hpp:237
bool ilu_redblack_
Definition: FlowLinearSolverParameters.hpp:246
int cpr_reuse_interval_
Definition: FlowLinearSolverParameters.hpp:254
int ilu_fillin_level_
Definition: FlowLinearSolverParameters.hpp:244
bool scale_linear_system_
Definition: FlowLinearSolverParameters.hpp:250
void init(bool cprRequestedInDataFile)
Definition: FlowLinearSolverParameters.hpp:261
double linear_solver_reduction_
Definition: FlowLinearSolverParameters.hpp:238
std::string accelerator_mode_
Definition: FlowLinearSolverParameters.hpp:255
bool newton_use_gmres_
Definition: FlowLinearSolverParameters.hpp:248
bool ignoreConvergenceFailure_
Definition: FlowLinearSolverParameters.hpp:249
int cpr_reuse_setup_
Definition: FlowLinearSolverParameters.hpp:253
int linear_solver_restart_
Definition: FlowLinearSolverParameters.hpp:241
double relaxed_linear_solver_reduction_
Definition: FlowLinearSolverParameters.hpp:239
int linear_solver_maxiter_
Definition: FlowLinearSolverParameters.hpp:240
int linear_solver_verbosity_
Definition: FlowLinearSolverParameters.hpp:242
int opencl_platform_id_
Definition: FlowLinearSolverParameters.hpp:257
FlowLinearSolverParameters()
Definition: FlowLinearSolverParameters.hpp:366
double ilu_relaxation_
Definition: FlowLinearSolverParameters.hpp:243
bool opencl_ilu_parallel_
Definition: FlowLinearSolverParameters.hpp:258
bool linear_solver_print_json_definition_
Definition: FlowLinearSolverParameters.hpp:252
bool ilu_reorder_sphere_
Definition: FlowLinearSolverParameters.hpp:247
static void registerParameters()
Definition: FlowLinearSolverParameters.hpp:295
void reset()
Definition: FlowLinearSolverParameters.hpp:369
int bda_device_id_
Definition: FlowLinearSolverParameters.hpp:256
MILU_VARIANT ilu_milu_
Definition: FlowLinearSolverParameters.hpp:245
std::string linsolver_
Definition: FlowLinearSolverParameters.hpp:251
Definition: FlowLinearSolverParameters.hpp:117
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:118
Definition: FlowLinearSolverParameters.hpp:121
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:122
Definition: FlowLinearSolverParameters.hpp:113
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:114
Definition: FlowLinearSolverParameters.hpp:109
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:110
Definition: FlowLinearSolverParameters.hpp:73
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:74
Definition: FlowLinearSolverParameters.hpp:81
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:82
GetPropType< TypeTag, Scalar > type
Definition: FlowLinearSolverParameters.hpp:156
Definition: FlowLinearSolverParameters.hpp:69
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:70
Definition: FlowLinearSolverParameters.hpp:85
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:86
Definition: FlowLinearSolverParameters.hpp:93
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:94
Definition: FlowLinearSolverParameters.hpp:58
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:59
Definition: FlowLinearSolverParameters.hpp:101
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:102
Definition: FlowLinearSolverParameters.hpp:105
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:106
GetPropType< TypeTag, Scalar > type
Definition: FlowLinearSolverParameters.hpp:134
Definition: FlowLinearSolverParameters.hpp:48
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:49
Definition: FlowLinearSolverParameters.hpp:62
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:63
Definition: FlowLinearSolverParameters.hpp:77
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:78
Definition: FlowLinearSolverParameters.hpp:129
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:130
GetPropType< TypeTag, Scalar > type
Definition: FlowLinearSolverParameters.hpp:139
Definition: FlowLinearSolverParameters.hpp:53
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:54
Definition: FlowLinearSolverParameters.hpp:97
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:98
Definition: FlowLinearSolverParameters.hpp:44
Definition: FlowLinearSolverParameters.hpp:89
UndefinedProperty type
Definition: FlowLinearSolverParameters.hpp:90