Skip to content

Add Root-Node AMG#130

Draft
termi-official wants to merge 2 commits into
masterfrom
do/root-node-amg
Draft

Add Root-Node AMG#130
termi-official wants to merge 2 commits into
masterfrom
do/root-node-amg

Conversation

@termi-official
Copy link
Copy Markdown
Collaborator

This essentially combines RS and SA AMG. Resolves #126 .

@termi-official
Copy link
Copy Markdown
Collaborator Author

Ready for review @Abdelrahman912

Comment thread src/rootnode.jl
Comment on lines +156 to +169
for i = 1:n
splitting[i] == C_NODE && continue
best_val = zero(Tv)
best_agg = zero(Ti)
for j in nzrange(S, i)
row = S.rowval[j]
val = S.nzval[j]
if splitting[row] == C_NODE && val > best_val
best_val = val
best_agg = c_map[row]
end
end
aggregate[i] = best_agg
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correct me if I am wrong, but as I understand aggregate vector can have nodes wo any aggregate assigned to them, leaving their value zero (i.e., orphan), right?
If that's the case, two hotfixes can be done, we can do second pass but loosening the threshold a bit over these orphan nodes, or just output some warning that some nodes aren't assigned to an aggregate.

Comment thread src/rootnode.jl
Comment on lines +33 to +34
n = size(A, 1)
D_inv_S = weight(LocalWeighting(), A, omega)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In D_inv_S = weight(LocalWeighting(), A, omega) This should be S right ? otherwise it's not used ?

Comment thread src/rootnode.jl
Comment on lines +15 to +18
function (ep::EnergyProlongation)(A, T, S, B, splitting, c_map)
energy_prolongation_smoother(A, T, S, splitting;
maxiter=ep.maxiter, omega=ep.omega)
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

B and c_map are never used.

Comment thread test/nns_test.jl
println("No NNS: final residual at iteration ", length(residuals_wonns), ": ", residuals_wonns[end])
println("With NNS: final residual at iteration ", length(residuals_nns), ": ", residuals_nns[end])

x_nns, residuals_nns = solve(A, b, RootNodeAMG(); aggregate=StandardAggregation(), log=true, reltol=1e-10, B=B, max_levels=2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you can remove aggregate=StandardAggregation() as root_node_amg doesn't have aggregate as kwargs

Comment thread src/precs.jl
"""
RootNodePreconBuilder(;blocksize=1, kwargs...)

Return callable object constructing a left algebraic multigrid preconditioner after Ruge & Stüben
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

copy-pasta here for Ruge & Stüben 😆

@termi-official termi-official marked this pull request as draft May 15, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add root-node AMG

2 participants