230 double linear_solver_reduction_;
231 double relaxed_linear_solver_reduction_;
232 double ilu_relaxation_;
233 int linear_solver_maxiter_;
234 int linear_solver_restart_;
235 int linear_solver_verbosity_;
236 int ilu_fillin_level_;
239 bool ilu_reorder_sphere_;
240 bool newton_use_gmres_;
241 bool require_full_sparsity_pattern_;
242 bool ignoreConvergenceFailure_;
243 bool scale_linear_system_;
244 std::string linsolver_;
245 std::string accelerator_mode_;
247 int opencl_platform_id_;
248 int cpr_reuse_setup_;
249 int cpr_reuse_interval_;
250 bool opencl_ilu_parallel_;
252 template <
class TypeTag>
256 linear_solver_reduction_ =
EWOMS_GET_PARAM(TypeTag,
double, LinearSolverReduction);
257 relaxed_linear_solver_reduction_ =
EWOMS_GET_PARAM(TypeTag,
double, RelaxedLinearSolverReduction);
259 linear_solver_maxiter_ =
EWOMS_GET_PARAM(TypeTag,
int, LinearSolverMaxIter);
260 linear_solver_restart_ =
EWOMS_GET_PARAM(TypeTag,
int, LinearSolverRestart);
263 ilu_milu_ = convertString2Milu(
EWOMS_GET_PARAM(TypeTag, std::string, MiluVariant));
265 ilu_reorder_sphere_ =
EWOMS_GET_PARAM(TypeTag,
bool, IluReorderSpheres);
267 ignoreConvergenceFailure_ =
EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure);
268 scale_linear_system_ =
EWOMS_GET_PARAM(TypeTag,
bool, ScaleLinearSystem);
278 accelerator_mode_ =
EWOMS_GET_PARAM(TypeTag, std::string, AcceleratorMode);
281 opencl_ilu_parallel_ =
EWOMS_GET_PARAM(TypeTag,
bool, OpenclIluParallel);
284 template <
class TypeTag>
285 static void registerParameters()
287 EWOMS_REGISTER_PARAM(TypeTag,
double, LinearSolverReduction,
"The minimum reduction of the residual which the linear solver must achieve for accepting solution as converged.");
288 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");
289 EWOMS_REGISTER_PARAM(TypeTag,
double, IluRelaxation,
"The relaxation factor of the linear solver's ILU preconditioner");
290 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverMaxIter,
"The maximum number of iterations of the linear solver");
291 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverRestart,
"The number of iterations after which GMRES is restarted");
293 EWOMS_REGISTER_PARAM(TypeTag,
int, IluFillinLevel,
"The fill-in level of the linear solver's ILU preconditioner");
294 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");
295 EWOMS_REGISTER_PARAM(TypeTag,
bool, IluRedblack,
"Use red-black partitioning for the ILU preconditioner");
296 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).");
298 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure,
"Continue with the simulation like nothing happened after the linear solver did not converge");
299 EWOMS_REGISTER_PARAM(TypeTag,
bool, ScaleLinearSystem,
"Scale linear system according to equation scale and primary variable types");
300 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");
301 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.");
302 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 or amg. Alternatively, you can request a configuration to be read from a JSON file by giving the filename here, ending with '.json.'");
303 EWOMS_REGISTER_PARAM(TypeTag, std::string, AcceleratorMode,
"Choose a linear solver, usage: '--accelerator-mode=[none|cusparse|opencl|amgcl|rocalution]'");
304 EWOMS_REGISTER_PARAM(TypeTag,
int, BdaDeviceId,
"Choose device ID for cusparseSolver or openclSolver, use 'nvidia-smi' or 'clinfo' to determine valid IDs");
305 EWOMS_REGISTER_PARAM(TypeTag,
int, OpenclPlatformId,
"Choose platform ID for openclSolver, use 'clinfo' to determine valid platform IDs");
306 EWOMS_REGISTER_PARAM(TypeTag,
bool, OpenclIluParallel,
"Parallelize ILU decomposition and application on GPU");
314 newton_use_gmres_ =
false;
315 linear_solver_reduction_ = 1
e-2;
316 relaxed_linear_solver_reduction_ = 1
e-2;
317 linear_solver_maxiter_ = 150;
318 linear_solver_restart_ = 40;
319 linear_solver_verbosity_ = 0;
320 require_full_sparsity_pattern_ =
false;
321 ignoreConvergenceFailure_ =
false;
322 ilu_fillin_level_ = 0;
323 ilu_relaxation_ = 0.9;
325 ilu_redblack_ =
false;
326 ilu_reorder_sphere_ =
true;
327 accelerator_mode_ =
"none";
329 opencl_platform_id_ = 0;
330 opencl_ilu_parallel_ =
true;