Update convergence criterion for MLMG #6408
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.
In #2410, the convergence criterion of the MLMG solver was modified so as to use the norm of
b(whenever|b|is not zero), to evaluate the relative error in the Poisson equation (written asAx = b) and decide when to stop the iterations.However, there are cases where this it not suitable. A typical case is when the user fixes a large value of the potential at the boundaries (or on the embedded boundary), and also has a very low-charge beam in the simulation. In this case, the residual is dominated by the potential created by the boundaries, but the norm of
b(which depends on the charge density of the beam) is very low, resulting in a largeresid/bnorm. In some cases, this largeresid/bnormcan even trigger the errorMLMG failing so lets stop herebecause of this check in AMREX:https://github.com/AMReX-Codes/amrex/blob/development/Src/LinearSolvers/MLMG/AMReX_MLMG.H#L539
Instead, with this PR, we always use the maximum of the norm of
band of the initial residualresid0to evaluate the relative error in the Poisson equation - instead of using directly the maximum of the norm ofb.I also checked that this fixes the issue mentioned here: #6161 (comment)
The changes in the checksum is because of the change in convergence criterion.