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

probable bug in AMLI cycle #362

Open
bensworth opened this issue Dec 5, 2022 · 0 comments
Open

probable bug in AMLI cycle #362

bensworth opened this issue Dec 5, 2022 · 0 comments
Labels

Comments

@bensworth
Copy link
Collaborator

bensworth commented Dec 5, 2022

So pairwise aggregation is typically used with an AMLI/K-cycle. I tested the pairwise method without Krylov on 100x100 Poisson and get junk with the AMLI cycle. Below code and output for reproducibility. I have not looked into the AMLI code, but its convergence on isotropic Poisson is definitely suspicious.

import numpy as np
from pyamg.gallery import poisson
from pyamg.aggregation.pairwise import pairwise_solver

A = poisson((100,), format='csr')
smooth = ('gauss_seidel',{'sweep': 'symmetric'})
ml = pairwise_solver(A, strength='classical', presmoother=smooth, postsmoother=smooth)
x = np.random.rand(A.shape[0])
b = A * np.random.rand(A.shape[0])

res = []
x_sol = ml.solve(b, x0=x, maxiter=200, tol=1e-10, cycle='AMLI', residuals=res)
amli_cf = (res[-1] / res[0]) ** (1.0 / (len(res)-1))
res = []
x_sol = ml.solve(b, x0=x, maxiter=200, tol=1e-10, cycle='V', residuals=res)
v_cf = (res[-1] / res[0]) ** (1.0 / (len(res)-1))
res = []
x_sol = ml.solve(b, x0=x, maxiter=200, tol=1e-10, cycle='W', residuals=res)
w_cf = (res[-1] / res[0]) ** (1.0 / (len(res)-1))
res = []
x_sol = ml.solve(b, x0=x, maxiter=200, tol=1e-10, cycle='F', residuals=res)
f_cf = (res[-1] / res[0]) ** (1.0 / (len(res)-1))
print([v_cf, f_cf, w_cf, amli_cf])

Output: [V-cycle, F-cycle, W-cycle, AMLI-cycle]:

[0.8243799083973229, 0.6059711859082966, 0.5148452009914897, 0.94009796522041]

If I add CG acceleration (which may or may not make sense with an AMLI cycle, but nevertheless):

[0.28781331076950806, 0.2477191250020367, 0.20878133901435386, 0.94009796522041]
@bensworth bensworth added the bug label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant