<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Mar 24, 2018 at 8:15 AM, 我 <span dir="ltr"><<a href="mailto:dayedut123@163.com" target="_blank">dayedut123@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi Matt,<br>Sorry to distribute you again. I still have trouble with KSPComputeExplicitOperator. I reduced the matrix size to around 1000*1000. The time-cost of this function is acceptable, but when I output the preconditioned matrix, all the values are equal to zero! Here is part of my codes, do I operate error with this function?<br><br>PC pc;<br>KSP ksp;<br>Mat A,PA;<br>Vec b,x;<br>ierr=KSPCreate(PETSC_COMM_<wbr>WORLD,&ksp);CHKERRQ(ierr);<br>ierr=KSPSetOperators(ksp,A,A);<wbr>CHKERRQ(ierr);<br>ierr=KSPGetPC(ksp,&pc);<wbr>CHKERRQ(ierr);<br>ierr=PCSetType(pc,PCHYPRE);<wbr>CHKERRQ(ierr);<br>ierr=KSPSetType(ksp,KSPGMRES);<wbr>CHKERRQ(ierr);<br>ierr=KSPSetFromOptions(ksp);<wbr>CHKERRQ(ierr);<br>ierr=KSPSolve(ksp,b,x);<wbr>CHKERRQ(ierr);<br>ierr=<wbr>KSPComputeExplicitOperator(<wbr>ksp,&PA);<br></div></div></blockquote><div><br></div><div>There is no need to assemble the output matrix.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>ierr=MatAssemblyBegin(PA,MAT_<wbr>FINAL_ASSEMBLY);CHKERRQ(ierr);<br>ierr=MatAssemblyEnd(PA,MAT_<wbr>FINAL_ASSEMBLY);CHKERRQ(ierr);<br></div></div></blockquote><div><br></div><div>What kind of viewer are you using? The code above should work. I would step through</div><div>in the debugger to see why one column is all zeros, or try it in an example like</div><div>SNES ex5 to make sure its not a problem in your code.</div><div><br></div><div>  Thanks,</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 style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>ierr=MatView(PA,viewer);<wbr>CHKERRQ(ierr);<br><br>Thank you very much!<br>Daye<br><br></div><br><br><br><br><div style="zoom:1"></div><div id="m_-7017123387310291066divNeteaseMailCard"></div><br>At 2018-03-23 07:41:26, "Matthew Knepley" <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br> <blockquote id="m_-7017123387310291066isReplyContent" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 22, 2018 at 8:29 PM, 我 <span dir="ltr"><<a href="mailto:dayedut123@163.com" target="_blank">dayedut123@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi all,<br>I want to analyze the preconditioned matrix. But the KSPComputeExplicitOperator costs too much time to obtain the matrix. My origin matrix is about 3000*3000 sparse one. I noticed this function is applicable for the relative small system. What's the matrix-size limitation for this function? And for my case, any suggestions to solve it with less time?<br></div></div></blockquote><div><br></div><div>This is just a really expensive operation. There is no way around 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 style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Thank you very much!<br>daye <a name="m_-7017123387310291066_m_6587389865708374460_KSPComputeExplicitOperator"><h1><br></h1></a></div></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-7017123387310291066gmail_signature" data-smartmail="gmail_signature"><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.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~<wbr>knepley/</a><br></div></div></div></div></div>
</font></span></div></div>
</blockquote></div><br><br><span title="neteasefooter"><p> </p></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><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.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>