<div dir="ltr">On Fri, May 24, 2013 at 2:55 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Michele Rosso <<a href="mailto:mrosso@uci.edu">mrosso@uci.edu</a>> writes:<br>
<br>
> Hi Jed,<br>
><br>
> I followed your suggestion by using:<br>
><br>
> -pc_type gamg  -pc_mg_cycle_type v  -pc_gamg_agg_nsmooths 1<br>
><br>
> This works perfectly if I have a non-singular matrix. When instead I use<br>
> periodic conditions for my system ( I set  the nullspace removal<br>
> correctly ),<br>
> I receive an error saying a zero pivot is detected in the LU<br>
> factorization. So, after some research, I found in the mailinglist a fix :<br>
><br>
> -pc_type gamg -pc_mg_cycle_type v -pc_gamg_agg_nsmooths 1<br>
> -mg_coarse_pc_factor_shift_nonzero<br>
<br>
</div>It'll need to be -mg_coarse_sub_pc_factor_shift_nonzero<br>
<br>
With petsc-3.4 (which you should upgrade to), use<br>
-mg_coarse_sub_pc_factor_shift_type NONZERO<br>
<br>
The reason you need this "sub" prefix is that the code always restricts<br>
using block Jacobi (usually localized so that all the entries are in one<br>
block), before applying the direct coarse solver.</blockquote><div><br></div><div style>I think this is less elegant than</div><div style><br></div><div style>  -mg_coarse_pc_type svd</div><div style><br></div><div style>
    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
> Still I am receiving the following error<br>
><br>
><br>
> [0]PETSC ERROR: --------------------- Error Message<br>
> ------------------------------------<br>
> [0]PETSC ERROR: Detected zero pivot in LU factorization:<br>
> see <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#ZeroPivot" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html#ZeroPivot</a>!<br>
> [0]PETSC ERROR: Zero pivot row 280 value 6.5908e-17 tolerance 2.22045e-14!<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 3, Wed Aug 29<br>
> 11:26:24 CDT 2012<br>
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>
> [0]PETSC ERROR: See docs/index.html for manual pages.<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: ./hit on a  named nid09458 by Unknown Fri May 24<br>
> 14:40:48 2013<br>
> [0]PETSC ERROR: Libraries linked from<br>
> [0]PETSC ERROR: Configure run at<br>
> [0]PETSC ERROR: Configure options<br>
> [0]PETSC ERROR:<br>
> ------------------------------------------------------------------------<br>
> [0]PETSC ERROR: MatPivotCheck_none() line 583 in<br>
> src/mat/impls/aij/seq//ptmp/skelly/petsc/3.3.03/cray_interlagos_build/real/src/include/petsc-private/matimpl.h<br>
> [0]PETSC ERROR: MatPivotCheck() line 602 in<br>
> src/mat/impls/aij/seq//ptmp/skelly/petsc/3.3.03/cray_interlagos_build/real/src/include/petsc-private/matimpl.h<br>
> [0]PETSC ERROR: MatLUFactorNumeric_SeqAIJ() line 585 in<br>
> src/mat/impls/aij/seq/aijfact.c<br>
> [0]PETSC ERROR: MatLUFactorNumeric() line 2803 in src/mat/interface/matrix.c<br>
> [0]PETSC ERROR: PCSetUp_LU() line 160 in src/ksp/pc/impls/factor/lu/lu.c<br>
> [0]PETSC ERROR: PCSetUp() line 832 in src/ksp/pc/interface/precon.c<br>
> [0]PETSC ERROR: KSPSetUp() line 278 in src/ksp/ksp/interface/itfunc.c<br>
> [0]PETSC ERROR: PCSetUpOnBlocks_BJacobi_Singleblock() line 715 in<br>
> src/ksp/pc/impls/bjacobi/bjacobi.c<br>
> [0]PETSC ERROR: PCSetUpOnBlocks() line 865 in src/ksp/pc/interface/precon.c<br>
> [0]PETSC ERROR: KSPSetUpOnBlocks() line 154 in<br>
> src/ksp/ksp/interface/itfunc.c<br>
> [0]PETSC ERROR: KSPSolve() line 403 in src/ksp/ksp/interface/itfunc.c<br>
> [0]PETSC ERROR: PCMGMCycle_Private() line 20 in src/ksp/pc/impls/mg/mg.c<br>
> [0]PETSC ERROR: PCMGMCycle_Private() line 49 in src/ksp/pc/impls/mg/mg.c<br>
> [0]PETSC ERROR: PCMGMCycle_Private() line 49 in src/ksp/pc/impls/mg/mg.c<br>
> [0]PETSC ERROR: PCMGMCycle_Private() line 49 in src/ksp/pc/impls/mg/mg.c<br>
> [0]PETSC ERROR: PCApply_MG() line 326 in src/ksp/pc/impls/mg/mg.c<br>
> [0]PETSC ERROR: PCApply() line 384 in src/ksp/pc/interface/precon.c<br>
> [0]PETSC ERROR: KSPSolve_CG() line 139 in src/ksp/ksp/impls/cg/cg.c<br>
> [0]PETSC ERROR: KSPSolve() line 446 in src/ksp/ksp/interface/itfunc.c<br>
><br>
> What could the reason be?<br>
> Thank you,<br>
><br>
> Michele<br>
><br>
><br>
><br>
> On 05/17/2013 07:35 PM, Michele Rosso wrote:<br>
>> Thank you very much. I will try and let you know.<br>
>><br>
>> Michele<br>
>><br>
>> On 05/17/2013 07:01 PM, Jed Brown wrote:<br>
>>> Michele Rosso<<a href="mailto:mrosso@uci.edu">mrosso@uci.edu</a>>  writes:<br>
>>><br>
>>>> I noticed that the problem appears even if I use CG with the default<br>
>>>> preconditioner: commenting KSPSetDM() solves the problem.<br>
>>> Okay, this issue can't show up if you use SNES, but it's a consequence<br>
>>> of making geometric multigrid work with a pure KSP interface.  You can<br>
>>> either use KSPSetComputeOperators() to put your assembly in a function<br>
>>> (which will also be called on coarse levels if you use -pc_type mg<br>
>>> without Galerkin coarse operators) or you can can provide the Jacobian<br>
>>> using KSPSetOperators() as usual, but also call KSPSetDMActive() so that<br>
>>> the DM is not used for computing/updating the Jacobian.<br>
>>><br>
>>> The logic is cleaner in petsc-3.4 and I think it just does the right<br>
>>> thing in your case.<br>
>>><br>
>>>> So basically without a proper grid (it seems no grid with an even<br>
>>>> numbers of nodes qualifies) and with my own system matrix, I cannot use<br>
>>>> any type of multigrid<br>
>>>> pre-conditioner?<br>
>>> You can use all the AMG methods without setting a DM.<br>
>>><br>
>><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>