> On Sep 20, 2015, at 12:40 PM, Gideon Simpson <[email protected]> wrote:
> 
> Point taken.  So this comes back to something that I began asking about in a 
> previous thread, but took a detour as you guys identified other problems with 
> my code.  The issue is that I have a DMComposite with two blocks.  One block 
> is of size two, and couples certain pieces of the second block, which is, 
> morally, a vector valued semilinear elliptic equation.  Using grid 
> sequencing, the guesses for the SNES are now quite good, but I’m struggling 
> with the issue of preconditioning the linear problem.  The second block 
> would, presumably, benefit from multigrid, but jacobi doesn’t do such a good 
> job on that. At the same time, the first block, as discussed, has these zeros 
> on the diagonal, and can’t use SOR.

   I think we answered this before, this is what PCFIELDSPLIT is for.  If the 
matrix looks like (logically if you reorder rows and columns)

(A   B )
(C  0  )

  you should use something like -ksp_type fgmres -pc_type fieldsplit 
-pc_fieldsplit_detect_saddle_point -pc_fieldsplit_type schur  
-fieldsplit_0_ksp_type gmres  -fieldsplit_0_pc_type gamg 

the detect saddle point flag automatically makes the first block fieldsplit_0 
the block without the zeros on the diagonal and the second block fieldsplit_1 
be the one with zeros on the diagonal.  You will likely need to play around a 
bit with sub options to get great convergence but 
start by running with -ksp_monitor -fieldsplit_0_ksp_monitor_true_residual and 
see how it converges.

  Barry

