24
24
#include < AMReX_PlotFileUtil.H>
25
25
#include < AMReX_MultiFabUtil.H>
26
26
#include < AMReX_MLMG.H>
27
+ #include < AMReX_GMRES_MLMG.H>
27
28
28
29
#include " Poisson.H"
29
30
@@ -37,6 +38,7 @@ int main (int argc, char* argv[])
37
38
int verbose = 1 ;
38
39
int n_cell = 128 ;
39
40
int max_grid_size = 32 ;
41
+ int use_GMRES = 0 ;
40
42
amrex::Vector<int > n_cell_2d;
41
43
// read parameters
42
44
{
@@ -45,6 +47,7 @@ int main (int argc, char* argv[])
45
47
// pp.query("n_cell", n_cell);
46
48
pp.queryarr (" n_cell" , n_cell_2d);
47
49
pp.query (" max_grid_size" , max_grid_size);
50
+ pp.query (" use_GMRES" ,use_GMRES);
48
51
}
49
52
50
53
Geometry geom;
@@ -158,7 +161,16 @@ int main (int argc, char* argv[])
158
161
159
162
// Solve linear system
160
163
phi.setVal (0.0 ); // initial guess for phi
161
- mlmg.solve ({&phi}, {&q}, tol_rel, tol_abs);
164
+
165
+ if (use_GMRES) {
166
+ amrex::GMRESMLMG gmsolve (mlmg);
167
+ gmsolve.solve (phi, q, tol_rel, tol_abs);
168
+ amrex::Vector<amrex::MultiFab> vmf;
169
+ vmf.emplace_back (phi, amrex::make_alias, 0 , phi.nComp ());
170
+ linop.postSolve (vmf);
171
+ } else {
172
+ mlmg.solve ({&phi}, {&q}, tol_rel, tol_abs);
173
+ }
162
174
163
175
// // store plotfile variables; q and phi
164
176
MultiFab plotfile_mf (grids, dmap, 2 , 0 , MFInfo (), factory);
0 commit comments