Turtles on top of turtles on top of turtles.
It is probably easiest for you to look at the actual code to see how it
handles things
1) the SNESFAS uses SNES for each of the levels, for each of these level SNES
you can control the convergence criteria (either from the command lineor with
appropriate prefix (highly recommended) or with function calls (not
recommended)); and even provide your own convergence functions run with
-snes_view to see the various solvers and their prefixes).
2) at the finest level of SNESFAS it does call
/* Test for convergence */
if (isFine) {
ierr =
(*snes->ops->converged)(snes,snes->iter,0.0,0.0,snes->norm,&snes->reason,snes->cnvP);CHKERRQ(ierr);
if (snes->reason) break;
}
src/snes/impls/fas/fas.c line 881 so at least in theory you can provide your
own convergence test function.
It was certainly our intention that users can control all the convergence
knobs for arbitrary imbedded nonlinear solvers including FAS but, of course,
there may be bugs so let us know what doesn't work.
Generally the model for FAS is to run a single (or small number of)
iteration(s) on the level solves and so not directly use convergence tolerances
like rtol to control the number of iterations on a level but you should be able
to set any criteria you want.
You should be able to run with -snes_view and change some of the criteria on
the command line and see the changes presented in the -snes_view output, plus
see differences in convergence behavior.
Barry
> On Aug 5, 2020, at 8:10 PM, Adolfo Rodriguez <[email protected]> wrote:
>
> It looks like I cannot really change the test function or anything else for
> this particular SNES solver (I am using SNESFas). Basically, I am trying to
> use the ideas exposed in the paper on Composing scalable solvers but it seems
> that SNESFas does not allow to change the function for testing convergence,
> or anything else. Is this correct?
>
> Adolfo
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
> Virus-free. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> <x-msg://98/#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> On Wed, Aug 5, 2020 at 3:41 PM Barry Smith <[email protected]
> <mailto:[email protected]>> wrote:
>
> Adolfo,
>
> You can also just change the tolerances for the inner solve using the
> options data base and the prefix for the inner solve.
>
> When you run with -snes_view it will show the prefix for each of the
> (nested) solvers. You can also run with -help to get all the possible options
> for the inner solvers.
>
> In this case I think the prefix is npc so you can set tolerances with
> -npc_snes_rtol <rtol> -npc_ksp_rtol <rtol> etc. From the program you can use
> SNESGetNPC() and then call SNESSetXXX() to set options, for the linear solver
> (if there is one) call SNESGetKSP() on the npc and then set options on that
> KSP.
>
>
> Barry
>
>
>> On Aug 5, 2020, at 3:30 PM, Adolfo Rodriguez <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Jed,
>>
>> I tred your suggestion
>>
>> SNESGetNPC(snes, &inner);
>> SNESSetConvergenceTest(inner, YourFunc, ...);
>>
>> and it is working as expected. I had not pieced together the fact that
>> "inner" is a "snes" object as well.
>>
>> Thanks!
>>
>>
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
>> Virus-free. www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
>> <>
>> On Wed, Aug 5, 2020 at 3:11 PM Jed Brown <[email protected]
>> <mailto:[email protected]>> wrote:
>> Adolfo Rodriguez <[email protected] <mailto:[email protected]>> writes:
>>
>> > Actually I can set the non-linear pc. My problem relates to the convergence
>> > test. I have not found a way to set the tolerances for the inner problem,
>> > are they hard coded?
>>
>> I suggested code to set a custom convergence test. Nothing is hard-coded.
>> What have you done?
>