[petsc-users] pcfieldsplit for a composite dm with multiple subfields
Gideon Simpson
gideon.simpson at gmail.com
Fri Aug 28 16:35:35 CDT 2015
Hi Barry,
Ok, I tried that and it works as intended, but there’s something I noticed. If i use that, and do a SNESGetConvergedReason on the snesrefine, it always seems to return 0. Is there a reason for that?
-gideon
> On Aug 28, 2015, at 4:21 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>>
>> On Aug 28, 2015, at 3:04 PM, Gideon Simpson <gideon.simpson at gmail.com> wrote:
>>
>> 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.
>>
>> 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.
>>
>> 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.
>
> I would do the following. Create your DM and create a SNES that will do the continuation
>
> loop over continuation parameter
>
> SNESSolve(snes,NULL,Ucoarse);
>
> if (you decide you want to see the refined solution at this continuation point) {
> SNESCreate(comm,&snesrefine);
> SNESSetDM()
> etc
> SNESSetGridSequence(snesrefine,)
> SNESSolve(snesrefine,0,Ucoarse);
> SNESGetSolution(snesrefine,&Ufine);
> VecView(Ufine or do whatever you want to do with the Ufine at that continuation point
> SNESDestroy(snesrefine);
> end if
>
> end loop over continuation parameter.
>
> Barry
>
>>
>> -gideon
>>
>>> On Aug 28, 2015, at 3:55 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>
>>>>
>>>>
>>>> 3. This problem is actually part of a continuation problem that roughly looks like this
>>>>
>>>> for( continuation parameter p = 0 to 1){
>>>>
>>>> solve with parameter p_i using solution from p_{i-1},
>>>> }
>>>>
>>>> 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.
>>>
>>> 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).
>>>
>>> If you do need the continuation then you will need to tweak how you do the grid sequencing. I think this will work:
>>>
>>> Do not use -snes_grid_sequencing
>>>
>>> Run SNESSolve() as many times as you want with your continuation parameter. This will all happen on the coarse mesh.
>>>
>>> Call SNESSetGridSequence()
>>>
>>> Then call SNESSolve() again and it will do one solve on the coarse level and then interpolate to the next level etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150828/b37dea45/attachment-0001.html>
More information about the petsc-users
mailing list