PCG-AMG Example Codes

Example 5

This example solves the 2-D Laplacian problem with zero boundary conditions on an nxn grid. The number of unknowns is N=n^2. The standard 5-point stencil is used, and we solve for the interior nodes only.

This example solves the same problem as Example 3. Available solvers are AMG, PCG, PCG with AMG or Parasails preconditioners, or Flexible GMRES with AMG preconditioner.

Example 10

This code solves a system corresponding to a discretization of the Laplace equation with zero boundary conditions on the unit square. The domain is split into a n x n grid of quadrilateral elements and each processors owns a horizontal strip of size m x n, where m = n/nprocs. We use bilinear finite element discretization, so there are nodes (vertices) that are shared between neighboring processors. The Finite Element Interface is used to assemble the matrix and solve the problem. Nine different solvers are available.

Example 12

The grid layout is the same as ex1, but with nodal unknowns. The solver is PCG preconditioned with either PFMG or BoomerAMG, selected on the command line.

We recommend viewing the Struct examples before viewing this and the other SStruct examples. This is one of the simplest SStruct examples, used primarily to demonstrate how to set up non-cell-centered problems, and to demonstrate how easy it is to switch between structured solvers (PFMG) and solvers designed for more general settings (AMG).