> 
> -gideon
> 
>> On Sep 19, 2015, at 10:43 PM, Barry Smith <[email protected]> wrote:
>> 
>> 
>>> On Sep 19, 2015, at 9:14 PM, Gideon Simpson <[email protected]> 
>>> wrote:
>>> 
>>> Yes, I know exactly where the zero diagonal entries are.  Is there a way to 
>>> compensate for that?
>> 
>>  Not really. How can you update x_i if A_ii = 0 ?
>> 
>> 
>>> 
>>> -gideon
>>> 
>>>> On Sep 19, 2015, at 10:09 PM, Barry Smith <[email protected]> wrote:
>>>> 
>>>> 
>>>> Oh, it is a different kind of zero pivot value. There is a zero on the 
>>>> diagonal while it is trying to do SOR.  Should there be zeros on the 
>>>> diagonal of your matrix? 
>>>> 
>>>>  You can use -mg_levels_pc_type jacobi  and it will ignore those zero 
>>>> values.
>>>> 
>>>>  Barry
>>>> 
>>>> 
>>>>> On Sep 19, 2015, at 7:12 PM, Gideon Simpson <[email protected]> 
>>>>> wrote:
>>>>> 
>>>>> I never get to see the output.  When it runs, I get:
>>>>> 
>>>>> 0 SNES Function norm 8.405398322914e-02 
>>>>> [0]PETSC ERROR: --------------------- Error Message 
>>>>> --------------------------------------------------------------
>>>>> [0]PETSC ERROR: Zero pivot in LU factorization: 
>>>>> http://www.mcs.anl.gov/petsc/documentation/faq.html#zeropivot
>>>>> [0]PETSC ERROR: Zero pivot on row 0
>>>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html 
>>>>> for trouble shooting.
>>>>> [0]PETSC ERROR: Petsc Release Version 3.6.1, unknown 
>>>>> [0]PETSC ERROR: ./blowup_refine on a arch-darwin-c-debug named gs_air by 
>>>>> gideon Sat Sep 19 20:11:44 2015
>>>>> [0]PETSC ERROR: Configure options --download-mpich=yes 
>>>>> --download-suitesparse=yes --download-superlu=yes 
>>>>> --download-superlu_dist=yes --download-mumps=yes --download-sprng=yes 
>>>>> --with-cxx=clang++ --with-cc=clang --with-fc=gfortran 
>>>>> --download-metis=yes --download-parmetis=yes --download-scalapack=yes
>>>>> [0]PETSC ERROR: #1 MatSOR_SeqAIJ_Inode() line 2795 in 
>>>>> /opt/petsc/src/mat/impls/aij/seq/inode.c
>>>>> [0]PETSC ERROR: #2 MatSOR_MPIAIJ() line 1496 in 
>>>>> /opt/petsc/src/mat/impls/aij/mpi/mpiaij.c
>>>>> [0]PETSC ERROR: #3 MatSOR() line 3697 in 
>>>>> /opt/petsc/src/mat/interface/matrix.c
>>>>> [0]PETSC ERROR: #4 PCApply_SOR() line 37 in 
>>>>> /opt/petsc/src/ksp/pc/impls/sor/sor.c
>>>>> [0]PETSC ERROR: #5 PCApply() line 483 in 
>>>>> /opt/petsc/src/ksp/pc/interface/precon.c
>>>>> [0]PETSC ERROR: #6 KSP_PCApply() line 242 in 
>>>>> /opt/petsc/include/petsc/private/kspimpl.h
>>>>> [0]PETSC ERROR: #7 KSPInitialResidual() line 63 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itres.c
>>>>> [0]PETSC ERROR: #8 KSPSolve_GMRES() line 235 in 
>>>>> /opt/petsc/src/ksp/ksp/impls/gmres/gmres.c
>>>>> [0]PETSC ERROR: #9 KSPSolve() line 604 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itfunc.c
>>>>> [0]PETSC ERROR: #10 KSPSolve_Chebyshev() line 381 in 
>>>>> /opt/petsc/src/ksp/ksp/impls/cheby/cheby.c
>>>>> [0]PETSC ERROR: #11 KSPSolve() line 604 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itfunc.c
>>>>> [0]PETSC ERROR: #12 PCMGMCycle_Private() line 19 in 
>>>>> /opt/petsc/src/ksp/pc/impls/mg/mg.c
>>>>> [0]PETSC ERROR: #13 PCApply_MG() line 340 in 
>>>>> /opt/petsc/src/ksp/pc/impls/mg/mg.c
>>>>> [0]PETSC ERROR: #14 PCApply() line 483 in 
>>>>> /opt/petsc/src/ksp/pc/interface/precon.c
>>>>> [0]PETSC ERROR: #15 KSP_PCApply() line 242 in 
>>>>> /opt/petsc/include/petsc/private/kspimpl.h
>>>>> [0]PETSC ERROR: #16 KSPInitialResidual() line 63 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itres.c
>>>>> [0]PETSC ERROR: #17 KSPSolve_GMRES() line 235 in 
>>>>> /opt/petsc/src/ksp/ksp/impls/gmres/gmres.c
>>>>> [0]PETSC ERROR: #18 KSPSolve() line 604 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itfunc.c
>>>>> [0]PETSC ERROR: #19 SNESSolve_NEWTONLS() line 233 in 
>>>>> /opt/petsc/src/snes/impls/ls/ls.c
>>>>> [0]PETSC ERROR: #20 SNESSolve() line 3906 in 
>>>>> /opt/petsc/src/snes/interface/snes.c
>>>>> [1]PETSC ERROR: #1 VecNorm_MPI() line 63 in 
>>>>> /opt/petsc/src/vec/vec/impls/mpi/pvec2.c
>>>>> [1]PETSC ERROR: #2 VecNorm() line 242 in 
>>>>> /opt/petsc/src/vec/vec/interface/rvector.c
>>>>> [1]PETSC ERROR: #3 VecNormalize() line 337 in 
>>>>> /opt/petsc/src/vec/vec/interface/rvector.c
>>>>> [1]PETSC ERROR: #4 KSPGMRESCycle() line 127 in 
>>>>> /opt/petsc/src/ksp/ksp/impls/gmres/gmres.c
>>>>> [1]PETSC ERROR: #5 KSPSolve_GMRES() line 236 in 
>>>>> /opt/petsc/src/ksp/ksp/impls/gmres/gmres.c
>>>>> [1]PETSC ERROR: #6 KSPSolve() line 604 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itfunc.c
>>>>> [1]PETSC ERROR: #7 KSPSolve_Chebyshev() line 381 in 
>>>>> /opt/petsc/src/ksp/ksp/impls/cheby/cheby.c
>>>>> [1]PETSC ERROR: #8 KSPSolve() line 604 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itfunc.c
>>>>> [1]PETSC ERROR: #9 PCMGMCycle_Private() line 19 in 
>>>>> /opt/petsc/src/ksp/pc/impls/mg/mg.c
>>>>> [1]PETSC ERROR: #10 PCApply_MG() line 340 in 
>>>>> /opt/petsc/src/ksp/pc/impls/mg/mg.c
>>>>> [1]PETSC ERROR: #11 PCApply() line 483 in 
>>>>> /opt/petsc/src/ksp/pc/interface/precon.c
>>>>> [1]PETSC ERROR: #12 KSP_PCApply() line 242 in 
>>>>> /opt/petsc/include/petsc/private/kspimpl.h
>>>>> [1]PETSC ERROR: #13 KSPInitialResidual() line 63 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itres.c
>>>>> [1]PETSC ERROR: #14 KSPSolve_GMRES() line 235 in 
>>>>> /opt/petsc/src/ksp/ksp/impls/gmres/gmres.c
>>>>> [1]PETSC ERROR: #15 KSPSolve() line 604 in 
>>>>> /opt/petsc/src/ksp/ksp/interface/itfunc.c
>>>>> [1]PETSC ERROR: #16 SNESSolve_NEWTONLS() line 233 in 
>>>>> /opt/petsc/src/snes/impls/ls/ls.c
>>>>> [1]PETSC ERROR: #17 SNESSolve() line 3906 in 
>>>>> /opt/petsc/src/snes/interface/snes.c
>>>>> 
>>>>> and then it just sits there.
>>>>> 
>>>>> -gideon
>>>>> 
>>>>>> On Sep 19, 2015, at 7:18 PM, Matthew Knepley <[email protected]> wrote:
>>>>>> 
>>>>>> On Sat, Sep 19, 2015 at 6:10 PM, Gideon Simpson 
>>>>>> <[email protected]> wrote:
>>>>>> It gives zero pivots on:
>>>>>> 
>>>>>> Send -ksp_view
>>>>>> 
>>>>>> Matt
>>>>>> 
>>>>>> -ksp_type gmres -pc_type gamg -mg_coarse_sub_pc_factor_shift_type NONZERO
>>>>>> 
>>>>>> It has no problem with:
>>>>>> 
>>>>>> -ksp_type gmres -pc_type bjacobi -sub_pc_factor_shift_type NONZERO
>>>>>> 
>>>>>> -gideon
>>>>>> 
>>>>>>> On Sep 19, 2015, at 12:37 AM, Barry Smith <[email protected]> wrote:
>>>>>>> 
>>>>>>> 
>>>>>>>> On Sep 18, 2015, at 10:42 PM, Gideon Simpson 
>>>>>>>> <[email protected]> wrote:
>>>>>>>> 
>>>>>>>> I’m getting a zero pivot in LU factorization error when I use the gamg 
>>>>>>>> preconditioner.  I know there is some issue with my matrix, as I get 
>>>>>>>> the same error if I use pc_type lu in serial, or if I use pc_type 
>>>>>>>> bjacobi in parallel, both of which are corrected by adding 
>>>>>>>> -pc_factor_shift_type NONZERO -sub_pc_factor_shift_type NONZERO, 
>>>>>>>> respectively.  However, I can’t quite seem to figure out the analogous 
>>>>>>>> command to use for the gamg preconditioner.
>>>>>>> 
>>>>>>> You need to figure out the prefix to the option that is added by gamg 
>>>>>>> to set it. One way is to run with the gamg options and -help and grep 
>>>>>>> for factor_shift.
>>>>>>> 
>>>>>>> The option is like something like -mg_coarse_pc_factor_shift_type 
>>>>>>> nonzero or -mg_coarse_sub_pc_factor_shift_type
>>>>>>> 
>>>>>>> Barry
>>>>>>> 
>>>>>>>> 
>>>>>>>> -gideon
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> What most experimenters take for granted before they begin their 
>>>>>> experiments is infinitely more interesting than any results to which 
>>>>>> their experiments lead.
>>>>>> -- Norbert Wiener
>>>>> 
>>>> 
>>> 
>> 
> 

Reply via email to