<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Jan 11, 2019 at 10:04 AM Yaxiong Chen via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_6762688828407887911divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px">Hello, </p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">I am trying to use PETSC to solve a singular system like the following.</p>
<p style="margin-top:0px;margin-bottom:0px"><img size="3538" id="gmail-m_6762688828407887911img266709" style="max-width: 99.9%;" src="cid:1683e637c24f456b1e52">.<br>
</p>
<p style="margin-top:0px;margin-bottom:0px">This equals inserting rows and columns at arbitrary place(Actually I even don't know whether it is singular or not. Sometimes some degree of freedom x_i may not participate in the global matrix)</p>
<p style="margin-top:0px;margin-bottom:0px"><img size="2573" id="gmail-m_6762688828407887911img980344" style="max-width: 99.9%;" src="cid:1683e637c24f456b1e51"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">I searched some discussion online and tried to remove the nullspace with the following code:</p>
<p style="margin-top:0px;margin-bottom:0px"></p>
<div>     call KSPCreate(PETSC_COMM_WORLD,ksp,ierr)</div>
<div>     call KSPSetOperators(ksp,Amat,Amat,ierr)</div>
<div>     call KSPSetFromOptions(ksp,ierr)</div>
<div>     call KSPSetType(ksp, KSPCG,ierr) </div>
<div>     call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE, 0, dummyVecs, nullspace, ierr)</div>
<div>     call MatSetNullSpace(Amat,nullspace,ierr)</div>
<div>     call MatNullSpaceDestroy(nullspace,ierr)</div>
<div></div>
<div>     call KSPSolve(ksp,bvec,xvec,ierr)</div>
<div><br>
</div>
<div>But it still gives me some error saying <span style="font-variant-ligatures:no-common-ligatures;font-family:Menlo;font-size:11px">Zero pivot in LU factorization.</span></div>
<div><span style="font-family:Calibri,Helvetica,sans-serif,Helvetica,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">I am just wondering how MatSetNullSpace() can handle
 this?</span></div></div></div></blockquote><div><br></div><div>If you give the nullspace, the Kryloc method will work. However, you still cannot use factorization. So</div><div><br></div><div>1) -ksp_type gmres -pc_type jacobi will solve your system</div><div><br></div><div>2) -ksp_type gmres -pc_type svd will solve your system</div><div><br></div><div>Saying anything more general than that is really not possible.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div id="gmail-m_6762688828407887911divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<div><span style="font-family:Calibri,Helvetica,sans-serif,Helvetica,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px">Thanks</span></div>
<div><span style="font-family:Calibri,Helvetica,sans-serif,Helvetica,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size:16px"><br>
</span></div>
<p></p>
<div id="gmail-m_6762688828407887911Signature">
<div id="gmail-m_6762688828407887911divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p><span style="color:rgb(33,33,33);font-size:13.3333px">Yaxiong Chen, </span><br style="color:rgb(33,33,33);font-size:13.3333px">
<span style="font-size:13.3333px"></span></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-size:13.3333px">School of Mechanical Engineering, 3171 </span></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-size:13.3333px"><span style="color:rgb(34,34,34);font-family:Roboto,arial,sans-serif;font-size:13px">585 Purdue Mall</span></span></p>
<p style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-size:13.3333px">West Lafayette, IN 47907</span></p>
<div><span style="font-size:13.3333px"><br>
</span></div>
<p></p>
<p><br style="color:rgb(33,33,33);font-size:13.3333px">
<br>
</p>
</div>
</div>
</div>
</div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>