<div dir="ltr">On Fri, May 24, 2013 at 4:46 PM, Michele Rosso <span dir="ltr"><<a href="mailto:mrosso@uci.edu" target="_blank">mrosso@uci.edu</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 text="#000000" bgcolor="#FFFFFF">
    <font face="Ubuntu">In both cases I used -ksp_view and -option_left.<br>
      <br>
      For case 1 (</font> <font face="Ubuntu"><font face="Ubuntu">-pc_type
        gamg -pc_mg_cycle_type v -pc_gamg_agg_nsmooths 1  </font><font face="Ubuntu">-mg_coarse_sub_pc_factor_shift_nonzero ) I posted
        the only output I had.<br>
        <br>
        For case 2 (</font></font> <font face="Ubuntu"><font face="Ubuntu"><font face="Ubuntu">-pc_type gamg
          -pc_mg_cycle_type v -pc_gamg_agg_nsmooths 1 -mg_coarse_pc_type
          svd) the output was too long to fit into an e-mail.<br>
          Please find it attached.<br></font></font></font></div></blockquote><div><br></div><div style>It looks like you are running in parallel (never do this until everything works in serial), which probably means you are using</div>
<div style>PCREDUNDANT for the coarse PC, so you need what Jed suggested:</div><div style><br></div><div style>  -mg_coarse_sub_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 text="#000000" bgcolor="#FFFFFF"><font face="Ubuntu"><font face="Ubuntu"><font face="Ubuntu">
          Michele<br>
        </font><br>
      </font></font>
    <div>On 05/24/2013 02:37 PM, Matthew Knepley
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">On Fri, May 24, 2013 at 4:35 PM, Michele Rosso <span dir="ltr"><<a href="mailto:mrosso@uci.edu" target="_blank">mrosso@uci.edu</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 text="#000000" bgcolor="#FFFFFF"> <font face="Ubuntu">I tried <br>
                </font><br>
                <font face="Ubuntu"><font face="Ubuntu">-pc_type gamg
                    -pc_mg_cycle_type v -pc_gamg_agg_nsmooths 1  </font><font face="Ubuntu">-mg_coarse_sub_pc_factor_shift_nonzero<br>
                    <br>
                    but I still get <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.58999e-17
                    tolerance 2.22045e-14!<br>
                    [0]PETSC ERROR:
                    ------------------------------------------------------------------------<br>
                    [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch
                    3, Wed Aug 29 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>
                    [0]PETSC ERROR: ./hit on a  named nid21818 by
                    Unknown Fri May 24 16:08:33 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>
                    [0]PETSC ERROR: MatPivotCheck_none() line 583 in
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
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 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
                    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
                    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>
                    <br>
                    If instead I use <br>
                    <br>
                  </font>-pc_type gamg -pc_mg_cycle_type v
                  -pc_gamg_agg_nsmooths 1 -mg_coarse_pc_type svd <br>
                  <br>
                  as Matthew suggested, I am told that there is an
                  invalid argument.<br>
                </font></div>
            </blockquote>
            <div><br>
            </div>
            <div>1) When you send these in, we need to see
              -ksp_view, so we know what is begin used</div>
            <div>
              <br>
            </div>
            <div>2) This is not enough information above. I use
              this all the time, or I would not have suggested it</div>
            <div><br>
            </div>
            <div>   Matt</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div text="#000000" bgcolor="#FFFFFF"><font face="Ubuntu">
                  Michele<br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                </font><font face="Ubuntu"><br>
                  <br>
                </font>
                <div>On 05/24/2013 01:04 PM, Matthew Knepley wrote:<br>
                </div>
                <blockquote type="cite">
                  <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>Michele Rosso <<a href="mailto:mrosso@uci.edu" target="_blank">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>I think this is less elegant than</div>
                        <div><br>
                        </div>
                        <div>  -mg_coarse_pc_type svd</div>
                        <div><br>
                        </div>
                        <div>     Matt</div>
                        <div> </div>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div>
                            <div> > 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" target="_blank">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"><span class="HOEnZb"><font color="#888888">
                      <span><font color="#888888">
                          <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 </font></span></font></span></div><span class="HOEnZb"><font color="#888888">
                  </font></span></div><span class="HOEnZb"><font color="#888888">
                </font></span></blockquote><span class="HOEnZb"><font color="#888888">
                <br>
              </font></span></div><span class="HOEnZb"><font color="#888888">
            </font></span></blockquote><span class="HOEnZb"><font color="#888888">
          </font></span></div><span class="HOEnZb"><font color="#888888">
          <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
        </font></span></div>
      </div>
    </blockquote>
    <br>
  </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>