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>
137 using type = GetPropType<TypeTag, Scalar>;
138 static constexpr type value = 1e-2;
140template<
class TypeTag>
142 using type = GetPropType<TypeTag, Scalar>;
143 static constexpr type value = 0.9;
145template<
class TypeTag>
147 static constexpr int value = 200;
149template<
class TypeTag>
151 static constexpr int value = 40;
153template<
class TypeTag>
154struct LinearSolverVerbosity<TypeTag, TTag::FlowIstlSolverParams> {
155 static constexpr int value = 0;
157template<
class TypeTag>
159 static constexpr int value = 0;
161template<
class TypeTag>
163 static constexpr auto value =
"ILU";
165template<
class TypeTag>
167 static constexpr bool value =
false;
169template<
class TypeTag>
171 static constexpr bool value =
false;
173template<
class TypeTag>
174struct UseGmres<TypeTag, TTag::FlowIstlSolverParams> {
175 static constexpr bool value =
false;
177template<
class TypeTag>
179 static constexpr bool value =
false;
181template<
class TypeTag>
182struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams> {
185template<
class TypeTag>
187 static constexpr bool value =
false;
189template<
class TypeTag>
191 static constexpr bool value =
false;
193template<
class TypeTag>
195 static constexpr int value = 20;
197template<
class TypeTag>
199 static constexpr int value = 0;
201template<
class TypeTag>
203 static constexpr int value = 3;
205template<
class TypeTag>
207 static constexpr int value = 10;
209template<
class TypeTag>
211 static constexpr auto value =
"ilu0";
213template<
class TypeTag>
215 static constexpr auto value =
"none";
217template<
class TypeTag>
219 static constexpr int value = 0;
221template<
class TypeTag>
223 static constexpr int value = 0;
225template<
class TypeTag>
227 static constexpr auto value =
"";
229template<
class TypeTag>
231 static constexpr auto value =
"";
243 double linear_solver_reduction_;
244 double ilu_relaxation_;
245 int linear_solver_maxiter_;
246 int linear_solver_restart_;
247 int linear_solver_verbosity_;
248 int ilu_fillin_level_;
251 bool ilu_reorder_sphere_;
252 bool newton_use_gmres_;
253 bool require_full_sparsity_pattern_;
254 bool ignoreConvergenceFailure_;
255 bool scale_linear_system_;
256 std::string linsolver_;
257 std::string accelerator_mode_;
259 int opencl_platform_id_;
260 int cpr_max_ell_iter_;
261 int cpr_reuse_setup_;
262 int cpr_reuse_interval_;
263 std::string opencl_ilu_reorder_;
264 std::string fpga_bitstream_;
266 template <
class TypeTag>
270 linear_solver_reduction_ = EWOMS_GET_PARAM(TypeTag,
double, LinearSolverReduction);
271 ilu_relaxation_ = EWOMS_GET_PARAM(TypeTag,
double, IluRelaxation);
272 linear_solver_maxiter_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverMaxIter);
273 linear_solver_restart_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverRestart);
274 linear_solver_verbosity_ = EWOMS_GET_PARAM(TypeTag,
int, LinearSolverVerbosity);
275 ilu_fillin_level_ = EWOMS_GET_PARAM(TypeTag,
int, IluFillinLevel);
276 ilu_milu_ = convertString2Milu(EWOMS_GET_PARAM(TypeTag, std::string, MiluVariant));
277 ilu_redblack_ = EWOMS_GET_PARAM(TypeTag,
bool, IluRedblack);
278 ilu_reorder_sphere_ = EWOMS_GET_PARAM(TypeTag,
bool, IluReorderSpheres);
279 newton_use_gmres_ = EWOMS_GET_PARAM(TypeTag,
bool, UseGmres);
280 ignoreConvergenceFailure_ = EWOMS_GET_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure);
281 scale_linear_system_ = EWOMS_GET_PARAM(TypeTag,
bool, ScaleLinearSystem);
282 cpr_max_ell_iter_ = EWOMS_GET_PARAM(TypeTag,
int, CprMaxEllIter);
283 cpr_reuse_setup_ = EWOMS_GET_PARAM(TypeTag,
int, CprReuseSetup);
284 cpr_reuse_interval_ = EWOMS_GET_PARAM(TypeTag,
int, CprReuseInterval);
285 linsolver_ = EWOMS_GET_PARAM(TypeTag, std::string, LinearSolver);
286 accelerator_mode_ = EWOMS_GET_PARAM(TypeTag, std::string, AcceleratorMode);
287 bda_device_id_ = EWOMS_GET_PARAM(TypeTag,
int, BdaDeviceId);
288 opencl_platform_id_ = EWOMS_GET_PARAM(TypeTag,
int, OpenclPlatformId);
289 opencl_ilu_reorder_ = EWOMS_GET_PARAM(TypeTag, std::string, OpenclIluReorder);
290 fpga_bitstream_ = EWOMS_GET_PARAM(TypeTag, std::string, FpgaBitstream);
293 template <
class TypeTag>
294 static void registerParameters()
296 EWOMS_REGISTER_PARAM(TypeTag,
double, LinearSolverReduction,
"The minimum reduction of the residual which the linear solver must achieve");
297 EWOMS_REGISTER_PARAM(TypeTag,
double, IluRelaxation,
"The relaxation factor of the linear solver's ILU preconditioner");
298 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverMaxIter,
"The maximum number of iterations of the linear solver");
299 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverRestart,
"The number of iterations after which GMRES is restarted");
300 EWOMS_REGISTER_PARAM(TypeTag,
int, LinearSolverVerbosity,
"The verbosity level of the linear solver (0: off, 2: all)");
301 EWOMS_REGISTER_PARAM(TypeTag,
int, IluFillinLevel,
"The fill-in level of the linear solver's ILU preconditioner");
302 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");
303 EWOMS_REGISTER_PARAM(TypeTag,
bool, IluRedblack,
"Use red-black partitioning for the ILU preconditioner");
304 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).");
305 EWOMS_REGISTER_PARAM(TypeTag,
bool, UseGmres,
"Use GMRES as the linear solver");
306 EWOMS_REGISTER_PARAM(TypeTag,
bool, LinearSolverIgnoreConvergenceFailure,
"Continue with the simulation like nothing happened after the linear solver did not converge");
307 EWOMS_REGISTER_PARAM(TypeTag,
bool, ScaleLinearSystem,
"Scale linear system according to equation scale and primary variable types");
308 EWOMS_REGISTER_PARAM(TypeTag,
int, CprMaxEllIter,
"MaxIterations of the elliptic pressure part of the cpr solver");
309 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");
310 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.");
311 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.'");
312 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]'");
313 EWOMS_REGISTER_PARAM(TypeTag,
int, BdaDeviceId,
"Choose device ID for cusparseSolver or openclSolver, use 'nvidia-smi' or 'clinfo' to determine valid IDs");
314 EWOMS_REGISTER_PARAM(TypeTag,
int, OpenclPlatformId,
"Choose platform ID for openclSolver, use 'clinfo' to determine valid platform IDs");
315 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.");
316 EWOMS_REGISTER_PARAM(TypeTag, std::string, FpgaBitstream,
"Specify the bitstream file for fpgaSolver (including path), usage: '--fpga-bitstream=<filename>'");
324 newton_use_gmres_ =
false;
325 linear_solver_reduction_ = 1e-2;
326 linear_solver_maxiter_ = 150;
327 linear_solver_restart_ = 40;
328 linear_solver_verbosity_ = 0;
329 require_full_sparsity_pattern_ =
false;
330 ignoreConvergenceFailure_ =
false;
331 ilu_fillin_level_ = 0;
332 ilu_relaxation_ = 0.9;
334 ilu_redblack_ =
false;
335 ilu_reorder_sphere_ =
true;
336 accelerator_mode_ =
"none";
338 opencl_platform_id_ = 0;
339 opencl_ilu_reorder_ =
"";
340 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:242
Definition: FlowLinearSolverParameters.hpp:116
Definition: FlowLinearSolverParameters.hpp:120
Definition: FlowLinearSolverParameters.hpp:100
Definition: FlowLinearSolverParameters.hpp:96
Definition: FlowLinearSolverParameters.hpp:108
Definition: FlowLinearSolverParameters.hpp:104
Definition: FlowLinearSolverParameters.hpp:132
Definition: FlowLinearSolverParameters.hpp:64
Definition: FlowLinearSolverParameters.hpp:72
Definition: FlowLinearSolverParameters.hpp:49
Definition: FlowLinearSolverParameters.hpp:76
Definition: FlowLinearSolverParameters.hpp:84
Definition: FlowLinearSolverParameters.hpp:53
Definition: FlowLinearSolverParameters.hpp:45
Definition: FlowLinearSolverParameters.hpp:57
Definition: FlowLinearSolverParameters.hpp:112
Definition: FlowLinearSolverParameters.hpp:68
Definition: FlowLinearSolverParameters.hpp:128
Definition: FlowLinearSolverParameters.hpp:88
Definition: FlowLinearSolverParameters.hpp:92
Definition: FlowLinearSolverParameters.hpp:41
Definition: FlowLinearSolverParameters.hpp:80