<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Jan 14, 2019 at 7:55 AM Yaxiong Chen <<a href="mailto:chen2018@purdue.edu">chen2018@purdue.edu</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>
<div id="gmail-m_1415840803616958724compose-container" style="direction:ltr">
<span><span></span></span>
<div>
<div style="direction:ltr">So must I figure out the index of the zero columns and row to get the null space first, And then I remove it to generator Cholesky or LU preconditionor?Is this case, should the nontrivial null space be (1,0,0,0)?</div></div></div></div></blockquote><div><br></div><div>No</div><div><br></div><div>1) If you have a consistent rhs, then CG works as is. However, you should put it in in case your preconditioner introduces nullspace components.</div><div><br></div><div>2) Factorization will NEVER work on singular systems, unless you use SVD, which is only for very small systems.</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><div id="gmail-m_1415840803616958724compose-container" style="direction:ltr"><div>
<div style="direction:ltr">Thanks</div>
<div class="gmail-m_1415840803616958724acompli_signature">Get <a href="https://aka.ms/o0ukef" target="_blank">Outlook for iOS</a></div>
<div class="gmail_quote">_____________________________<br>
From: Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
Sent: Monday, January 14, 2019 2:00 AM<br>
Subject: Re: [petsc-users] PETSC for singular system<br>
To: Yaxiong Chen <<a href="mailto:chen2018@purdue.edu" target="_blank">chen2018@purdue.edu</a>>, PETSc <<a href="mailto:petsc-maint@mcs.anl.gov" target="_blank">petsc-maint@mcs.anl.gov</a>><br>
<br>
<br>
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">On Sun, Jan 13, 2019 at 6:59 PM Yaxiong Chen <<a href="mailto:chen2018@purdue.edu" target="_blank">chen2018@purdue.edu</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_1415840803616958724gmail-m_1377502772708099544divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px">Hello <span style="font-family:Calibri,sans-serif;font-size:14.6667px">Matthew,</span></p>
<p 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>
</p>
<p></p>
<p style="margin-top:0px;margin-bottom:0px"><font face="Calibri, sans-serif"><span style="font-size:14.6667px">Does this mean in PETSC , CG is not suitable for semi positive definite system?</span></font></p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>No, it means factorization is not. CG is fine.</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_1415840803616958724gmail-m_1377502772708099544divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px;margin-bottom:0px"><font face="Calibri, sans-serif"><span style="font-size:14.6667px"> </span></font><font face="Calibri, sans-serif"><span style="font-size:14.6667px">My system is equivalent to a SPD system with arbitrary </span></font><font face="Calibri, sans-serif"><span style="font-size:14.6667px">extra
rows and columns of zeros. I expect the same </span></font><font face="Calibri, sans-serif"><span style="font-size:14.6667px">iteration process will lead to </span></font><span style="font-family:Calibri,sans-serif;font-size:14.6667px">x</span><sup style="font-family:Calibri,sans-serif;font-size:14.6667px">T</sup><font face="Calibri, sans-serif"><span style="font-size:14.6667px">=(0,1,1,1)
with initial guess 0, since the rows of 0 will not influence the corresponding solution. Is this possible to be realized with CG in PETSC?</span></font></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-family:Calibri,sans-serif;font-size:14.6667px"><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-family:Calibri,sans-serif;font-size:14.6667px">Thanks</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-family:Calibri,sans-serif;font-size:14.6667px"><br>
</span></p>
<div id="gmail-m_1415840803616958724gmail-m_1377502772708099544Signature">
<div id="gmail-m_1415840803616958724gmail-m_1377502772708099544divtagdefaultwrapper" 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"></span></p>
<p><span style="color:rgb(33,33,33);font-size:13.3333px">Yaxiong Chen, </span><br>
</p>
<p><span style="color:rgb(33,33,33);font-size:13.3333px">Ph.D. Student </span><br style="color:rgb(33,33,33);font-size:13.3333px">
<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>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="gmail-m_1415840803616958724gmail-m_1377502772708099544divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Sent:</b> Friday, January 11, 2019 2:30 PM<br>
<b>To:</b> Yaxiong Chen<br>
<b>Cc:</b> PETSc<br>
<b>Subject:</b> Re: [petsc-users] PETSC for singular system</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div class="gmail-m_1415840803616958724gmail-m_1377502772708099544x_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" id="gmail-m_1415840803616958724gmail-m_1377502772708099544LPlnk777850" class="gmail-m_1415840803616958724gmail-m_1377502772708099544OWAAutoLink" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote class="gmail-m_1415840803616958724gmail-m_1377502772708099544x_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_1415840803616958724gmail-m_1377502772708099544x_gmail-m_6762688828407887911divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<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_1415840803616958724gmail-m_1377502772708099544x_gmail-m_6762688828407887911img266709" style="max-width: 100%;" src="cid:1684c88e561f456b1e52">.<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_1415840803616958724gmail-m_1377502772708099544x_gmail-m_6762688828407887911img980344" style="max-width: 100%;" src="cid:1684c88e55ff456b1e51"><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-m_1415840803616958724gmail-m_1377502772708099544x_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_1415840803616958724gmail-m_1377502772708099544x_gmail-m_6762688828407887911divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif">
<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_1415840803616958724gmail-m_1377502772708099544x_gmail-m_6762688828407887911Signature">
<div id="gmail-m_1415840803616958724gmail-m_1377502772708099544x_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-m_1415840803616958724gmail-m_1377502772708099544x_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/" id="gmail-m_1415840803616958724gmail-m_1377502772708099544LPlnk294735" class="gmail-m_1415840803616958724gmail-m_1377502772708099544OWAAutoLink" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail-m_1415840803616958724gmail_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>
<br>
<br>
</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>