Skip to content

Commit

Permalink
explicitly set beta = 0 on first iter
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Sep 18, 2024
1 parent 507cbd3 commit 38543b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/solvers/cg_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class CGSolver {
auto correct_p = itl.AddTask(
get_ru, "p <- u + beta p",
[](CGSolver *solver, std::shared_ptr<MeshData<Real>> &md) {
Real beta = solver->ru.val / solver->ru_old;
Real beta = solver->iter_counter > 0 ? solver->ru.val / solver->ru_old : 0.0;
return AddFieldsAndStore<u, p, p>(md, 1.0, beta);
},
this, md);
Expand Down

0 comments on commit 38543b0

Please sign in to comment.