<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 8:24 AM, 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"><div><div class="h5">On Tue, Nov 3, 2015 at 9:12 AM, Zou (Non-US), Ling <span dir="ltr"><<a href="mailto:ling.zou@inl.gov" target="_blank">ling.zou@inl.gov</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">Matt, thanks for the reply.<div>The simulation is a transient simulation, which eventually converges to a steady-state solution, given enough simulation time.</div><div>My code runs fine and I could tell the simulation reaches steady state by looking at the residual monitored by SNES monitor function.</div><div><br></div><div>See an example screen output</div><div><br></div><div><p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 90, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 8.85. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 1.47538E-02</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 8.06971E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 91, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 8.95. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 1.10861E-02</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 6.26584E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 92, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.05. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 7.21253E-03</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 9.93402E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 93, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.15. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 5.40260E-03</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 6.21162E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 94, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.25. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 3.40214E-03</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 6.16805E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 95, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.35. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 2.29656E-03</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 6.19337E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 96, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.45. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 1.53218E-03</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 5.94845E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 97, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.55. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 1.32136E-03</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 6.19933E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 98, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.65. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 7.09342E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 1, SNES Function norm = 6.18694E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 99, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.75. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 5.49192E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 100, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.85. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 5.49192E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">converged, time step increased = 0.1</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Solving time step 101, using BDF1, dt = 0.1. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)">Current time (the starting time of this time step) = 9.95. </p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> NL step = 0, SNES Function norm = 5.49192E-04</p>
<p style="margin:0px;font-size:14px;font-family:Monaco;color:rgb(245,245,245);background-color:rgb(0,0,0)"> total_FunctionCall_number: 0 </p></div><div><br></div><div>I observed that after time step 99, the residual never changed, so I believe the transient simulation converges at time step 99.</div><div>I wonder can I use the criterion "SNES converges and it takes 0 iteration" to say the simulation reaches a steady state. Such that I don't have to look at the screen and the code knows it converges and should stop.</div><div><br></div><div>Put it another way, what's the common way people would implement a scheme to detect a transient simulation reaches steady state.</div></div></blockquote><div><br></div></div></div><div>I don't think so. The above makes no sense to me. You are signaling SNES convergence with a relative</div><div>residual norm of 5e-4? That does not sound precise enough to me.</div><div><br></div></div></div></div></blockquote><div>I would argue that number (5.e-4) depends on the problem you are solving (actually I am solving).</div><div>The initial residual of the problem starts at ~1e8.</div><div>But you might be right, and I have to think about this issue more carefully.</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></div><div>As I said, I think the believable way to find steady states is to look for solutions to the algebraic equations,</div><div>perhaps by using timestepping as a preconditioner.</div><div><br></div></div></div></div></blockquote><div>You still need a numerical criterion to let the code understand it converges, right? For example, "a set of solutions have already been found to satisfy the algebraic equations because ___residuals drops below (a number here)__". </div><div><br></div><div>Thanks,</div><div><br></div><div>Ling</div><div><br></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></div><div> Thanks,</div><div><br></div><div> Matt</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks,</div><div><br></div><div>Ling</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 5:25 AM, 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, Nov 2, 2015 at 7:29 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"><br>
> On Oct 30, 2015, at 12:23 PM, Zou (Non-US), Ling <<a href="mailto:ling.zou@inl.gov" target="_blank">ling.zou@inl.gov</a>> wrote:<br>
><br>
> Hi All,<br>
><br>
> From physics point of view, I know my simulation converges if nothing changes any more.<br>
><br>
> I wonder how normally you do to detect if your simulation reaches steady state from numerical point of view.<br>
> Is it a good practice to use SNES convergence as a criterion, i.e.,<br>
> SNES converges and it takes 0 iteration(s)<br>
<br>
Depends on the time integrator and SNES tolerance you are using. If you use a -snes_rtol 1.e-5 it will always try to squeeze 5 MORE digits out of the residual so won't take 0 iterations even if there is only a small change in the solution.<br></blockquote><div><br></div></span><div>There are two different situations here:</div><div><br></div><div> 1) Solving for a mathematical steady state. You remove the time derivative and solve the algebraic system with SNES. Then</div><div> the SNES tolerance is a good measure.</div><div><br></div><div> 2) Use timestepping to advance until nothing looks like it is changing. This is a "physical" steady state.</div><div><br></div><div>You can use 1) with a timestepping preconditioner TSPSEUDO, which is what I would recommend if you</div><div>want a true steady state.</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">
><br>
> Thanks,<br>
><br>
> Ling<br>
<br><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br><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>
</font></span></font></span></div></div>
</blockquote></div><br></div>
</blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><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></div></div></div>
</blockquote></div><br></div></div>