Skip to content

Commit

Permalink
solve_bicgstab: use linop.make instead of MF constructor (#3619)
Browse files Browse the repository at this point in the history
## Summary

This PR replaces the explicit use of MF constructors in
```MLCGSolverT<MF>::solve_bicgstab``` with calls to the `make` method of
the linear operator associated with the MLCGSolverT object.

## Additional background

The use of `MLLinOpT<MF>::make` allows for inheritance of MLCGSolverT
without an override of `solve_bicgstab` even if the MF class lacks a
constructor with the same arguments as those MultiFab. For the MLMG
template classes, `make` should generally be used instead of explicit MF
constructors. Another PR to change this in `solve_cg` will follow once
this is fully vetted and approved.
  • Loading branch information
eebasso authored Nov 13, 2023
1 parent d364631 commit 6e2b831
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,18 @@ MLCGSolverT<MF>::solve_bicgstab (MF& sol, const MF& rhs, RT eps_rel, RT eps_abs)

const int ncomp = sol.nComp();

const BoxArray& ba = sol.boxArray();
const DistributionMapping& dm = sol.DistributionMap();
const auto& factory = sol.Factory();

MF ph(ba, dm, ncomp, sol.nGrowVect(), MFInfo(), factory);
MF sh(ba, dm, ncomp, sol.nGrowVect(), MFInfo(), factory);
MF ph = Lp.make(amrlev, mglev, sol.nGrowVect());
MF sh = Lp.make(amrlev, mglev, sol.nGrowVect());
ph.setVal(RT(0.0));
sh.setVal(RT(0.0));

MF sorig(ba, dm, ncomp, nghost, MFInfo(), factory);
MF p (ba, dm, ncomp, nghost, MFInfo(), factory);
MF r (ba, dm, ncomp, nghost, MFInfo(), factory);
MF s (ba, dm, ncomp, nghost, MFInfo(), factory);
MF rh (ba, dm, ncomp, nghost, MFInfo(), factory);
MF v (ba, dm, ncomp, nghost, MFInfo(), factory);
MF t (ba, dm, ncomp, nghost, MFInfo(), factory);
MF sorig = Lp.make(amrlev, mglev, nghost);
MF p = Lp.make(amrlev, mglev, nghost);
MF r = Lp.make(amrlev, mglev, nghost);
MF s = Lp.make(amrlev, mglev, nghost);
MF rh = Lp.make(amrlev, mglev, nghost);
MF v = Lp.make(amrlev, mglev, nghost);
MF t = Lp.make(amrlev, mglev, nghost);

Lp.correctionResidual(amrlev, mglev, r, sol, rhs, MLLinOpT<MF>::BCMode::Homogeneous);

Expand Down

0 comments on commit 6e2b831

Please sign in to comment.