Skip to content

Commit

Permalink
preconditioner control
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnonaka committed Nov 27, 2024
1 parent 4a1dcaa commit 1dd9b6f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace amrex {

/**
* \brief Solve Poisson's equation using unpreconditioned GMRES
* \brief Solve Poisson's equation using amrex GMRES class
*/
class GMRESPOISSON
{
Expand Down Expand Up @@ -71,7 +71,7 @@ private:
BoxArray m_ba;
DistributionMapping m_dm;
Geometry m_geom;
bool m_use_precond = false;
bool m_use_precond;

// store the original RHS needed for Jacobi preconditioner
MultiFab orig_rhs;
Expand Down
2 changes: 2 additions & 0 deletions ExampleCodes/LinearSolvers/GMRES/Poisson/inputs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
n_cell = 32
max_grid_size = 16

use_precond = 0
7 changes: 7 additions & 0 deletions ExampleCodes/LinearSolvers/GMRES/Poisson/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ int main (int argc, char* argv[])
// size of each box (or grid)
int max_grid_size;

// use preconditioner?
int use_precond;

// **********************************
// READ PARAMETER VALUES FROM INPUT DATA
// **********************************
Expand All @@ -38,6 +41,9 @@ int main (int argc, char* argv[])

// The domain is broken into boxes of size max_grid_size
pp.get("max_grid_size",max_grid_size);

use_precond = 0;
pp.query("use_precond",use_precond);
}

// **********************************
Expand Down Expand Up @@ -111,6 +117,7 @@ int main (int argc, char* argv[])
// initial guess
phi.setVal(0.);

gmres_poisson.usePrecond(use_precond);
gmres_poisson.setVerbose(2);
gmres_poisson.solve(phi, rhs, 1.e-12, 0.);

Expand Down

0 comments on commit 1dd9b6f

Please sign in to comment.