24#ifndef OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED
25#define OPM_FLOWLINEARSOLVERPARAMETERS_HEADER_INCLUDED
27#include <opm/simulators/linalg/MILU.hpp>
29#include <opm/simulators/linalg/linalgproperties.hh>
30#include <opm/models/utils/parametersystem.hh>
33template <
class TypeTag>
38namespace Opm::Properties {
44template<
class TypeTag,
class MyTypeTag>
46 using type = UndefinedProperty;
48template<
class TypeTag,
class MyTypeTag>
50 using type = UndefinedProperty;
52template<
class TypeTag,
class MyTypeTag>
54 using type = UndefinedProperty;
56template<
class TypeTag,
class MyTypeTag>
58 using type = UndefinedProperty;
63template<
class TypeTag,
class MyTypeTag>
65 using type = UndefinedProperty;
67template<
class TypeTag,
class MyTypeTag>
69 using type = UndefinedProperty;
71template<
class TypeTag,
class MyTypeTag>
73 using type = UndefinedProperty;
75template<
class TypeTag,
class MyTypeTag>
77 using type = UndefinedProperty;
79template<
class TypeTag,
class MyTypeTag>
81 using type = UndefinedProperty;
83template<
class TypeTag,
class MyTypeTag>
85 using type = UndefinedProperty;
87template<
class TypeTag,
class MyTypeTag>
89 using type = UndefinedProperty;
91template<
class TypeTag,
class MyTypeTag>
93 using type = UndefinedProperty;
95template<
class TypeTag,
class MyTypeTag>
97 using type = UndefinedProperty;
99template<
class TypeTag,
class MyTypeTag>
101 using type = UndefinedProperty;
103template<
class TypeTag,
class MyTypeTag>
105 using type = UndefinedProperty;
107template<
class TypeTag,
class MyTypeTag>
109 using type = UndefinedProperty;
111template<
class TypeTag,
class MyTypeTag>
113 using type = UndefinedProperty;
115template<
class TypeTag,
class MyTypeTag>
117 using type = UndefinedProperty;
119template<
class TypeTag,
class MyTypeTag>
121 using type = UndefinedProperty;
123template<
class TypeTag,
class MyTypeTag>
125 using type = UndefinedProperty;
127template<
class TypeTag,
class MyTypeTag>
129 using type = UndefinedProperty;
131template<
class TypeTag,
class MyTypeTag>
133 using type = UndefinedProperty;
135template<
class TypeTag,
class MyTypeTag>
137 using type = UndefinedProperty;
139template<
class TypeTag>
141 using type = GetPropType<TypeTag, Scalar>;
142 static constexpr type value = 1e-2;
144template<
class TypeTag>
146 using type = GetPropType<TypeTag, Scalar>;
147 static constexpr type value = 0.9;
149template<
class TypeTag>
151 static constexpr int value = 200;
153template<
class TypeTag>
155 static constexpr int value = 40;
157template<
class TypeTag>
158struct LinearSolverVerbosity<TypeTag, TTag::FlowIstlSolverParams> {
159 static constexpr int value = 0;
161template<
class TypeTag>
163 static constexpr int value = 0;
165template<
class TypeTag>
167 static constexpr auto value =
"ILU";
169template<
class TypeTag>
171 static constexpr bool value =
false;
173template<
class TypeTag>
175 static constexpr bool value =
false;
177template<
class TypeTag>
178struct UseGmres<TypeTag, TTag::FlowIstlSolverParams> {
179 static constexpr bool value =
false;
181template<
class TypeTag>
183 static constexpr bool value =
false;
185template<
class TypeTag>
187 static constexpr bool value =
false;
189template<
class TypeTag>
190struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams> {
193template<
class TypeTag>
195 static constexpr bool value =
false;
197template<
class TypeTag>
199 static constexpr bool value =
false;
201template<
class TypeTag>
203 static constexpr int value = 20;
205template<
class TypeTag>
207 static constexpr int value = 0;
209template<
class TypeTag>
211 static constexpr int value = 3;
213template<
class TypeTag>
215 static constexpr int value = 10;
217template<
class TypeTag>
219 static constexpr auto value =
"ilu0";
221template<
class TypeTag>
223 static constexpr auto value =
"none";
225template<
class TypeTag>
227 static constexpr int value = 0;
229template<
class TypeTag>
231 static constexpr int value = 0;
233template<
class TypeTag>
235 static constexpr auto value =
"";
237template<
class TypeTag>
239 static constexpr auto value =
"";
251 double linear_solver_reduction_;
252 double ilu_relaxation_;
253 int linear_solver_maxiter_;
254 int linear_solver_restart_;
255 int linear_solver_verbosity_;
256 int ilu_fillin_level_;
259 bool ilu_reorder_sphere_;
260 bool newton_use_gmres_;
261 bool require_full_sparsity_pattern_;
262 bool ignoreConvergenceFailure_;
263 bool scale_linear_system_;
264 std::string linsolver_;
265 std::string accelerator_mode_;
267 int opencl_platform_id_;
268 int cpr_max_ell_iter_;
269 int cpr_reuse_setup_;
270 int cpr_reuse_interval_;
271 std::string opencl_ilu_reorder_;
272 std::string fpga_bitstream_;
274 template <
class TypeTag>
278 linear_solver_reduction_ = EWOMS_GET_PARAM(TypeTag,
double, LinearSolverReduction);
279 ilu_relaxation_ = EWOMS_GET_PARAM(TypeTag,
double, IluRelaxation);
280 linear_solver_maxiter_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverMaxIter);
281 linear_solver_restart_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverRestart);
282 linear_solver_verbosity_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverVerbosity);
283 ilu_fillin_level_ = EWOMS_GET_PARAM(TypeTag,
int, IluFillinLevel);
284 ilu_milu_ = convertString2Milu(EWOMS_GET_PARAM(TypeTag, std::string, MiluVariant));
285 ilu_redblack_ = EWOMS_GET_PARAM(TypeTag,
bool, IluRedblack);
286 ilu_reorder_sphere_ = EWOMS_GET_PARAM(TypeTag,
bool, IluReorderSpheres);
287 newton_use_gmres_ = EWOMS_GET_PARAM(TypeTag,
bool, UseGmres);
288 require_full_sparsity_pattern_ = EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverRequireFullSparsityPattern);
289 ignoreConvergenceFailure_ = EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure);
290 scale_linear_system_ = EWOMS_GET_PARAM(TypeTag,
bool, ScaleLinearSystem);
291 cpr_max_ell_iter_ = EWOMS_GET_PARAM(TypeTag,
int, CprMaxEllIter);
292 cpr_reuse_setup_ = EWOMS_GET_PARAM(TypeTag,
int, CprReuseSetup);
293 cpr_reuse_interval_ = EWOMS_GET_PARAM(TypeTag,
int, CprReuseInterval);
294 linsolver_ = EWOMS_GET_PARAM(TypeTag, std::string, LinearSolver);
295 accelerator_mode_ = EWOMS_GET_PARAM(TypeTag, std::string, AcceleratorMode);
296 bda_device_id_ = EWOMS_GET_PARAM(TypeTag,
int, BdaDeviceId);
297 opencl_platform_id_ = EWOMS_GET_PARAM(TypeTag,
int, OpenclPlatformId);
298 opencl_ilu_reorder_ = EWOMS_GET_PARAM(TypeTag, std::string, OpenclIluReorder);
299 fpga_bitstream_ = EWOMS_GET_PARAM(TypeTag, std::string, FpgaBitstream);
302 template <
class TypeTag>
303 static void registerParameters()
305 EWOMS_REGISTER_PARAM(TypeTag,
double, LinearSolverReduction,
"The minimum reduction of the residual which the linear solver must achieve");
306 EWOMS_REGISTER_PARAM(TypeTag,
double, IluRelaxation,
"The relaxation factor of the linear solver's ILU preconditioner");
307 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverMaxIter,
"The maximum number of iterations of the linear solver");
308 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverRestart,
"The number of iterations after which GMRES is restarted");
309 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverVerbosity,
"The verbosity level of the linear solver (0: off, 2: all)");
310 EWOMS_REGISTER_PARAM(TypeTag,
int, IluFillinLevel,
"The fill-in level of the linear solver's ILU preconditioner");
311 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");
312 EWOMS_REGISTER_PARAM(TypeTag,
bool, IluRedblack,
"Use red-black partitioning for the ILU preconditioner");
313 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).");
314 EWOMS_REGISTER_PARAM(TypeTag,
bool, UseGmres,
"Use GMRES as the linear solver");
315 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverRequireFullSparsityPattern,
"Produce the full sparsity pattern for the linear solver");
316 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure,
"Continue with the simulation like nothing happened after the linear solver did not converge");
317 EWOMS_REGISTER_PARAM(TypeTag,
bool, ScaleLinearSystem,
"Scale linear system according to equation scale and primary variable types");
318 EWOMS_REGISTER_PARAM(TypeTag,
int, CprMaxEllIter,
"MaxIterations of the elliptic pressure part of the cpr solver");
319 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");
320 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.");
321 EWOMS_REGISTER_PARAM(TypeTag, std::string, LinearSolver,
"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.'");
322 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]'");
323 EWOMS_REGISTER_PARAM(TypeTag,
int, BdaDeviceId,
"Choose device ID for cusparseSolver or openclSolver, use 'nvidia-smi' or 'clinfo' to determine valid IDs");
324 EWOMS_REGISTER_PARAM(TypeTag,
int, OpenclPlatformId,
"Choose platform ID for openclSolver, use 'clinfo' to determine valid platform IDs");
325 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.");
326 EWOMS_REGISTER_PARAM(TypeTag, std::string, FpgaBitstream,
"Specify the bitstream file for fpgaSolver (including path), usage: '--fpga-bitstream=<filename>'");
334 newton_use_gmres_ =
false;
335 linear_solver_reduction_ = 1e-2;
336 linear_solver_maxiter_ = 150;
337 linear_solver_restart_ = 40;
338 linear_solver_verbosity_ = 0;
339 require_full_sparsity_pattern_ =
false;
340 ignoreConvergenceFailure_ =
false;
341 ilu_fillin_level_ = 0;
342 ilu_relaxation_ = 0.9;
344 ilu_redblack_ =
false;
345 ilu_reorder_sphere_ =
true;
346 accelerator_mode_ =
"none";
348 opencl_platform_id_ = 0;
349 opencl_ilu_reorder_ =
"";
350 fpga_bitstream_ =
"";
This class solves the fully implicit black-oil system by solving the reduced system (after eliminatin...
Definition: ISTLSolverEbos.hpp:197
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27
MILU_VARIANT
Definition: MILU.hpp:34
@ ILU
Do not perform modified ILU.
This class carries all parameters for the NewtonIterationBlackoilInterleaved class.
Definition: FlowLinearSolverParameters.hpp:250
Definition: FlowLinearSolverParameters.hpp:120
Definition: FlowLinearSolverParameters.hpp:124
Definition: FlowLinearSolverParameters.hpp:104
Definition: FlowLinearSolverParameters.hpp:100
Definition: FlowLinearSolverParameters.hpp:112
Definition: FlowLinearSolverParameters.hpp:108
Definition: FlowLinearSolverParameters.hpp:136
Definition: FlowLinearSolverParameters.hpp:64
Definition: FlowLinearSolverParameters.hpp:72
Definition: FlowLinearSolverParameters.hpp:49
Definition: FlowLinearSolverParameters.hpp:76
Definition: FlowLinearSolverParameters.hpp:88
Definition: FlowLinearSolverParameters.hpp:53
Definition: FlowLinearSolverParameters.hpp:45
Definition: FlowLinearSolverParameters.hpp:84
Definition: FlowLinearSolverParameters.hpp:57
Definition: FlowLinearSolverParameters.hpp:116
Definition: FlowLinearSolverParameters.hpp:68
Definition: FlowLinearSolverParameters.hpp:132
Definition: FlowLinearSolverParameters.hpp:92
Definition: FlowLinearSolverParameters.hpp:96
Definition: FlowLinearSolverParameters.hpp:41
Definition: FlowLinearSolverParameters.hpp:80