<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 18, 2016 at 10:28 PM, 최경준 <span dir="ltr"><<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@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"><div>Dear Matt.</div><div><br></div>I didn't use the command line options because it looked not working.<div><br></div><div>I called SNESSetFromOptions(snes, ier) in my source code,</div><div><br></div><div>but options like -snes_mf or -snes_monitor doesn't look working.</div></div></blockquote><div><br></div><div>I would recommend starting with an example, where these options clearly work (I use SNES ex5</div><div>with these options in my class). Then slowly change that example until you have what you want.</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>Is there anything that I should consider more?</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-19 4:47 GMT+09:00 Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span>:<br><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"><span>On Thu, Aug 18, 2016 at 2:44 PM, 최경준 <span dir="ltr"><<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@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">Is there a part that you considered this as finite-difference approximation?<div>I thought I used matrix-free method with MatCreateSNESMF() function</div></div></blockquote><div><br></div></span><div>You did not tell the SNES to use a MF Jacobian, you just made a Mat object. This is why</div><div> we encourage people to use the command line. Everything is setup correctly and in order.</div><div> Why would you choose not to. This creates long rounds of email.</div><div><br></div><div> Matt</div><div><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>Also I used </div><div>- call PCSetType(pc, PCNONE, ier) --> so the pc type shows 'none' at the log</div><div><br></div><div><br></div><div>I didn't use any of command line options.</div><div><br></div><div><br></div><div>Kyungjun</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-19 4:27 GMT+09:00 Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
You can't use that Jacobian function SNESComputeJacobianDefault with matrix free, it tries to compute the matrix entries and stick them into the matrix. You can use MatMFFDComputeJacobian<br>
<div><div><br>
> On Aug 18, 2016, at 2:03 PM, 최경준 <<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>> wrote:<br>
><br>
> I got stuck at FormJacobian stage.<br>
><br>
> - call SNESComputeJacobianDefault(sne<wbr>s, v, J, pJ, FormResidual, ier) --> J & pJ are same with A matrix-free matrix (input argument)<br>
><br>
><br>
><br>
> with these kind of messages..<br>
><br>
> [0]PETSC ERROR: No support for this operation for this object type<br>
> [0]PETSC ERROR: Mat type mffd<br>
><br>
><br>
><br>
> Guess it's because I used A matrix-free matrix (which is mffd type) into pJ position.<br>
><br>
> Is there any solution for this kind of situation?<br>
><br>
><br>
> 2016-08-19 2:05 GMT+09:00 Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>:<br>
> On Thu, Aug 18, 2016 at 12:04 PM, 최경준 <<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>> wrote:<br>
> Then in order not to use preconditioner,<br>
><br>
> is it ok if I just put A matrix-free matrix (made from MatCreateSNESMF()) into the place where preA should be?<br>
><br>
> Yes, but again the solve will likely perform very poorly.<br>
><br>
> Thanks,<br>
><br>
> Matt<br>
><br>
> The flow goes like this<br>
> - call SNESCreate<br>
> - call SNESSetFunction(snes, r, FormResidual, userctx, ier)<br>
> - call MatCreateSNESMF(snes, A, ier)<br>
> - call SNESSetJacobian(snes, A, A, FormJacobian, userctx, ier)<br>
> - call SNESSetFromOptions()<br>
><br>
> - call SNESGetKSP(snes, ksp, ier)<br>
> - call KSPSetType(ksp, KSPGMRES, ier)<br>
> - call KSPGetPC(ksp, pc, ier)<br>
> - call PCSetType(pc, PCNONE, ier)<br>
> - call KSPGMRESSetRestart(ksp, 30, ier)<br>
><br>
> - call SNESSolve()<br>
> .<br>
> .<br>
><br>
><br>
> and inside the FormJacobian routine<br>
> - call SNESComputeJacobian(snes, v, J, pJ, userctx, ier) --> J and pJ must be pointed with A and A.<br>
><br>
><br>
><br>
> Thank you again,<br>
><br>
> Kyungjun.<br>
><br>
> 2016-08-19 1:44 GMT+09:00 Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>:<br>
> On Thu, Aug 18, 2016 at 11:42 AM, 최경준 <<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>> wrote:<br>
> Thanks for your helpful answers.<br>
><br>
> Here's another question...<br>
><br>
> As I read some example PETSc codes, I noticed that there should be a preconditioning matrix (e.g. approx. jacobian matrix) when using MatCreateSNESMF().<br>
><br>
> I mean,<br>
> after calling MatCreateSNESMF(snes, A, ier),<br>
> there should be another matrix preA(preconditioning matrix) to use SNESSetJacobian(snes, A, preA, FormJacobian, ctx, ier).<br>
><br>
><br>
> 1) Is there any way that I can use matrix-free method without making preconditioning matrix?<br>
><br>
> Don't use a preconditioner. As you might expect, this does not often work out well.<br>
><br>
> 2) I have a reference code, and the code adopts<br>
><br>
> MatFDColoringCreate()<br>
> and finally uses<br>
> SNESComputeJacobianDefaultColo<wbr>r() at FormJacobian stage.<br>
><br>
> But I can't see the inside of the fdcolor and I'm curious of this mechanism. Can you explain this very briefly or tell me an example code that I can refer to. ( I think none of PETSc example code is using fdcolor..)<br>
><br>
> This is the default, so there is no need for all that code. We use naive graph 2-coloring. I think there might be a review article by Alex Pothen about that.<br>
><br>
> Thanks,<br>
><br>
> Matt<br>
><br>
><br>
> Best,<br>
><br>
> Kyungjun.<br>
><br>
> 2016-08-19 0:54 GMT+09:00 Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>:<br>
> On Thu, Aug 18, 2016 at 10:39 AM, 최경준 <<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>> wrote:<br>
> 1) I wanna know the difference between applying option with command line and within source code.<br>
> From my experience, command line option helps set other default settings that I didn't applied, I guess.<br>
><br>
> The command line arguments are applied to an object when *SetFromOptions() is called, so in this case<br>
> you want SNESSetFromOptions() on the solver. There should be no difference from using the API.<br>
><br>
> 2) I made a matrix-free matrix with MatCreateSNESMF function, and every time I check my snes context with SNESView,<br>
><br>
> Mat Object: 1 MPI processes<br>
> type: mffd<br>
> rows=11616, cols=11616<br>
> Matrix-free approximation:<br>
> err=1.49012e-08 (relative error in function evaluation)<br>
> The compute h routine has not yet been set<br>
><br>
> at the end of line shows there's no routine for computing h value.<br>
> I used MatMFFDWPSetComputeNormU function, but it didn't work I think.<br>
> Is it ok if I leave the h value that way? Or should I have to set h computing routine?<br>
><br>
> I am guessing you are calling the function on a different object from the one that is viewed here.<br>
> However, there will always be a default function for computing h.<br>
><br>
> Thanks,<br>
><br>
> Matt<br>
><br>
> Kyungjun.<br>
><br>
> 2016-08-18 23:18 GMT+09:00 Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>:<br>
> On Thu, Aug 18, 2016 at 8:35 AM, 최경준 <<a href="mailto:kyungjun.choi92@gmail.com" target="_blank">kyungjun.choi92@gmail.com</a>> wrote:<br>
> Hi, I'm trying to set my SNES matrix-free with Walker & Pernice way of computing h value.<br>
><br>
> I found above command (MatSNESMFWPSetComputeNormU) but my fortran compiler couldn't fine any reference of that command.<br>
><br>
> I checked Petsc changes log, but there weren't any mentions about that command.<br>
><br>
> Should I have to include another specific header file?<br>
><br>
> We have this function<br>
><br>
> <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMFFDWPSetComputeNormU.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>petsc-current/docs/manualpages<wbr>/Mat/MatMFFDWPSetComputeNormU.<wbr>html</a><br>
><br>
> but I would recommend using the command line option<br>
><br>
> -mat_mffd_compute_normu<br>
><br>
> Thanks,<br>
><br>
> Matt<br>
><br>
> Thank you always.<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>
><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>
><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>
><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>
</blockquote></div></div></div><div><div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div data-smartmail="gmail_signature">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>
</font></span></div></div></div></div>
</blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">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></div>