<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 28, 2014 at 2:10 PM, Xiangdong <span dir="ltr"><<a href="mailto:epscodes@gmail.com" target="_blank">epscodes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 28, 2014 at 4:48 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
On Feb 28, 2014, at 3:27 PM, Xiangdong <<a href="mailto:epscodes@gmail.com" target="_blank">epscodes@gmail.com</a>> wrote:<br>
<br>
><br>
><br>
><br>
> On Fri, Feb 28, 2014 at 4:21 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
> On Fri, Feb 28, 2014 at 1:16 PM, Xiangdong <<a href="mailto:epscodes@gmail.com" target="_blank">epscodes@gmail.com</a>> wrote:<br>
> If I assembly the matrix with MatSetValuesStencil and use KspSetOpreators for Ksp, do I need to call KspSetDM first?<br>
><br>
> No<br>
><br>
> What is the key difference or advantage of using KspSetComputeOperators against KspSetOperators?<br>
><br>
> With the later, you have to manage creating and preallocating the matrix.<br>
><br>
> If I use DMCreateMatrix and MatSetValuesStencil, I do not need to preallocate the matrix.<br>
<br>
</div>   Correct.<br>
<br>
   The SetComputeOperators and KSPSetDM is useful if you wish to use multigrid on system since PCMG will call your compute operators function on each level for you automatically. See src/ksp/ksp/examples/tutorials/ ex25.c ex28.c ex29.c ex31.c ex32.c ex34.c ex45.c ex50.c   If you are just solving the one system and not using multigrid then there is no particular advantage in SetComputeOperators and KSPSetDM<br>

</blockquote><div><br></div><div>If I want to use multigrid as a preconditioner, I have to call KspSetComputeOperators. Is this true?</div></div></div></div></blockquote><div><br></div><div>No, you can always do everything by hand, but that call simplifies the job.</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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Thank you.</div>
<div><br></div><div>Xiangdong</div><div><br></div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><font color="#888888"><br>
   Barry<br>
</font></span><div><div><br>
><br>
> Xiangdong<br>
><br>
><br>
><br>
><br>
>    Matt<br>
><br>
> Thanks you.<br>
><br>
> Xiangdong<br>
><br>
><br>
> On Tue, Feb 25, 2014 at 4:24 PM, Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<br>
> Xiangdong <<a href="mailto:epscodes@gmail.com" target="_blank">epscodes@gmail.com</a>> writes:<br>
> > I am not clear about this. In this example, where is the format declaration<br>
> > (e.g.,mpiaij) of Mat jac? Why is this mat jac always distributed in<br>
> > a compatible way as the DM vectors?<br>
><br>
> src/ksp/ksp/examples/tutorials/ex25.c calls KSPSetDM and sets functions<br>
> to assemble the matrices and right hand side.  Those objects are created<br>
> internally (you can use -dm_mat_type sbaij if you like) and the user<br>
> doesn't have to see them.<br>
><br>
><br>
><br>
><br>
> --<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<br>
><br>
<br>
</div></div></blockquote></div><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>