Skip to content

CERBSim/ngs_amgcl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NGSolve-AMGCL

An NGSolve addon providing algebraic multigrid preconditioning via AMGCL.

Features

  • AMG preconditioner for NGSolve sparse matrices
  • Shared memory parallelism (OpenMP)
  • Multiple coarsening strategies: smoothed aggregation, Ruge-Stuben
  • Multiple relaxation schemes: SPAI-0, Gauss-Seidel, ILU0, damped Jacobi
  • Seamless integration with NGSolve iterative solvers

Installation

Quick install

pip install git+https://github.com/cerbsim/ngs_amgcl.git

Step-by-step (for self-compiled NGSolve)

git clone --recursive https://github.com/cerbsim/ngs_amgcl.git
cd ngs_amgcl
pip install --no-build-isolation .

Manual CMake build

git clone --recursive https://github.com/cerbsim/ngs_amgcl.git
cd ngs_amgcl
mkdir build && cd build
cmake ..
make -j4 install

Usage

from ngsolve import *
import ngsolve_amgcl

# ... set up mesh, FESpace, BilinearForm a ...

# Configure AMGCL options
opts = ngsolve_amgcl.AMGCLOptions()
opts.coarsening = "smoothed_aggregation"
opts.relaxation = "spai0"

# Create preconditioner
pre = ngsolve_amgcl.AMGCLPreconditioner(a.mat, fes.FreeDofs(), opts)

# Use in a CG solver
from ngsolve.krylovspace import CGSolver
inv = CGSolver(mat=a.mat, pre=pre, printrates=True, tol=1e-8)
gfu.vec.data = inv * f.vec

Supported Options

Coarsening strategies

  • "smoothed_aggregation" (default)
  • "ruge_stuben"

Relaxation schemes

  • "spai0" (default) - Sparse Approximate Inverse
  • "gauss_seidel" - Gauss-Seidel
  • "ilu0" - Incomplete LU factorization
  • "damped_jacobi" - Damped Jacobi

License

MIT

About

Wrapper for AMGCL to be used within NGSolve

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors