Skip to content

Commit

Permalink
solve_bicgstab: eliminate use of rho_1
Browse files Browse the repository at this point in the history
  • Loading branch information
eebasso committed Nov 13, 2023
1 parent d364631 commit 2b427df
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ MLCGSolverT<MF>::solve_bicgstab (MF& sol, const MF& rhs, RT eps_rel, RT eps_abs)
}
int ret = 0;
iter = 1;
RT rho_1 = 0, alpha = 0, omega = 0;
RT rhTv = RT(0.0), alpha = RT(0.0), omega = RT(0.0);

if ( rnorm0 == 0 || rnorm0 < eps_abs )
{
Expand All @@ -152,15 +152,15 @@ MLCGSolverT<MF>::solve_bicgstab (MF& sol, const MF& rhs, RT eps_rel, RT eps_abs)
}
else
{
const RT beta = (rho/rho_1)*(alpha/omega);
const RT beta = rho/(rhTv*omega);
MF::Saxpy(p, -omega, v, 0, 0, ncomp, nghost); // p += -omega*v
MF::Xpay(p, beta, r, 0, 0, ncomp, nghost); // p = r + beta*p
}
ph.LocalCopy(p,0,0,ncomp,nghost);
Lp.apply(amrlev, mglev, v, ph, MLLinOpT<MF>::BCMode::Homogeneous, MLLinOpT<MF>::StateMode::Correction);
Lp.normalize(amrlev, mglev, v);

RT rhTv = dotxy(rh,v);
rhTv = dotxy(rh,v);
if ( rhTv != RT(0.0) )
{
alpha = rho/rhTv;
Expand Down Expand Up @@ -225,7 +225,6 @@ MLCGSolverT<MF>::solve_bicgstab (MF& sol, const MF& rhs, RT eps_rel, RT eps_abs)
{
ret = 4; break;
}
rho_1 = rho;
}

if ( verbose > 0 )
Expand Down

0 comments on commit 2b427df

Please sign in to comment.