24 #ifndef OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED
25 #define OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED
27 #include <opm/common/utility/parameters/ParameterGroup.hpp>
28 #include <opm/simulators/linalg/ParallelOverlappingILU0.hpp>
30 #include <opm/simulators/linalg/linalgproperties.hh>
31 #include <opm/models/utils/parametersystem.hh>
37 template <
class TypeTag>
42 namespace Opm::Properties {
48 template<
class TypeTag,
class MyTypeTag>
50 using type = UndefinedProperty;
52 template<
class TypeTag,
class MyTypeTag>
54 using type = UndefinedProperty;
56 template<
class TypeTag,
class MyTypeTag>
58 using type = UndefinedProperty;
60 template<
class TypeTag,
class MyTypeTag>
62 using type = UndefinedProperty;
64 template<
class TypeTag,
class MyTypeTag>
66 using type = UndefinedProperty;
68 template<
class TypeTag,
class MyTypeTag>
70 using type = UndefinedProperty;
72 template<
class TypeTag,
class MyTypeTag>
74 using type = UndefinedProperty;
76 template<
class TypeTag,
class MyTypeTag>
78 using type = UndefinedProperty;
80 template<
class TypeTag,
class MyTypeTag>
82 using type = UndefinedProperty;
84 template<
class TypeTag,
class MyTypeTag>
86 using type = UndefinedProperty;
88 template<
class TypeTag,
class MyTypeTag>
90 using type = UndefinedProperty;
92 template<
class TypeTag,
class MyTypeTag>
94 using type = UndefinedProperty;
96 template<
class TypeTag,
class MyTypeTag>
98 using type = UndefinedProperty;
100 template<
class TypeTag,
class MyTypeTag>
102 using type = UndefinedProperty;
104 template<
class TypeTag,
class MyTypeTag>
106 using type = UndefinedProperty;
108 template<
class TypeTag,
class MyTypeTag>
110 using type = UndefinedProperty;
112 template<
class TypeTag,
class MyTypeTag>
114 using type = UndefinedProperty;
116 template<
class TypeTag,
class MyTypeTag>
118 using type = UndefinedProperty;
120 template<
class TypeTag,
class MyTypeTag>
122 using type = UndefinedProperty;
124 template<
class TypeTag,
class MyTypeTag>
126 using type = UndefinedProperty;
128 template<
class TypeTag,
class MyTypeTag>
130 using type = UndefinedProperty;
132 template<
class TypeTag,
class MyTypeTag>
134 using type = UndefinedProperty;
136 template<
class TypeTag,
class MyTypeTag>
138 using type = UndefinedProperty;
141 template<
class TypeTag>
143 using type = GetPropType<TypeTag, Scalar>;
144 static constexpr type value = 1e-2;
146 template<
class TypeTag>
148 using type = GetPropType<TypeTag, Scalar>;
149 static constexpr type value = 0.9;
151 template<
class TypeTag>
153 static constexpr
int value = 200;
155 template<
class TypeTag>
157 static constexpr
int value = 40;
159 template<
class TypeTag>
161 static constexpr
int value = 0;
163 template<
class TypeTag>
165 static constexpr
int value = 0;
167 template<
class TypeTag>
169 static constexpr
auto value =
"ILU";
171 template<
class TypeTag>
173 static constexpr
bool value =
false;
175 template<
class TypeTag>
177 static constexpr
bool value =
false;
179 template<
class TypeTag>
180 struct UseGmres<TypeTag, TTag::FlowIstlSolverParams> {
181 static constexpr
bool value =
false;
183 template<
class TypeTag>
185 static constexpr
bool value =
false;
187 template<
class TypeTag>
189 static constexpr
bool value =
false;
191 template<
class TypeTag>
192 struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams> {
195 template<
class TypeTag>
197 static constexpr
bool value =
false;
199 template<
class TypeTag>
201 static constexpr
bool value =
false;
203 template<
class TypeTag>
205 static constexpr
int value = 20;
207 template<
class TypeTag>
209 static constexpr
int value = 0;
211 template<
class TypeTag>
213 static constexpr
int value = 3;
215 template<
class TypeTag>
217 static constexpr
auto value =
"ilu0";
219 template<
class TypeTag>
221 static constexpr
auto value =
"none";
223 template<
class TypeTag>
225 static constexpr
int value = 0;
227 template<
class TypeTag>
229 static constexpr
int value = 0;
231 template<
class TypeTag>
233 static constexpr
auto value =
"";
235 template<
class TypeTag>
237 static constexpr
auto value =
"";
249 double linear_solver_reduction_;
250 double ilu_relaxation_;
251 int linear_solver_maxiter_;
252 int linear_solver_restart_;
253 int linear_solver_verbosity_;
254 int ilu_fillin_level_;
257 bool ilu_reorder_sphere_;
258 bool newton_use_gmres_;
259 bool require_full_sparsity_pattern_;
260 bool ignoreConvergenceFailure_;
261 bool scale_linear_system_;
262 std::string linsolver_;
263 std::string accelerator_mode_;
265 int opencl_platform_id_;
266 int cpr_max_ell_iter_ = 20;
267 int cpr_reuse_setup_ = 0;
268 std::string opencl_ilu_reorder_;
269 std::string fpga_bitstream_;
271 template <
class TypeTag>
275 linear_solver_reduction_ = EWOMS_GET_PARAM(TypeTag,
double, LinearSolverReduction);
276 ilu_relaxation_ = EWOMS_GET_PARAM(TypeTag,
double, IluRelaxation);
277 linear_solver_maxiter_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverMaxIter);
278 linear_solver_restart_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverRestart);
279 linear_solver_verbosity_ = EWOMS_GET_PARAM(TypeTag,
int, FlowLinearSolverVerbosity);
280 ilu_fillin_level_ = EWOMS_GET_PARAM(TypeTag,
int, IluFillinLevel);
281 ilu_milu_ = convertString2Milu(EWOMS_GET_PARAM(TypeTag, std::string, MiluVariant));
282 ilu_redblack_ = EWOMS_GET_PARAM(TypeTag,
bool, IluRedblack);
283 ilu_reorder_sphere_ = EWOMS_GET_PARAM(TypeTag,
bool, IluReorderSpheres);
284 newton_use_gmres_ = EWOMS_GET_PARAM(TypeTag,
bool, UseGmres);
285 require_full_sparsity_pattern_ = EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverRequireFullSparsityPattern);
286 ignoreConvergenceFailure_ = EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure);
287 scale_linear_system_ = EWOMS_GET_PARAM(TypeTag,
bool, ScaleLinearSystem);
288 cpr_max_ell_iter_ = EWOMS_GET_PARAM(TypeTag,
int, CprMaxEllIter);
289 cpr_reuse_setup_ = EWOMS_GET_PARAM(TypeTag,
int, CprReuseSetup);
290 linsolver_ = EWOMS_GET_PARAM(TypeTag, std::string, Linsolver);
291 accelerator_mode_ = EWOMS_GET_PARAM(TypeTag, std::string, AcceleratorMode);
292 bda_device_id_ = EWOMS_GET_PARAM(TypeTag,
int, BdaDeviceId);
293 opencl_platform_id_ = EWOMS_GET_PARAM(TypeTag,
int, OpenclPlatformId);
294 opencl_ilu_reorder_ = EWOMS_GET_PARAM(TypeTag, std::string, OpenclIluReorder);
295 fpga_bitstream_ = EWOMS_GET_PARAM(TypeTag, std::string, FpgaBitstream);
298 template <
class TypeTag>
299 static void registerParameters()
301 EWOMS_REGISTER_PARAM(TypeTag,
double, LinearSolverReduction,
"The minimum reduction of the residual which the linear solver must achieve");
302 EWOMS_REGISTER_PARAM(TypeTag,
double, IluRelaxation,
"The relaxation factor of the linear solver's ILU preconditioner");
303 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverMaxIter,
"The maximum number of iterations of the linear solver");
304 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverRestart,
"The number of iterations after which GMRES is restarted");
305 EWOMS_REGISTER_PARAM(TypeTag,
int, FlowLinearSolverVerbosity,
"The verbosity level of the linear solver (0: off, 2: all)");
306 EWOMS_REGISTER_PARAM(TypeTag,
int, IluFillinLevel,
"The fill-in level of the linear solver's ILU preconditioner");
307 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");
308 EWOMS_REGISTER_PARAM(TypeTag,
bool, IluRedblack,
"Use red-black partitioning for the ILU preconditioner");
309 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).");
310 EWOMS_REGISTER_PARAM(TypeTag,
bool, UseGmres,
"Use GMRES as the linear solver");
311 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverRequireFullSparsityPattern,
"Produce the full sparsity pattern for the linear solver");
312 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure,
"Continue with the simulation like nothing happened after the linear solver did not converge");
313 EWOMS_REGISTER_PARAM(TypeTag,
bool, ScaleLinearSystem,
"Scale linear system according to equation scale and primary variable types");
314 EWOMS_REGISTER_PARAM(TypeTag,
int, CprMaxEllIter,
"MaxIterations of the elliptic pressure part of the cpr solver");
315 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");
316 EWOMS_REGISTER_PARAM(TypeTag, std::string, Linsolver,
"Configuration of solver. Valid options are: ilu0 (default), cpr (an alias for cpr_trueimpes), 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.'");
317 EWOMS_REGISTER_PARAM(TypeTag, std::string, AcceleratorMode,
"Use GPU (cusparseSolver or openclSolver) or FPGA (fpgaSolver) as the linear solver, usage: '--accelerator-mode=[none|cusparse|opencl|fpga|amgcl]'");
318 EWOMS_REGISTER_PARAM(TypeTag,
int, BdaDeviceId,
"Choose device ID for cusparseSolver or openclSolver, use 'nvidia-smi' or 'clinfo' to determine valid IDs");
319 EWOMS_REGISTER_PARAM(TypeTag,
int, OpenclPlatformId,
"Choose platform ID for openclSolver, use 'clinfo' to determine valid platform IDs");
320 EWOMS_REGISTER_PARAM(TypeTag, std::string, OpenclIluReorder,
"Choose the reordering strategy for ILU for openclSolver and fpgaSolver, usage: '--opencl-ilu-reorder=[level_scheduling|graph_coloring], level_scheduling behaves like Dune and cusparse, graph_coloring is more aggressive and likely to be faster, but is random-based and generally increases the number of linear solves and linear iterations significantly.");
321 EWOMS_REGISTER_PARAM(TypeTag, std::string, FpgaBitstream,
"Specify the bitstream file for fpgaSolver (including path), usage: '--fpga-bitstream=<filename>'");
329 newton_use_gmres_ =
false;
330 linear_solver_reduction_ = 1e-2;
331 linear_solver_maxiter_ = 150;
332 linear_solver_restart_ = 40;
333 linear_solver_verbosity_ = 0;
334 require_full_sparsity_pattern_ =
false;
335 ignoreConvergenceFailure_ =
false;
336 ilu_fillin_level_ = 0;
337 ilu_relaxation_ = 0.9;
339 ilu_redblack_ =
false;
340 ilu_reorder_sphere_ =
true;
341 accelerator_mode_ =
"none";
343 opencl_platform_id_ = 0;
344 opencl_ilu_reorder_ =
"";
345 fpga_bitstream_ =
"";
This class solves the fully implicit black-oil system by solving the reduced system (after eliminatin...
Definition: ISTLSolverEbos.hpp:78
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26
MILU_VARIANT
Definition: ParallelOverlappingILU0.hpp:47
@ ILU
Do not perform modified ILU.
This class carries all parameters for the NewtonIterationBlackoilInterleaved class.
Definition: FlowLinearSolverParameters.hpp:248
Definition: FlowLinearSolverParameters.hpp:121
Definition: FlowLinearSolverParameters.hpp:125
Definition: FlowLinearSolverParameters.hpp:109
Definition: FlowLinearSolverParameters.hpp:105
Definition: FlowLinearSolverParameters.hpp:113
Definition: FlowLinearSolverParameters.hpp:65
Definition: FlowLinearSolverParameters.hpp:137
Definition: FlowLinearSolverParameters.hpp:69
Definition: FlowLinearSolverParameters.hpp:77
Definition: FlowLinearSolverParameters.hpp:53
Definition: FlowLinearSolverParameters.hpp:81
Definition: FlowLinearSolverParameters.hpp:93
Definition: FlowLinearSolverParameters.hpp:57
Definition: FlowLinearSolverParameters.hpp:49
Definition: FlowLinearSolverParameters.hpp:89
Definition: FlowLinearSolverParameters.hpp:61
Definition: FlowLinearSolverParameters.hpp:117
Definition: FlowLinearSolverParameters.hpp:73
Definition: FlowLinearSolverParameters.hpp:133
Definition: FlowLinearSolverParameters.hpp:97
Definition: FlowLinearSolverParameters.hpp:101
Definition: FlowLinearSolverParameters.hpp:45
Definition: FlowLinearSolverParameters.hpp:85