[petsc-users] GAMG Indefinite

Mark Adams mfadams at lbl.gov
Mon May 23 19:22:42 CDT 2016


I'm glad it worked. Its funny this problem has been in the repo since last
year but in this last week it has been blowing up all over the place.

In a nutshell, Chebyshev polynomials have some really nice properties and
multigrid smoothers, especially in an AMG context where you don't know
anything about the spectra of your (diagonally preconditioned) operator.
[skip some linear algebra background]. Chebyshev needs the largest
eigenvalue (lam) of your operator, which is easy to compute in theory. Two
problems: 1) if you underestimate this lam you die as you have seen, and 2)
there is no provable way to get lam cheaply.  But in practice we can get
pretty good (under)estimates of lam with Krylov methods (Power method being
the simplest of these).  We then increase this estimate with a safety
factor like 1.05. Works but not provable.

Last year we made a change that made this estimate bad in some/many cases.
As far as what are you looking at, these iterations are converging on "max"
(lam), at each level, eg:

35 KSP Residual norm 1.017388214943e-04 % max 1.570600354842e+00 min
1.495477205174e-03 max/min 1.050233563847e+03
                                         ^^^^^^^^^^^^^^^^^^^^^

This should asymptot nicely to the true lam. The "bug" that we had, and you
can probably see it if you go back to the bad solver parameters but use a
lot of eigest iterations (ie, 50 here), results in what looks like nice
convergence and then all of the sudden lam ("max") jumps up after many
iterations. Yikes! This is probably more of a problem with simple test
problems than the real world [skip explanation], but it is a big problem in
practice as you have seen.

Again, sorry for the mess,
Mark


On Mon, May 23, 2016 at 12:31 PM, Sanjay Govindjee <s_g at berkeley.edu> wrote:

