Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex-valued operators for multigrid preconditioning #87

Merged
merged 5 commits into from
Aug 23, 2023

Conversation

sebastiangrimberg
Copy link
Contributor

@sebastiangrimberg sebastiangrimberg commented Aug 22, 2023

This PR adds the capability, based on #47, to precondition complex-valued linear systems using multigrid based on the actual complex-valued system matrix, rather than its real-valued approximation as is currently implemented. This is possible for the fine level smoothers, not the coarse-level solve, which still always uses the real-valued approximation. Reverting to the previous behavior is controlled with the PCMatReal configuration file parameter.

This has positive effects on convergence in my testing, reducing iteration counts by ~2x in some cases. This is not for free: The smoother application is now twice as expensive roughly since we are performing matrix-vector products with a complex-valued operator instead of a real one. However, especially in the case where the coarse solver dominates the multigrid V-cycle cost, this can lead to big cost savings.

Another positive benefit is this preconditioning strategy appears to lead to much more accurate repeated linear solves. For the cavity example with impedance BC, here are the first 5 modes with a real-valued preconditioner matrix:

 m     Re{ω}/2π (GHz)     Im{ω}/2π (GHz)        Bkwd. Error         Abs. Error
==============================================================================
 1      +2.904507e+00      +7.086023e-04      +2.453159e-10      +1.766090e-05
 2      +2.922516e+00      +7.051646e-04      +3.229538e-10      +2.339414e-05
 3      +2.922529e+00      +7.051718e-04      +4.048642e-10      +2.932770e-05
 4      +3.468922e+00      +8.640178e-04      +4.039384e-10      +3.472130e-05
 5      +4.147609e+00      +9.784805e-04      +3.396857e-10      +3.490230e-05

And with this PR:

 m     Re{ω}/2π (GHz)     Im{ω}/2π (GHz)        Bkwd. Error         Abs. Error
==============================================================================
 1      +2.904507e+00      +7.086037e-04      +2.048618e-13      +1.474851e-08
 2      +2.922516e+00      +7.051671e-04      +2.043630e-13      +1.480366e-08
 3      +2.922529e+00      +7.051734e-04      +2.160061e-13      +1.564713e-08
 4      +3.468922e+00      +8.640203e-04      +3.551412e-13      +3.052685e-08
 5      +4.147609e+00      +9.784829e-04      +3.932118e-11      +4.040205e-06

The total number of linear solver iterations decreased from 1276 to 745.

Another feature added inthis PR is control over the Chebyshev polynomial smoother implementation, allowing users to pick from the standard smoother based on Chebyshev polynomials for the 1st-kind versus the newer 4th-kind variant (see Phillips and Fischer, Optimal Chebyshev smoothers and one-sided V-cycles (2022)). Eigenvalue estimates are also now controlled by parameters which can be modified in the configuration file, which is helpful for debugging.

@sebastiangrimberg sebastiangrimberg added the enhancement New feature or request label Aug 22, 2023
@sebastiangrimberg sebastiangrimberg marked this pull request as ready for review August 23, 2023 00:24
@sebastiangrimberg sebastiangrimberg marked this pull request as draft August 23, 2023 01:47
Initial testing shows the expected 2x improvement in number of iterations, where each iteration now doubles in cost at the fine levels due to complex-valued MVP instead of real-valued. However, for expensive coarse solves, this is a substantial improvement and speedups look to be 25% on cavity example. Also adds back Chebyshev smoothing based on the standard 1st-kind polynomials, with runtime options for configuring which variant and the associated tolerances."
@sebastiangrimberg sebastiangrimberg force-pushed the sjg/complex-preconditioning-dev branch 2 times, most recently from 8784cba to a679414 Compare August 23, 2023 02:52
@sebastiangrimberg sebastiangrimberg marked this pull request as ready for review August 23, 2023 02:54
palace/models/spaceoperator.cpp Show resolved Hide resolved
@sebastiangrimberg sebastiangrimberg merged commit e7845f9 into main Aug 23, 2023
17 checks passed
@sebastiangrimberg sebastiangrimberg deleted the sjg/complex-preconditioning-dev branch August 23, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants