[petsc-users] Example for GAMG

Jed Brown jedbrown at mcs.anl.gov
Wed Jul 3 10:11:03 CDT 2013


Tabrez Ali <stali at geology.wisc.edu> writes:

> Hello
>
> Is there a PETSc example that really demonstrates the advantage of using 
> a multigrid solver (in that that the number of iterations are relatively 
> constant as the problem size increases)?

src/ksp/ksp/examples/tutorials/ex56.c is a 3D elasticity example that we
have used to test performance, but you should be able to see the
behavior on pretty much any elliptic problem.  You can see command-line
options with 'make -n runex56'.  There are a number of other GAMG tests.

This is src/snes/examples/tutorials/ex5.c:

$ ./ex5 -da_refine 2 -pc_type gamg -ksp_converged_reason
  Linear solve converged due to CONVERGED_RTOL iterations 5
  Linear solve converged due to CONVERGED_RTOL iterations 5
  Linear solve converged due to CONVERGED_RTOL iterations 5
$ ./ex5 -da_refine 3 -pc_type gamg -ksp_converged_reason
  Linear solve converged due to CONVERGED_RTOL iterations 5
  Linear solve converged due to CONVERGED_RTOL iterations 5
  Linear solve converged due to CONVERGED_RTOL iterations 5
$ ./ex5 -da_refine 4 -pc_type gamg -ksp_converged_reason                                            
  Linear solve converged due to CONVERGED_RTOL iterations 6
  Linear solve converged due to CONVERGED_RTOL iterations 5
  Linear solve converged due to CONVERGED_RTOL iterations 5
  Linear solve converged due to CONVERGED_RTOL iterations 5
$ ./ex5 -da_refine 5 -pc_type gamg -ksp_converged_reason                                            
  Linear solve converged due to CONVERGED_RTOL iterations 7
  Linear solve converged due to CONVERGED_RTOL iterations 6
  Linear solve converged due to CONVERGED_RTOL iterations 6
  Linear solve converged due to CONVERGED_RTOL iterations 7
$ ./ex5 -da_refine 6 -pc_type gamg -ksp_converged_reason
  Linear solve converged due to CONVERGED_RTOL iterations 8
  Linear solve converged due to CONVERGED_RTOL iterations 7
  Linear solve converged due to CONVERGED_RTOL iterations 7
  Linear solve converged due to CONVERGED_RTOL iterations 7

Running with -pc_type hypre or -pc_type ml should produce something
similar (likely better because the defaults are better for 2D scalar),
but -pc_type ilu and similar will approximately double the number of
iterations with each refinement.  Note that smoothed aggregation is
known to be weakly sub-optimal, so degrading from 5 to 7 iterations
across this range of problem sizes is not surprising.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130703/1a4e9a30/attachment.pgp>


More information about the petsc-users mailing list