update multigrid usage in test/mpi/solver #1737
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR change the multigrid preconditioner setting in the test/mpi/solver
The original preconditioner criterion also check the absolute residual norm.
However, it will lead no update on the result from preconditioner when it meets the criterion already with initial input.
It makes the all thing stays the same in Cg from that point.
Thus, the previous CgWithMg will run until reaching iteration limit, which leads long time execution
It use the syntex from wiki cg
Assume the following$z_2$ is equal to $z_1$ when $z_1$ is initial guess and meet the criterion
$Mz_2 = r_2$
$\beta_1 = \frac{r_2'z_2}{r_1'z_1}$
$r_2'z_2 = (r_1-\alpha A p_1)'z_1 = r_1'z_1 - \frac{r_1'z_1}{p_1'Ap_1}(Ap_1)'z_1$
$= r_1'z_1 - \frac{r_1'z_1}{p_1'A(z_1+\beta_0p_0)}(p_1'A'z_1)$
Thus, we get it to
Other than this, I also delete the unused part which is mentioned in #1736