ExaDG
Loading...
Searching...
No Matches
solver_data.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef EXADG_SOLVERS_AND_PRECONDITIONERS_SOLVERS_SOLVER_DATA_H_
23#define EXADG_SOLVERS_AND_PRECONDITIONERS_SOLVERS_SOLVER_DATA_H_
24
25// deal.II
26#include <deal.II/base/conditional_ostream.h>
27
28// ExaDG
29#include <exadg/utilities/print_functions.h>
30
31namespace ExaDG
32{
33struct SolverData
34{
35 SolverData() : max_iter(1e3), abs_tol(1e-20), rel_tol(1e-6), max_krylov_size(30)
36 {
37 }
38
39 SolverData(unsigned int const max_iter_in,
40 double const abs_tol_in,
41 double const rel_tol_in,
42 unsigned int const max_krylov_size_in = 30)
43 : max_iter(max_iter_in),
44 abs_tol(abs_tol_in),
45 rel_tol(rel_tol_in),
46 max_krylov_size(max_krylov_size_in)
47 {
48 }
49
50 void
51 print(dealii::ConditionalOStream const & pcout) const
52 {
53 print_parameter(pcout, "Maximum number of iterations", max_iter);
54 print_parameter(pcout, "Absolute solver tolerance", abs_tol);
55 print_parameter(pcout, "Relative solver tolerance", rel_tol);
56 print_parameter(pcout, "Maximum size of Krylov space", max_krylov_size);
57 }
58
59 unsigned int max_iter;
60 double abs_tol;
61 double rel_tol;
62 // only relevant for GMRES type solvers
63 unsigned int max_krylov_size;
64};
65
66// `SolverData` structs for deal.II wrapper classes
67namespace Krylov
68{
69struct SolverDataCG
70{
71 SolverDataCG()
72 : max_iter(1e4),
73 solver_tolerance_abs(1.e-20),
74 solver_tolerance_rel(1.e-6),
75 use_preconditioner(false),
76 compute_performance_metrics(false)
77 {
78 }
79
80 unsigned int max_iter;
81 double solver_tolerance_abs;
82 double solver_tolerance_rel;
83 bool use_preconditioner;
84 bool compute_performance_metrics;
85};
86
87struct SolverDataGMRES
88{
89 SolverDataGMRES()
90 : max_iter(1e4),
91 solver_tolerance_abs(1.e-20),
92 solver_tolerance_rel(1.e-6),
93 use_preconditioner(false),
94 max_n_tmp_vectors(30),
95 compute_eigenvalues(false),
96 compute_performance_metrics(false)
97 {
98 }
99
100 unsigned int max_iter;
101 double solver_tolerance_abs;
102 double solver_tolerance_rel;
103 bool use_preconditioner;
104 unsigned int max_n_tmp_vectors;
105 bool compute_eigenvalues;
106 bool compute_performance_metrics;
107};
108
109struct SolverDataFGMRES
110{
111 SolverDataFGMRES()
112 : max_iter(1e4),
113 solver_tolerance_abs(1.e-20),
114 solver_tolerance_rel(1.e-6),
115 use_preconditioner(false),
116 max_n_tmp_vectors(30),
117 compute_performance_metrics(false)
118 {
119 }
120
121 unsigned int max_iter;
122 double solver_tolerance_abs;
123 double solver_tolerance_rel;
124 bool use_preconditioner;
125 unsigned int max_n_tmp_vectors;
126 bool compute_performance_metrics;
127};
128
129} // namespace Krylov
130} // namespace ExaDG
131
132#endif /* EXADG_SOLVERS_AND_PRECONDITIONERS_SOLVERS_SOLVER_DATA_H_ */
Definition driver.cpp:33