<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 7, 2015 at 7:32 PM, Gideon Simpson <span dir="ltr"><<a href="mailto:gideon.simpson@gmail.com" target="_blank">gideon.simpson@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 style="word-wrap:break-word">Barry,<div><br></div><div>I finally got a chance to really try using the grid sequencing within my code. I find that, in some cases, even if it can solve successfully on the coarsest mesh, the SNES fails, usually due to a line search failure, when it tries to compute along the grid sequence. Would you have any suggestions?</div></div></blockquote><div><br></div><div>I apologize if I have asked before, but can you give me -snes_view for the solver? I could not find it in the email thread.</div><div><br></div><div>I would suggest trying to fiddle with the line search, or precondition it with Richardson. It would be nice to see -snes_monitor</div><div>for the runs that fail, and then we can break down the residual into fields and look at it again (if my custom residual monitor</div><div>does not work we can write one easily). Seeing which part of the residual does not converge is key to designing the NASM</div><div>for the problem. I have just seen the virtuoso of this, Xiao-Chuan Cai, present it. We need better monitoring in PETSc.</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="word-wrap:break-word"><div><span class="HOEnZb"><font color="#888888"><div>
<span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">-gideon</span>
</div></font></span><div><div class="h5">
<br><div><blockquote type="cite"><div>On Aug 28, 2015, at 4:21 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:</div><br><div><br><blockquote type="cite">On Aug 28, 2015, at 3:04 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" target="_blank">gideon.simpson@gmail.com</a>> wrote:<br><br>Yes, if i continue in this parameter on the coarse mesh, I can generally solve at all values. I do find that I need to do some amount of continuation to solve near the endpoint. The problem is that on the coarse mesh, things are not fully resolved at all the values along the continuation parameter, and I would like to do refinement. <br><br>One subtlety is that I actually want the intermediate continuation solutions too. Currently, without doing any grid sequence, I compute each, write it to disk, and then go on to the next one. So I now need to go back an refine them. I was thinking that perhaps I could refine them on the fly, dump them to disk, and use the coarse solution as the starting guess at the next iteration, but that would seem to require resetting the snes back to the coarse grid.<br><br>The alternative would be to just script the mesh refinement in a post processing stage, where each value of the continuation is parameter is loaded on the coarse mesh, and refined. Perhaps that’s the most practical thing to do.<br></blockquote><br> I would do the following. Create your DM and create a SNES that will do the continuation<br><br> loop over continuation parameter<br><br> SNESSolve(snes,NULL,Ucoarse);<br><br> if (you decide you want to see the refined solution at this continuation point) {<br> SNESCreate(comm,&snesrefine);<br> SNESSetDM()<br> etc<br> SNESSetGridSequence(snesrefine,)<br> SNESSolve(snesrefine,0,Ucoarse);<br> SNESGetSolution(snesrefine,&Ufine);<br> VecView(Ufine or do whatever you want to do with the Ufine at that continuation point<br> SNESDestroy(snesrefine);<br> end if<br><br> end loop over continuation parameter.<br><br> Barry<br><br><blockquote type="cite"><br>-gideon<br><br><blockquote type="cite">On Aug 28, 2015, at 3:55 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>> wrote:<br><br><blockquote type="cite"><br><br>3. This problem is actually part of a continuation problem that roughly looks like this <br><br>for( continuation parameter p = 0 to 1){<br><br><span style="white-space:pre-wrap"> </span>solve with parameter p_i using solution from p_{i-1},<br>}<br><br>What I would like to do is to start the solver, for each value of parameter p_i on the coarse mesh, and then do grid sequencing on that. But it appears that after doing grid sequencing on the initial p_0 = 0, the SNES is set to use the finer mesh.<br></blockquote><br> So you are using continuation to give you a good enough initial guess on the coarse level to even get convergence on the coarse level? First I would check if you even need the continuation (or can you not even solve the coarse problem without it).<br><br> If you do need the continuation then you will need to tweak how you do the grid sequencing. I think this will work: <br><br>Do not use -snes_grid_sequencing <br><br>Run SNESSolve() as many times as you want with your continuation parameter. This will all happen on the coarse mesh.<br><br>Call SNESSetGridSequence()<br><br>Then call SNESSolve() again and it will do one solve on the coarse level and then interpolate to the next level etc.<br></blockquote><br></blockquote><br></div></blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="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>