> Mark,
>   Yes, the problem is finite elasticity.  I re-ran the problem with the
> options table and output shown below.  It converges now
> based on the residual tolerance test (KSPConvergedReason == 2); note I am
> using Using Petsc Release Version 3.7.0, Apr, 25, 2016.
> Seems to work now with these options; wish I understood what they all
> meant!
> -sanjay
>
> ------ Options Table ------
>
> -ksp_chebyshev_esteig_random
> -ksp_monitor
> -ksp_type cg
> -ksp_view
> -log_view
> -mg_levels_esteig_ksp_max_it 50
> -mg_levels_esteig_ksp_monitor_singular_value
> -mg_levels_esteig_ksp_type cg
> -mg_levels_ksp_chebyshev_esteig 0,0.05,0,1.05
> -mg_levels_ksp_type chebyshev
> -mg_levels_pc_type sor
> -options_left
> -pc_gamg_agg_nsmooths 1
> -pc_gamg_square_graph 1
> -pc_gamg_type agg
> -pc_type gamg
> #End of PETSc Option Table entries
> There is one unused database option. It is:
> Option left: name:-ksp_chebyshev_esteig_random (no value)
>
>
> ---- Output -----
>
>
>    Residual norm =     6.4807407E-02    1.0000000E+00      t=     0.06
> 0.00
>    Residual norm =     6.4807407E-02    1.0000000E+00      t=     2.72
> 0.00
>       0 KSP Residual norm 1.560868061707e-03 % max 1.000000000000e+00 min
> 1.000000000000e+00 max/min 1.000000000000e+00
>       1 KSP Residual norm 6.096709155146e-04 % max 5.751224548776e-01 min
> 5.751224548776e-01 max/min 1.000000000000e+00
>       2 KSP Residual norm 7.011069458089e-04 % max 8.790398458008e-01 min
> 1.423643814416e-01 max/min 6.174577073983e+00
>       3 KSP Residual norm 7.860563886831e-04 % max 9.381463130007e-01 min
> 6.370569326093e-02 max/min 1.472625545661e+01
>       4 KSP Residual norm 7.281118133903e-04 % max 9.663599650986e-01 min
> 3.450830062982e-02 max/min 2.800369613865e+01
>       5 KSP Residual norm 7.399083718116e-04 % max 9.794646011330e-01 min
> 2.160135448201e-02 max/min 4.534274005590e+01
>       6 KSP Residual norm 7.629904179692e-04 % max 9.849620569978e-01 min
> 1.481091947823e-02 max/min 6.650242467697e+01
>       7 KSP Residual norm 7.698477913710e-04 % max 9.886850579079e-01 min
> 1.045801989510e-02 max/min 9.453845640235e+01
>       8 KSP Residual norm 8.217081868349e-04 % max 9.919371306726e-01 min
> 7.371001382474e-03 max/min 1.345729133942e+02
>       9 KSP Residual norm 7.524701879786e-04 % max 9.942899758738e-01 min
> 5.827670079091e-03 max/min 1.706153509687e+02
>      10 KSP Residual norm 6.944661718672e-04 % max 1.081740430310e+00 min
> 5.160677620664e-03 max/min 2.096120916327e+02
>      11 KSP Residual norm 5.551504568073e-04 % max 1.486860759049e+00 min
> 4.666379506027e-03 max/min 3.186326266710e+02
>      12 KSP Residual norm 5.259305993307e-04 % max 1.564857844056e+00 min
> 4.221790647720e-03 max/min 3.706621134569e+02
>      13 KSP Residual norm 5.156103593875e-04 % max 1.569917781391e+00 min
> 3.850994097592e-03 max/min 4.076655901322e+02
>      14 KSP Residual norm 5.312020352146e-04 % max 1.570323151514e+00 min
> 3.568538377912e-03 max/min 4.400465919699e+02
>      15 KSP Residual norm 5.305598654979e-04 % max 1.570412447356e+00 min
> 3.341861320427e-03 max/min 4.699214888890e+02
>      16 KSP Residual norm 5.058601071413e-04 % max 1.570467828098e+00 min
> 3.091912672470e-03 max/min 5.079276145416e+02
>      17 KSP Residual norm 5.485622395473e-04 % max 1.570494963661e+00 min
> 2.876900954621e-03 max/min 5.458981690483e+02
>      18 KSP Residual norm 5.368711040867e-04 % max 1.570521333658e+00 min
> 2.664379213208e-03 max/min 5.894511283800e+02
>      19 KSP Residual norm 5.198795692341e-04 % max 1.570548096173e+00 min
> 2.476198885896e-03 max/min 6.342576539867e+02
>      20 KSP Residual norm 5.958949153283e-04 % max 1.570562153443e+00 min
> 2.291602609346e-03 max/min 6.853553696602e+02
>      21 KSP Residual norm 6.378632372927e-04 % max 1.570571141557e+00 min
> 2.073298632606e-03 max/min 7.575228753145e+02
>      22 KSP Residual norm 5.831338029614e-04 % max 1.570577774384e+00 min
> 1.893683789633e-03 max/min 8.293769968259e+02
>      23 KSP Residual norm 4.875913917209e-04 % max 1.570583697638e+00 min
> 1.759110933887e-03 max/min 8.928281141244e+02
>      24 KSP Residual norm 4.107781613610e-04 % max 1.570587819069e+00 min
> 1.672892328012e-03 max/min 9.388457300985e+02
>      25 KSP Residual norm 3.715001142988e-04 % max 1.570590462451e+00 min
> 1.617963853373e-03 max/min 9.707203650914e+02
>      26 KSP Residual norm 2.991751132378e-04 % max 1.570593709995e+00 min
> 1.573420350354e-03 max/min 9.982035059109e+02
>      27 KSP Residual norm 2.208369736689e-04 % max 1.570597161312e+00 min
> 1.545543181679e-03 max/min 1.016210468870e+03
>      28 KSP Residual norm 1.811301040805e-04 % max 1.570599147395e+00 min
> 1.529650294818e-03 max/min 1.026770074647e+03
>      29 KSP Residual norm 1.466232980955e-04 % max 1.570599898730e+00 min
> 1.518818086503e-03 max/min 1.034093491964e+03
>      30 KSP Residual norm 1.206956326419e-04 % max 1.570600148946e+00 min
> 1.512437955816e-03 max/min 1.038455920063e+03
>      31 KSP Residual norm 8.815660316339e-05 % max 1.570600276978e+00 min
> 1.508452842477e-03 max/min 1.041199454667e+03
>      32 KSP Residual norm 8.077031357734e-05 % max 1.570600325445e+00 min
> 1.505888596198e-03 max/min 1.042972454543e+03
>      33 KSP Residual norm 8.820553812137e-05 % max 1.570600343673e+00 min
> 1.503328090889e-03 max/min 1.044748882956e+03
>      34 KSP Residual norm 9.117950808819e-05 % max 1.570600352355e+00 min
> 1.499931693668e-03 max/min 1.047114584608e+03
>      35 KSP Residual norm 1.017388214943e-04 % max 1.570600354842e+00 min
> 1.495477205174e-03 max/min 1.050233563847e+03
>      36 KSP Residual norm 8.890686455242e-05 % max 1.570600355527e+00 min
> 1.491021415006e-03 max/min 1.053372097624e+03
>      37 KSP Residual norm 6.145275695828e-05 % max 1.570600355891e+00 min
> 1.487712171225e-03 max/min 1.055715202355e+03
>      38 KSP Residual norm 4.601453163034e-05 % max 1.570600356004e+00 min
> 1.486196684310e-03 max/min 1.056791723858e+03
>      39 KSP Residual norm 3.537992820781e-05 % max 1.570600356044e+00 min
> 1.485426023422e-03 max/min 1.057340002989e+03
>      40 KSP Residual norm 2.801997681470e-05 % max 1.570600356064e+00 min
> 1.484937369198e-03 max/min 1.057687946066e+03
>      41 KSP Residual norm 2.422931135206e-05 % max 1.570600356072e+00 min
> 1.484576829299e-03 max/min 1.057944813010e+03
>      42 KSP Residual norm 2.099844940173e-05 % max 1.570600356076e+00 min
> 1.484295103277e-03 max/min 1.058145615794e+03
>      43 KSP Residual norm 1.692165408662e-05 % max 1.570600356077e+00 min
> 1.484073208085e-03 max/min 1.058303827278e+03
>      44 KSP Residual norm 1.303434704073e-05 % max 1.570600356078e+00 min
> 1.483945099557e-03 max/min 1.058395190325e+03
>      45 KSP Residual norm 1.116085143372e-05 % max 1.570600356078e+00 min
> 1.483862236504e-03 max/min 1.058454294098e+03
>      46 KSP Residual norm 1.042314767557e-05 % max 1.570600356078e+00 min
> 1.483776389632e-03 max/min 1.058515533104e+03
>      47 KSP Residual norm 8.547779619028e-06 % max 1.570600356078e+00 min
> 1.483710767635e-03 max/min 1.058562349440e+03
>      48 KSP Residual norm 5.686341715603e-06 % max 1.570600356078e+00 min
> 1.483675385024e-03 max/min 1.058587593979e+03
>      49 KSP Residual norm 3.605023485024e-06 % max 1.570600356078e+00 min
> 1.483660745235e-03 max/min 1.058598039425e+03
>      50 KSP Residual norm 2.272532759782e-06 % max 1.570600356078e+00 min
> 1.483654995309e-03 max/min 1.058602142037e+03
>         0 KSP Residual norm 5.279802306740e-03 % max 1.000000000000e+00
> min 1.000000000000e+00 max/min 1.000000000000e+00
>         1 KSP Residual norm 3.528673026246e-03 % max 3.090782483684e-01
> min 3.090782483684e-01 max/min 1.000000000000e+00
>         2 KSP Residual norm 3.205752762808e-03 % max 8.446523416360e-01
> min 9.580457075356e-02 max/min 8.816409645096e+00
>         3 KSP Residual norm 2.374523626799e-03 % max 9.504624619604e-01
> min 6.564631404306e-02 max/min 1.447853509851e+01
>         4 KSP Residual norm 1.924918345847e-03 % max 9.848656903443e-01
> min 4.952831543265e-02 max/min 1.988490183325e+01
>         5 KSP Residual norm 6.808260964410e-04 % max 9.938458367029e-01
> min 4.251109574134e-02 max/min 2.337850434978e+01
>         6 KSP Residual norm 3.315021446270e-04 % max 9.967726858804e-01
> min 4.166488358467e-02 max/min 2.392356824554e+01
>         7 KSP Residual norm 1.314681668602e-04 % max 9.982316137592e-01
> min 4.143867906023e-02 max/min 2.408936858987e+01
>         8 KSP Residual norm 4.301436610738e-05 % max 9.989590393061e-01
> min 4.138618158843e-02 max/min 2.413750196238e+01
>         9 KSP Residual norm 8.016910487452e-06 % max 9.994371206849e-01
> min 4.138180175046e-02 max/min 2.415160960636e+01
>        10 KSP Residual norm 6.525723903099e-07 % max 9.997527609942e-01
> min 4.138161245544e-02 max/min 2.415934763467e+01
>        11 KSP Residual norm 8.205412727192e-08 % max 9.998804196297e-01
> min 4.138161047930e-02 max/min 2.416243370059e+01
>        12 KSP Residual norm 1.645897401565e-08 % max 9.999250934790e-01
> min 4.138161045086e-02 max/min 2.416351327521e+01
>        13 KSP Residual norm 2.636218490435e-09 % max 9.999479210248e-01
> min 4.138161044973e-02 max/min 2.416406491090e+01
>        14 KSP Residual norm 2.614816263321e-10 % max 9.999674891694e-01
> min 4.138161044968e-02 max/min 2.416453778147e+01
>        15 KSP Residual norm 2.309894761749e-11 % max 9.999797578219e-01
> min 4.138161044968e-02 max/min 2.416483425742e+01
>        16 KSP Residual norm 2.261461487058e-12 % max 9.999874664751e-01
> min 4.138161044968e-02 max/min 2.416502053952e+01
>        17 KSP Residual norm 2.659598917594e-13 % max 9.999898150784e-01
> min 4.138161044968e-02 max/min 2.416507729428e+01
>        18 KSP Residual norm 1.822011884274e-14 % max 9.999918194957e-01
> min 4.138161044968e-02 max/min 2.416512573167e+01
>        19 KSP Residual norm 1.042398553176e-15 % max 9.999933278733e-01
> min 4.138161044968e-02 max/min 2.416516218210e+01
>   0 KSP Residual norm 8.439161590194e-02
>   1 KSP Residual norm 7.614890998257e-03
>   2 KSP Residual norm 1.514029318872e-03
>   3 KSP Residual norm 3.781832295258e-04
>   4 KSP Residual norm 3.799411703870e-05
>   5 KSP Residual norm 4.799680240826e-06
>   6 KSP Residual norm 9.360965396987e-07
>   7 KSP Residual norm 1.250237476907e-07
>   8 KSP Residual norm 2.036465606099e-08
>   9 KSP Residual norm 3.993471620298e-09
>  10 KSP Residual norm 5.041262213944e-10
> KSP Object: 2 MPI processes
>   type: cg
>   maximum iterations=10000, initial guess is zero
>   tolerances:  relative=1e-08, absolute=1e-16, divergence=1e+16
>   left preconditioning
>   using PRECONDITIONED norm type for convergence test
> PC Object: 2 MPI processes
>   type: gamg
>     MG: type is MULTIPLICATIVE, levels=3 cycles=v
>       Cycles per PCApply=1
>       Using Galerkin computed coarse grid matrices
>       GAMG specific options
>         Threshold for dropping small values from graph 0.
>         AGG specific options
>           Symmetric graph false
>   Coarse grid solver -- level -------------------------------
>     KSP Object:    (mg_coarse_)     2 MPI processes
>       type: preonly
>       maximum iterations=10000, initial guess is zero
>       tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.
>       left preconditioning
>       using NONE norm type for convergence test
>     PC Object:    (mg_coarse_)     2 MPI processes
>       type: bjacobi
>         block Jacobi: number of blocks = 2
>         Local solve is same for all blocks, in the following KSP and PC
> objects:
>       KSP Object:      (mg_coarse_sub_)       1 MPI processes
>         type: preonly
>         maximum iterations=1, initial guess is zero
>         tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.
>         left preconditioning
>         using NONE norm type for convergence test
>       PC Object:      (mg_coarse_sub_)       1 MPI processes
>         type: lu
>           LU: out-of-place factorization
>           tolerance for zero pivot 2.22045e-14
>           using diagonal shift on blocks to prevent zero pivot [INBLOCKS]
>           matrix ordering: nd
>           factor fill ratio given 5., needed 1.
>             Factored matrix follows:
>               Mat Object:               1 MPI processes
>                 type: seqaij
>                 rows=9, cols=9, bs=3
>                 package used to perform factorization: petsc
>                 total: nonzeros=81, allocated nonzeros=81
>                 total number of mallocs used during MatSetValues calls =0
>                   using I-node routines: found 2 nodes, limit used is 5
>         linear system matrix = precond matrix:
>         Mat Object:         1 MPI processes
>           type: seqaij
>           rows=9, cols=9, bs=3
>           total: nonzeros=81, allocated nonzeros=81
>           total number of mallocs used during MatSetValues calls =0
>             using I-node routines: found 2 nodes, limit used is 5
>       linear system matrix = precond matrix:
>       Mat Object:       2 MPI processes
>         type: mpiaij
>         rows=9, cols=9, bs=3
>         total: nonzeros=81, allocated nonzeros=81
>         total number of mallocs used during MatSetValues calls =0
>           using I-node (on process 0) routines: found 2 nodes, limit used
> is 5
>   Down solver (pre-smoother) on level 1 -------------------------------
>     KSP Object:    (mg_levels_1_)     2 MPI processes
>       type: chebyshev
>         Chebyshev: eigenvalue estimates:  min = 0.0499997, max = 1.04999
>         Chebyshev: eigenvalues estimated using cg with translations  [0.
> 0.05; 0. 1.05]
>         KSP Object:        (mg_levels_1_esteig_)         2 MPI processes
>           type: cg
>           maximum iterations=50, initial guess is zero
>           tolerances:  relative=1e-12, absolute=1e-50, divergence=10000.
>           left preconditioning
>           using PRECONDITIONED norm type for convergence test
>       maximum iterations=2
>       tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.
>       left preconditioning
>       using nonzero initial guess
>       using NONE norm type for convergence test
>     PC Object:    (mg_levels_1_)     2 MPI processes
>       type: sor
>         SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1.
>       linear system matrix = precond matrix:
>       Mat Object:       2 MPI processes
>         type: mpiaij
>         rows=54, cols=54, bs=3
>         total: nonzeros=1764, allocated nonzeros=1764
>         total number of mallocs used during MatSetValues calls =0
>           using I-node (on process 0) routines: found 18 nodes, limit used
> is 5
>   Up solver (post-smoother) same as down solver (pre-smoother)
>   Down solver (pre-smoother) on level 2 -------------------------------
>     KSP Object:    (mg_levels_2_)     2 MPI processes
>       type: chebyshev
>         Chebyshev: eigenvalue estimates:  min = 0.07853, max = 1.64913
>         Chebyshev: eigenvalues estimated using cg with translations  [0.
> 0.05; 0. 1.05]
>         KSP Object:        (mg_levels_2_esteig_)         2 MPI processes
>           type: cg
>           maximum iterations=50, initial guess is zero
>           tolerances:  relative=1e-12, absolute=1e-50, divergence=10000.
>           left preconditioning
>           using PRECONDITIONED norm type for convergence test
>       maximum iterations=2
>       tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.
>       left preconditioning
>       using nonzero initial guess
>       using NONE norm type for convergence test
>     PC Object:    (mg_levels_2_)     2 MPI processes
>       type: sor
>         SOR: type = local_symmetric, iterations = 1, local iterations = 1,
> omega = 1.
>       linear system matrix = precond matrix:
>       Mat Object:       2 MPI processes
>         type: mpiaij
>         rows=882, cols=882, bs=2
>         total: nonzeros=26244, allocated nonzeros=26244
>         total number of mallocs used during MatSetValues calls =0
>           using I-node (on process 0) routines: found 189 nodes, limit
> used is 5
>   Up solver (post-smoother) same as down solver (pre-smoother)
>   linear system matrix = precond matrix:
>   Mat Object:   2 MPI processes
>     type: mpiaij
>     rows=882, cols=882, bs=2
>     total: nonzeros=26244, allocated nonzeros=26244
>     total number of mallocs used during MatSetValues calls =0
>       using I-node (on process 0) routines: found 189 nodes, limit used is
> 5
> CONVERGENCE:  Satisfied residual tolerance Iterations =           10
>
>
>
> On 5/22/16 3:02 PM, Mark Adams wrote:
>
> I thought you would have this also, so add it (I assume this is 3D
> elasticity):
>
> -pc_gamg_square_graph 1
> -mg_levels_ksp_type chebyshev
> -mg_levels_pc_type sor
>
> Plus what I just mentioned:
>
> -mg_levels_esteig_ksp_type cg
> -mg_levels_ksp_chebyshev_esteig 0,0.05,0,1.05
>
> Just for diagnostics add:
>
> -mg_levels_esteig_ksp_max_it 50
> -mg_levels_esteig_ksp_monitor_singular_value
> -ksp_view
>
>
>
> On Sun, May 22, 2016 at 5:38 PM, Sanjay Govindjee < <s_g at berkeley.edu>
> s_g at berkeley.edu> wrote:
>
>> Mark,
>>   Can you give me the full option line that you want me to use?  I
>> currently have:
>>
>> -ksp_type cg -ksp_monitor -ksp_chebyshev_esteig_random -log_view -pc_type
>> gamg -pc_gamg_type agg -pc_gamg_agg_nsmooths 1 -options_left
>>
>> -sanjay
>>
>>
>> On 5/22/16 2:29 PM, Mark Adams wrote:
>>
>> Humm, maybe we have version mixup:
>>
>> src/ksp/ksp/impls/cheby/cheby.c:    ierr =
>> PetscOptionsBool("-ksp_chebyshev_esteig_random","Use random right hand side
>> for
>> estimate","KSPChebyshevEstEigSetUseRandom",cheb->userandom,&cheb->userandom
>>
>> Also, you should use CG. These other options are the defaults but CG is
>> not:
>>
>> -mg_levels_esteig_ksp_type cg
>> -mg_levels_esteig_ksp_max_it 10
>> -mg_levels_ksp_chebyshev_esteig 0,0.05,0,1.05
>>
>> Anyway. you can also run with -info, which will be very noisy, but just
>> grep for GAMG and send me that.
>>
>> Mark
>>
>>
>>
>> On Sat, May 21, 2016 at 6:03 PM, Sanjay Govindjee < <s_g at berkeley.edu>
>> s_g at berkeley.edu> wrote:
>>
>>> Mark,
>>>   I added the option you mentioned but it seems not to use it;
>>> -options_left reports:
>>>
>>> #PETSc Option Table entries:
>>> -ksp_chebyshev_esteig_random
>>> -ksp_monitor
>>> -ksp_type cg
>>> -log_view
>>> -options_left
>>> -pc_gamg_agg_nsmooths 1
>>> -pc_gamg_type agg
>>> -pc_type gamg
>>> #End of PETSc Option Table entries
>>> There is one unused database option. It is:
>>> Option left: name:-ksp_chebyshev_esteig_random (no value)
>>>
>>>
>>>
>>> On 5/21/16 12:36 PM, Mark Adams wrote:
>>>
>>> Barry, this is probably the Chebyshev problem.
>>>
>>> Sanjay, this is fixed but has not yet been moved to the master branch.
>>> You can fix this now with with -ksp_chebyshev_esteig_random.  This should
>>> recover v3.5 semantics.
>>>
>>> Mark
>>>
>>> On Thu, May 19, 2016 at 2:42 PM, Barry Smith < <bsmith at mcs.anl.gov>
>>> bsmith at mcs.anl.gov> wrote:
>>>
>>>>
>>>>    We see this occasionally, there is nothing in the definition of GAMG
>>>> that guarantees a positive definite preconditioner even if the operator was
>>>> positive definite so we don't think this is a bug in the code. We've found
>>>> using a slightly stronger smoother, like one more smoothing step seems to
>>>> remove the problem.
>>>>
>>>>    Barry
>>>>
>>>> > On May 19, 2016, at 1:07 PM, Sanjay Govindjee < <s_g at berkeley.edu>
>>>> s_g at berkeley.edu> wrote:
>>>> >
>>>> > I am trying to solve a very ordinary nonlinear elasticity problem
>>>> > using -ksp_type cg -pc_type gamg in PETSc 3.7.0, which worked fine
>>>> > in PETSc 3.5.3.
>>>> >
>>>> > The problem I am seeing is on my first Newton iteration, the Ax=b
>>>> > solve returns with and Indefinite Preconditioner error
>>>> (KSPGetConvergedReason == -8):
>>>> > (log_view.txt output also attached)
>>>> >
>>>> >   0 KSP Residual norm 8.411630828687e-02
>>>> >   1 KSP Residual norm 2.852209578900e-02
>>>> >   NO CONVERGENCE REASON:  Indefinite Preconditioner
>>>> >   NO CONVERGENCE REASON:  Indefinite Preconditioner
>>>> >
>>>> > On the next and subsequent Newton iterations, I see perfectly normal
>>>> > behavior and the problem converges quadratically.  The results look
>>>> fine.
>>>> >
>>>> > I tried the same problem with -pc_type jacobi as well as super-lu,
>>>> and mumps
>>>> > and they all work without complaint.
>>>> >
>>>> > My run line for GAMG is:
>>>> > -ksp_type cg -ksp_monitor -log_view -pc_type gamg -pc_gamg_type agg
>>>> -pc_gamg_agg_nsmooths 1 -options_left
>>>> >
>>>> > The code flow looks like:
>>>> >
>>>> > ! If no matrix allocation yet
>>>> > if(Kmat.eq.0) then
>>>> >   call MatCreate(PETSC_COMM_WORLD,Kmat,ierr)
>>>> >   call
>>>> MatSetSizes(Kmat,numpeq,numpeq,PETSC_DETERMINE,PETSC_DETERMINE,ierr)
>>>> >   call MatSetBlockSize(Kmat,nsbk,ierr)
>>>> >   call MatSetFromOptions(Kmat, ierr)
>>>> >   call MatSetType(Kmat,MATAIJ,ierr)
>>>> >   call
>>>> MatMPIAIJSetPreallocation(Kmat,PETSC_NULL_INTEGER,mr(np(246)),PETSC_NULL_INTEGER,mr(np(247)),ierr)
>>>> >   call
>>>> MatSeqAIJSetPreallocation(Kmat,PETSC_NULL_INTEGER,mr(np(246)),ierr)
>>>> > endif
>>>> >
>>>> > call MatZeroEntries(Kmat,ierr)
>>>> >
>>>> > ! Code to set values in matrix
>>>> >
>>>> > call MatAssemblyBegin(Kmat, MAT_FINAL_ASSEMBLY, ierr)
>>>> > call MatAssemblyEnd(Kmat, MAT_FINAL_ASSEMBLY, ierr)
>>>> > call MatSetOption(Kmat,MAT_NEW_NONZERO_LOCATIONS,PETSC_TRUE,ierr)
>>>> >
>>>> > ! If no rhs allocation yet
>>>> > if(rhs.eq.0) then
>>>> >   call VecCreate        (PETSC_COMM_WORLD, rhs, ierr)
>>>> >   call VecSetSizes      (rhs, numpeq, PETSC_DECIDE, ierr)
>>>> >   call VecSetFromOptions(rhs, ierr)
>>>> > endif
>>>> >
>>>> > ! Code to set values in RHS
>>>> >
>>>> > call VecAssemblyBegin(rhs, ierr)
>>>> > call VecAssemblyEnd(rhs, ierr)
>>>> >
>>>> > if(kspsol_exists) then
>>>> >   call KSPDestroy(kspsol,ierr)
>>>> > endif
>>>> >
>>>> > call KSPCreate(PETSC_COMM_WORLD, kspsol   ,ierr)
>>>> > call KSPSetOperators(kspsol, Kmat, Kmat, ierr)
>>>> > call KSPSetFromOptions(kspsol,ierr)
>>>> > call KSPGetPC(kspsol, pc ,      ierr)
>>>> >
>>>> > call PCSetCoordinates(pc,ndm,numpn,hr(np(43)),ierr)
>>>> >
>>>> > call KSPSolve(kspsol, rhs, sol, ierr)
>>>> > call KSPGetConvergedReason(kspsol,reason,ierr)
>>>> >
>>>> > ! update solution, go back to the top
>>>> >
>>>> > reason is coming back as -8 on my first Ax=b solve and 2 or 3 after
>>>> that
>>>> > (with gamg).  With the other solvers it is coming back as 2 or 3 for
>>>> > iterative options and 4 if I use one of the direct solvers.
>>>> >
>>>> > Any ideas on what is causing the Indefinite PC on the first iteration
>>>> with GAMG?
>>>> >
>>>> > Thanks in advance,
>>>> > -sanjay
>>>> >
>>>> > --
>>>> > -----------------------------------------------
>>>> > Sanjay Govindjee, PhD, PE
>>>> > Professor of Civil Engineering
>>>> >
>>>> > 779 Davis Hall
>>>> > University of California
>>>> > Berkeley, CA 94720-1710
>>>> >
>>>> > Voice:  +1 510 642 6060 <%2B1%20510%20642%206060>
>>>> > FAX:    +1 510 643 5264 <%2B1%20510%20643%205264>
>>>> >
>>>> > <s_g at berkeley.edu>s_g at berkeley.edu
>>>> > <http://www.ce.berkeley.edu/%7Esanjay>
>>>> http://www.ce.berkeley.edu/~sanjay
>>>> >
>>>> > -----------------------------------------------
>>>> >
>>>> > Books:
>>>> >
>>>> > Engineering Mechanics of Deformable
>>>> > Solids: A Presentation with Exercises
>>>> >
>>>> >
>>>> <http://www.oup.com/us/catalog/general/subject/Physics/MaterialsScience/?view=usa&ci=9780199651641>
>>>> http://www.oup.com/us/catalog/general/subject/Physics/MaterialsScience/?view=usa&ci=9780199651641
>>>> > <http://ukcatalogue.oup.com/product/9780199651641.do>
>>>> http://ukcatalogue.oup.com/product/9780199651641.do
>>>> > <http://amzn.com/0199651647>http://amzn.com/0199651647
>>>> >
>>>> >
>>>> > Engineering Mechanics 3 (Dynamics) 2nd Edition
>>>> >
>>>> > <http://www.springer.com/978-3-642-53711-0>
>>>> http://www.springer.com/978-3-642-53711-0
>>>> > <http://amzn.com/3642537111>http://amzn.com/3642537111
>>>> >
>>>> >
>>>> > Engineering Mechanics 3, Supplementary Problems: Dynamics
>>>> >
>>>> > <http://www.amzn.com/B00SOXN8JU>http://www.amzn.com/B00SOXN8JU
>>>> >
>>>> >
>>>> > -----------------------------------------------
>>>> >
>>>> > <log_view.txt>
>>>>
>>>>
>>>
>>> --
>>> -----------------------------------------------
>>> Sanjay Govindjee, PhD, PE
>>> Professor of Civil Engineering
>>>
>>> 779 Davis Hall
>>> University of California
>>> Berkeley, CA 94720-1710
>>>
>>> Voice:  +1 510 642 6060
>>> FAX:    +1 510 643 5264s_g at berkeley.eduhttp://www.ce.berkeley.edu/~sanjay
>>> -----------------------------------------------
>>>
>>> Books:
>>>
>>> Engineering Mechanics of Deformable
>>> Solids: A Presentation with Exerciseshttp://www.oup.com/us/catalog/general/subject/Physics/MaterialsScience/?view=usa&ci=9780199651641http://ukcatalogue.oup.com/product/9780199651641.dohttp://amzn.com/0199651647
>>>
>>> Engineering Mechanics 3 (Dynamics) 2nd Editionhttp://www.springer.com/978-3-642-53711-0http://amzn.com/3642537111
>>>
>>> Engineering Mechanics 3, Supplementary Problems: Dynamics http://www.amzn.com/B00SOXN8JU
>>>
>>> -----------------------------------------------
>>>
>>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160523/d3099017/attachment-0001.html>


More information about the petsc-users mailing list