Skip to content

Conversation

@RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Nov 19, 2025

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 as Ax = 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 large resid/bnorm. In some cases, this large resid/bnorm can even trigger the error MLMG failing so lets stop here because 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 b and of the initial residual resid0 to evaluate the relative error in the Poisson equation - instead of using directly the maximum of the norm of b.

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.

@RemiLehe RemiLehe changed the title [WIP] Update convergence criterion for MLMG Update convergence criterion for MLMG Nov 19, 2025
@RemiLehe RemiLehe force-pushed the fix_mlmg_converge_criterion branch from f553ba7 to 6fd43f2 Compare November 20, 2025 00:06
#if (defined(ABLASTR_USE_FFT) && defined(WARPX_DIM_3D))
// determine if rho is zero everywhere
const amrex::Real max_norm_b = getMaxNormRho(
amrex::GetVecOfConstPtrs(rho), finest_level, absolute_tolerance);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I move the calculation of max_norm_b here, because it is still used by the FFT solver.

@roelof-groenewald roelof-groenewald merged commit 94bd1ab into BLAST-WarpX:development Nov 24, 2025
50 checks passed
@ax3l ax3l added bug Something isn't working component: electrostatic electrostatic solver bug: affects latest release Bug also exists in latest release version labels Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug: affects latest release Bug also exists in latest release version bug Something isn't working component: electrostatic electrostatic solver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants