<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 27, 2014 at 1:40 PM, Sharp Stone <span dir="ltr"><<a href="mailto:thronesf@gmail.com" target="_blank">thronesf@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><div><div>Hi Matt,<br><br></div>Thank you very much for your reply.<br><br></div>The ts_view output is attached below. I found my code results say "SNES has not been set up", and PC "has not been set up". Does this cause the problem? If so I do not see example ex17 explicitly set up the snes object?<br></div></div></blockquote><div><br></div><div>Never ever ever send part of an error message. Send the entire thing copied from the terminal.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div>PS: I don't know why the -ts_view option does not work in my command line, so I use TSView() routine just before the TSSolve() routine.</div></blockquote><div><br></div><div>Always check the return code from all calls. One of your calls is failing and you do not notice.</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><br><br><br>TS output:<br><br>TS Object: 1 MPI processes<br> type: theta<br> maximum steps=100000000<br> maximum time=5e-06<br> total number of nonlinear solver iterations=0<br> total number of nonlinear solve failures=0<br> total number of linear solver iterations=0<br> total number of rejected steps=0<br> Theta=1<br> Extrapolation=no<br> SNES Object: 1 MPI processes<br> type: newtonls<br> SNES has not been set up so information may be incomplete<br> maximum iterations=50, maximum function evaluations=10000<br> tolerances: relative=1e-08, absolute=1e-50, solution=1e-08<br> total number of linear solver iterations=0<br> total number of function evaluations=0<br> SNESLineSearch Object: 1 MPI processes<br> type: bt<br> interpolation: cubic<br> alpha=1.000000e-04<br> maxstep=1.000000e+08, minlambda=1.000000e-12<br> tolerances: relative=1.000000e-08, absolute=1.000000e-15, lambda=1.000000e-08<br> maximum iterations=40<br> KSP Object: 1 MPI processes<br> type: gmres<br> GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement<br> GMRES: happy breakdown tolerance 1e-30<br> maximum iterations=10000, initial guess is zero<br> tolerances: relative=1e-05, absolute=1e-50, divergence=10000<br> left preconditioning<br> using DEFAULT norm type for convergence test<br> PC Object: 1 MPI processes<br> type: ilu<br> PC has not been set up so information may be incomplete<br> ILU: out-of-place factorization<br> 0 levels of fill<br> tolerance for zero pivot 2.22045e-14<br> using diagonal shift on blocks to prevent zero pivot [INBLOCKS]<br> matrix ordering: natural<br> linear system matrix = precond matrix:<br> Mat Object: 1 MPI processes<br> type: seqaij<br> rows=20904, cols=20904, bs=4<br> total: nonzeros=410816, allocated nonzeros=410816<br> total number of mallocs used during MatSetValues calls =0<br> using I-node routines: found 5226 nodes, limit used is 5<br><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 2:13 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@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 class="gmail_extra"><div class="gmail_quote"><span>On Mon, Oct 27, 2014 at 1:11 PM, Sharp Stone <span dir="ltr"><<a href="mailto:thronesf@gmail.com" target="_blank">thronesf@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Matt,<br><br></div><span>Thank you for your reply.<br><br></span></div><span>That's why I am confused and need help. I set printf routines as I run my code, but it never output it on the screen. <br></span></div></div></blockquote><div><br></div><div>Here is one point of confusion:</div><div><br></div><div> 1) TSSetIJacobian() sets a callback routine for creating the Jacobian. This was definitely called</div><div><br></div><div> 2) FormIJacobian() is your function which I assume creates the Jacobian. This is what I think you are saying is not called.</div><div><br></div><div>Not all TS solvers use a linear solve. Your first step is to run with -ts_view so that we can see what solver is actually being used.</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></div>Thanks!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 2:05 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@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 class="gmail_extra"><div class="gmail_quote"><span>On Mon, Oct 27, 2014 at 1:02 PM, Sharp Stone <span dir="ltr"><<a href="mailto:thronesf@gmail.com" target="_blank">thronesf@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><div><div>Hi Matt,<br><br></div>Thank you for your reply and sorry for the confusion.<br><br></div>No. What I was trying to say is my code has never called the TSSetIJacobian() routine. I don't know why this happens, and how to resolve this either.<br></div></div></blockquote><div><br></div></span><div>If your code has not called TSSetIJacobian(), I can only assume it is because you did not put it in. However, in</div><div>the code fragment you sent, it was definitely there.</div><div><br></div><div> Thanks,</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></div>Thank you in advance!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 1:57 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@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 class="gmail_extra"><div class="gmail_quote"><span>On Mon, Oct 27, 2014 at 12:52 PM, Sharp Stone <span dir="ltr"><<a href="mailto:thronesf@gmail.com" target="_blank">thronesf@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><div>Dear All,<br><br></div>I'm using the TS theta solver for backward Euler method. But I found that the TSSetIJacobian() routine has never been called. I did the code just following what the example does: src/ts/examples/tutorials/ex17. I can run the example without errors. But when I run my code, it won't be as good as the example as stated above. I also attached the piece of my setups to this email. <br><br></div>How could I fix this problem? Thank you in advance!<br></div></blockquote><div><br></div></span><div>I cannot understand the paragraph above.</div><div><br></div><div> 1) TS ex17 does call TSSetIJacobian(), unless you choose a matrix-free version. You seem to imply above that it does not.</div><div><br></div><div> 2) Do you mean that you do not call it? You do not have too, since you can use the finite difference approximations offered by SNES</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br> TSCreate(PETSC_COMM_WORLD, &ts);<br> TSSetProblemType(ts, TS_NONLINEAR);<br> TSSetType(ts, TSTHETA);<br> TSThetaSetTheta(ts, 1.0);<br> TSSetIFunction(ts, NULL, FormIFunction, &appctx);<br> DMSetMatType(da, MATAIJ);<br> DMCreateMatrix(da, &J);<br> TSSetDM(ts, da);<br> TSSetIJacobian(ts, J, J, FormIJacobian, &appctx);<br> TSSetDuration(ts, timeStepsMax, Tend); <br> // Evaluate initial conditions<br> FormInitialSolution(&appctx);<br> TSSetSolution(ts, solution); <br> dt = 1.0;<br> TSSetInitialTimeStep(ts, 0.0, dt); <br> TSSolve(ts, solution);<span><font color="#888888"><br clear="all"><div><div><div><br>-- <br><div dir="ltr"><div>Best regards,</div><div><br></div>Feng</div>
</div></div></div></font></span></div>
</blockquote></span></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><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
</font></span></font></span></div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr"><div>Best regards,</div><div><br></div>Feng</div>
</font></span></div>
</blockquote></div></div></div><div><div><br><br clear="all"><span><font color="#888888"><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
</font></span></div></div></div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr"><div>Best regards,</div><div><br></div>Feng</div>
</font></span></div>
</blockquote></div></div></div><div><div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><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
</font></span></div></div></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr"><div>Best regards,</div><div><br></div>Feng</div>
</font></span></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>