<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Barry,<div class=""><br class=""></div><div class="">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 class=""><br class=""><div class="">
<span class="Apple-style-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; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">-gideon</span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Aug 28, 2015, at 4:21 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class=""><blockquote type="cite" class="">On Aug 28, 2015, at 3:04 PM, Gideon Simpson <<a href="mailto:gideon.simpson@gmail.com" class="">gideon.simpson@gmail.com</a>> wrote:<br class=""><br class="">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 class=""><br class="">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 class=""><br class="">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 class=""></blockquote><br class=""> I would do the following. Create your DM and create a SNES that will do the continuation<br class=""><br class=""> loop over continuation parameter<br class=""><br class=""> SNESSolve(snes,NULL,Ucoarse);<br class=""><br class=""> if (you decide you want to see the refined solution at this continuation point) {<br class=""> SNESCreate(comm,&snesrefine);<br class=""> SNESSetDM()<br class=""> etc<br class=""> SNESSetGridSequence(snesrefine,)<br class=""> SNESSolve(snesrefine,0,Ucoarse);<br class=""> SNESGetSolution(snesrefine,&Ufine);<br class=""> VecView(Ufine or do whatever you want to do with the Ufine at that continuation point<br class=""> SNESDestroy(snesrefine);<br class=""> end if<br class=""><br class=""> end loop over continuation parameter.<br class=""><br class=""> Barry<br class=""><br class=""><blockquote type="cite" class=""><br class="">-gideon<br class=""><br class=""><blockquote type="cite" class="">On Aug 28, 2015, at 3:55 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov" class="">bsmith@mcs.anl.gov</a>> wrote:<br class=""><br class=""><blockquote type="cite" class=""><br class=""><br class="">3. This problem is actually part of a continuation problem that roughly looks like this <br class=""><br class="">for( continuation parameter p = 0 to 1){<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>solve with parameter p_i using solution from p_{i-1},<br class="">}<br class=""><br class="">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 class=""></blockquote><br class=""> 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 class=""><br class=""> If you do need the continuation then you will need to tweak how you do the grid sequencing. I think this will work: <br class=""><br class="">Do not use -snes_grid_sequencing <br class=""><br class="">Run SNESSolve() as many times as you want with your continuation parameter. This will all happen on the coarse mesh.<br class=""><br class="">Call SNESSetGridSequence()<br class=""><br class="">Then call SNESSolve() again and it will do one solve on the coarse level and then interpolate to the next level etc.<br class=""></blockquote><br class=""></blockquote><br class=""></div></blockquote></div><br class=""></div></body></html>