Skip to content

Commit 1dd9b6f

Browse files
committed
preconditioner control
1 parent 4a1dcaa commit 1dd9b6f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

ExampleCodes/LinearSolvers/GMRES/Poisson/AMReX_GMRES_Poisson.H

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace amrex {
99

1010
/**
11-
* \brief Solve Poisson's equation using unpreconditioned GMRES
11+
* \brief Solve Poisson's equation using amrex GMRES class
1212
*/
1313
class GMRESPOISSON
1414
{
@@ -71,7 +71,7 @@ private:
7171
BoxArray m_ba;
7272
DistributionMapping m_dm;
7373
Geometry m_geom;
74-
bool m_use_precond = false;
74+
bool m_use_precond;
7575

7676
// store the original RHS needed for Jacobi preconditioner
7777
MultiFab orig_rhs;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
n_cell = 32
22
max_grid_size = 16
3+
4+
use_precond = 0

ExampleCodes/LinearSolvers/GMRES/Poisson/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ int main (int argc, char* argv[])
2222
// size of each box (or grid)
2323
int max_grid_size;
2424

25+
// use preconditioner?
26+
int use_precond;
27+
2528
// **********************************
2629
// READ PARAMETER VALUES FROM INPUT DATA
2730
// **********************************
@@ -38,6 +41,9 @@ int main (int argc, char* argv[])
3841

3942
// The domain is broken into boxes of size max_grid_size
4043
pp.get("max_grid_size",max_grid_size);
44+
45+
use_precond = 0;
46+
pp.query("use_precond",use_precond);
4147
}
4248

4349
// **********************************
@@ -111,6 +117,7 @@ int main (int argc, char* argv[])
111117
// initial guess
112118
phi.setVal(0.);
113119

120+
gmres_poisson.usePrecond(use_precond);
114121
gmres_poisson.setVerbose(2);
115122
gmres_poisson.solve(phi, rhs, 1.e-12, 0.);
116123

0 commit comments

Comments
 (0)