[petsc-users] Usage of AMG as preconditioner

Michael Werner michael.werner at dlr.de
Fri Sep 28 02:23:27 CDT 2018


Hello,

I'm having trouble with getting the AMG preconditioners working. I 
tried all of them (gamg, ml, hypre-boomeramg), with varying 
degrees of "success":

- GAMG:
CMD options: -ksp_rtol 1e-8 -ksp_monitor_true_residual -ksp_max_it 
20 -ksp_type fgmres -pc_type gamg -pc_gamg_sym_graph TRUE 
-pc_gamg_agg_nsmooths 1 -ksp_view
always crashes with the following error:
Error: error code 77
[0] KSPSolve() line 780 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/ksp/interface/itfunc.c
[0] KSPSolve_GMRES() line 233 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/ksp/impls/gmres/gmres.c
[0] KSPInitialResidual() line 67 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/ksp/interface/itres.c
[0] KSP_PCApply() line 281 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/include/petsc/private/kspimpl.h
[0] PCApply() line 462 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/pc/interface/precon.c
[0] PCApply_MG() line 377 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/pc/impls/mg/mg.c
[0] PCMGMCycle_Private() line 20 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/pc/impls/mg/mg.c
[0] KSPSolve() line 780 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/ksp/interface/itfunc.c
[0] KSPSolve_Chebyshev() line 381 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/ksp/impls/cheby/cheby.c
[0] Petsc has generated inconsistent data
[0] Eigen estimator failed: DIVERGED_NANORINF at iteration 0

When I'm using a different solver for -mg_levels_ksp_type, such as 
gmres, GAMG no longer crashes, but I don't see convergence of the 
problem (convergence history and ksp_view output are attached 
below).

- Hypre
With the default settings, BoomerAMG just returns a Vector of all 
zeros after one iteration.
When I change the relaxation type 
-pc_hypre_boomeramg_relax_type_all to Jacobi, I get similar 
results than with GAMG: the solver works without errors, but 
doesn't converge. The output for Hypre is also attached below.

- ML
With default settings the result is just like Boomeramg: a vector 
of all zeros after one iteration.
When I change -mg_levels_ksp_type the behaviour is identical to 
GAMG.


Since none of the packages worked, I'm assuming that the error 
lies with me/ my code, so I'll give a short overview over what I'm 
trying to do.
The matrix I'm trying to precondition is the Jacobian of a flow 
field originating from an unstructured finite-volume CFD code. It 
has a blocked structure as each node of the original mesh holds 
several variables (pressure, density, velocities). However, I'm 
not using a DM-Plex since I get the assembled Jacobian in binary 
format from the external CFD code.
When I'm using direct (lu) I get correct results, so the basic 
code should be fine. However, for larger problems lu is not 
feasible due the very large memory requirements, therefore I 
wanted to switch over to multigrid.

Currently, PETSc has no information about the original geometry. I 
tried using setCoordinates, but for Hypre and ml it didn't make a 
difference, and GAMG crashed with an error:

[0] PCSetCoordinates() line 1883 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/pc/interface/precon.c
[0] PCSetCoordinates_AGG() line 199 in 
/home/yoda/wern_mc/Programme/Anaconda/envs/GSA_27/weitere_programme/petsc-3.10.0/src/ksp/pc/impls/gamg/agg.c
[0] Petsc has generated inconsistent data
[0] Don't know how to create null space for ndm=2, ndf=4.  Use 
MatSetNearNullSpace.

I would be glad if you could give me some advice on how to deal 
with this.

Kind regards,
Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: GAMG_KSP_view
Type: application/octet-stream
Size: 8847 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180928/066c0b1f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Hypre_KSP_view
Type: application/octet-stream
Size: 7364 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180928/066c0b1f/attachment-0001.obj>


More information about the petsc-users mailing list