238 double linear_solver_reduction_;
239 double relaxed_linear_solver_reduction_;
240 int linear_solver_maxiter_;
241 int linear_solver_restart_;
242 int linear_solver_verbosity_;
243 double ilu_relaxation_;
244 int ilu_fillin_level_;
247 bool ilu_reorder_sphere_;
248 bool newton_use_gmres_;
249 bool ignoreConvergenceFailure_;
250 bool scale_linear_system_;
251 std::string linsolver_;
252 bool linear_solver_print_json_definition_;
253 int cpr_reuse_setup_;
254 int cpr_reuse_interval_;
255 std::string accelerator_mode_;
257 int opencl_platform_id_;
258 bool opencl_ilu_parallel_;
260 template <
class TypeTag>
264 linear_solver_reduction_ =
EWOMS_GET_PARAM(TypeTag,
double, LinearSolverReduction);
265 relaxed_linear_solver_reduction_ =
EWOMS_GET_PARAM(TypeTag,
double, RelaxedLinearSolverReduction);
266 linear_solver_maxiter_ =
EWOMS_GET_PARAM(TypeTag,
int, LinearSolverMaxIter);
267 linear_solver_restart_ =
EWOMS_GET_PARAM(TypeTag,
int, LinearSolverRestart);
271 ilu_milu_ = convertString2Milu(
EWOMS_GET_PARAM(TypeTag, std::string, MiluVariant));
273 ilu_reorder_sphere_ =
EWOMS_GET_PARAM(TypeTag,
bool, IluReorderSpheres);
275 ignoreConvergenceFailure_ =
EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure);
276 scale_linear_system_ =
EWOMS_GET_PARAM(TypeTag,
bool, ScaleLinearSystem);
278 linear_solver_print_json_definition_ =
EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverPrintJsonDefinition);
288 accelerator_mode_ =
EWOMS_GET_PARAM(TypeTag, std::string, AcceleratorMode);
291 opencl_ilu_parallel_ =
EWOMS_GET_PARAM(TypeTag,
bool, OpenclIluParallel);
294 template <
class TypeTag>
295 static void registerParameters()
297 EWOMS_REGISTER_PARAM(TypeTag,
double, LinearSolverReduction,
"The minimum reduction of the residual which the linear solver must achieve");
298 EWOMS_REGISTER_PARAM(TypeTag,
double, RelaxedLinearSolverReduction,
"The minimum reduction of the residual which the linear solver need to achieve for the solution to be accepted");
299 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverMaxIter,
"The maximum number of iterations of the linear solver");
300 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverRestart,
"The number of iterations after which GMRES is restarted");
302 EWOMS_REGISTER_PARAM(TypeTag,
double, IluRelaxation,
"The relaxation factor of the linear solver's ILU preconditioner");
303 EWOMS_REGISTER_PARAM(TypeTag,
int, IluFillinLevel,
"The fill-in level of the linear solver's ILU preconditioner");
304 EWOMS_REGISTER_PARAM(TypeTag, std::string, MiluVariant,
"Specify which variant of the modified-ILU preconditioner ought to be used. Possible variants are: ILU (default, plain ILU), 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_3 (if diagonal is positive add sum of dropped row entrires. Otherwise subtract them), MILU_4 (if diagonal is positive add sum of dropped row entrires. Otherwise do nothing");
305 EWOMS_REGISTER_PARAM(TypeTag,
bool, IluRedblack,
"Use red-black partitioning for the ILU preconditioner");
306 EWOMS_REGISTER_PARAM(TypeTag,
bool, IluReorderSpheres,
"Whether to reorder the entries of the matrix in the red-black ILU preconditioner in spheres starting at an edge. If false the original ordering is preserved in each color. Otherwise why try to ensure D4 ordering (in a 2D structured grid, the diagonal elements are consecutive).");
308 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure,
"Continue with the simulation like nothing happened after the linear solver did not converge");
309 EWOMS_REGISTER_PARAM(TypeTag,
bool, ScaleLinearSystem,
"Scale linear system according to equation scale and primary variable types");
310 EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolver,
"Configuration of solver. Valid options are: ilu0 (default), cprw, cpr (an alias for cprw), cpr_quasiimpes, cpr_trueimpes, amg or hybrid (experimental). Alternatively, you can request a configuration to be read from a JSON file by giving the filename here, ending with '.json.'");
311 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverPrintJsonDefinition,
"Write the JSON definition of the linear solver setup to the DBG file.");
312 EWOMS_REGISTER_PARAM(TypeTag,
int, CprReuseSetup,
"Reuse preconditioner setup. Valid options are 0: recreate the preconditioner for every linear solve, 1: recreate once every timestep, 2: recreate if last linear solve took more than 10 iterations, 3: never recreate, 4: recreated every CprReuseInterval");
313 EWOMS_REGISTER_PARAM(TypeTag,
int, CprReuseInterval,
"Reuse preconditioner interval. Used when CprReuseSetup is set to 4, then the preconditioner will be fully recreated instead of reused every N linear solve, where N is this parameter.");
314 EWOMS_REGISTER_PARAM(TypeTag, std::string, AcceleratorMode,
"Choose a linear solver, usage: '--accelerator-mode=[none|cusparse|opencl|amgcl|rocalution]'");
315 EWOMS_REGISTER_PARAM(TypeTag,
int, BdaDeviceId,
"Choose device ID for cusparseSolver or openclSolver, use 'nvidia-smi' or 'clinfo' to determine valid IDs");
316 EWOMS_REGISTER_PARAM(TypeTag,
int, OpenclPlatformId,
"Choose platform ID for openclSolver, use 'clinfo' to determine valid platform IDs");
317 EWOMS_REGISTER_PARAM(TypeTag,
bool, OpenclIluParallel,
"Parallelize ILU decomposition and application on GPU");
325 relaxed_linear_solver_reduction_ = 1
e-2;
326 linear_solver_reduction_ = 1
e-2;
327 linear_solver_maxiter_ = 200;
328 linear_solver_restart_ = 40;
329 linear_solver_verbosity_ = 0;
330 ilu_relaxation_ = 0.9;
331 ilu_fillin_level_ = 0;
333 ilu_redblack_ =
false;
334 ilu_reorder_sphere_ =
false;
335 newton_use_gmres_ =
false;
336 ignoreConvergenceFailure_ =
false;
337 scale_linear_system_ =
false;
339 linear_solver_print_json_definition_ =
true;
340 cpr_reuse_setup_ = 4;
341 cpr_reuse_interval_ = 30;
342 accelerator_mode_ =
"none";
344 opencl_platform_id_ = 0;
345 opencl_ilu_parallel_ =
true;