PETsc return code if krylof solver did not converge

Asked by Renier Marchand on 2010-04-14

Is it possible to receive some sorf of error feedback when a solution did not converge while using the Krylov solver. A warning is printed by the PETsc solver that it did not converge, but I can't seem to find a way to detect this programatically. The solve method returns a Function even if the solver did not converge.

Thank you

Renier

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
2010-04-16
Last reply:
2010-04-29
Anders Logg (logg) said : #1

On Wed, Apr 14, 2010 at 07:17:44AM -0000, bluejerry wrote:
> New question #107349 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/107349
>
> Is it possible to receive some sorf of error feedback when a solution did not converge while using the Krylov solver. A warning is printed by the PETsc solver that it did not converge, but I can't seem to find a way to detect this programatically. The solve method returns a Function even if the solver did not converge.
>
> Thank you
>
> Renier

We had a similar problem with the Newton solver last week. It didn't
converge but we thought it did.

I would also like to see an error when the solver doesn't converge.

--
Anders

Garth Wells (garth-wells) said : #2

On 14/04/10 17:17, Anders Logg wrote:
> On Wed, Apr 14, 2010 at 07:17:44AM -0000, bluejerry wrote:
>> New question #107349 on DOLFIN:
>> https://answers.launchpad.net/dolfin/+question/107349
>>
>> Is it possible to receive some sorf of error feedback when a solution did not converge while using the Krylov solver. A warning is printed by the PETsc solver that it did not converge, but I can't seem to find a way to detect this programatically. The solve method returns a Function even if the solver did not converge.
>>
>> Thank you
>>
>> Renier
>
> We had a similar problem with the Newton solver last week. It didn't
> converge but we thought it did.
>
> I would also like to see an error when the solver doesn't converge.
>

Just an error is bad. Presently, a warning message is printed, but we
can add a parameter to switch between error/warning.

Garth

> --
> Anders
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp

Anders Logg (logg) said : #3

On Wed, Apr 14, 2010 at 09:33:20AM -0000, Garth Wells wrote:
> Question #107349 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/107349
>
> Garth Wells proposed the following answer:
>
> On 14/04/10 17:17, Anders Logg wrote:
> > On Wed, Apr 14, 2010 at 07:17:44AM -0000, bluejerry wrote:
> >> New question #107349 on DOLFIN:
> >> https://answers.launchpad.net/dolfin/+question/107349
> >>
> >> Is it possible to receive some sorf of error feedback when a solution did not converge while using the Krylov solver. A warning is printed by the PETsc solver that it did not converge, but I can't seem to find a way to detect this programatically. The solve method returns a Function even if the solver did not converge.
> >>
> >> Thank you
> >>
> >> Renier
> >
> > We had a similar problem with the Newton solver last week. It didn't
> > converge but we thought it did.
> >
> > I would also like to see an error when the solver doesn't converge.
> >
>
> Just an error is bad. Presently, a warning message is printed, but we
> can add a parameter to switch between error/warning.

Sounds good. I think it should be set to error by default with the
possibility to change it to a warning. That is safest for first time
users. Someone with a little more experience would check for
convergence and have a strategy for handling the case where things
don't converge (change of parameters, time step etc).

--
Anders

Anders Logg (logg) said : #4

On Wed, Apr 14, 2010 at 11:50:36AM +0200, Anders Logg wrote:
> On Wed, Apr 14, 2010 at 09:33:20AM -0000, Garth Wells wrote:
> > Question #107349 on DOLFIN changed:
> > https://answers.launchpad.net/dolfin/+question/107349
> >
> > Garth Wells proposed the following answer:
> >
> > On 14/04/10 17:17, Anders Logg wrote:
> > > On Wed, Apr 14, 2010 at 07:17:44AM -0000, bluejerry wrote:
> > >> New question #107349 on DOLFIN:
> > >> https://answers.launchpad.net/dolfin/+question/107349
> > >>
> > >> Is it possible to receive some sorf of error feedback when a solution did not converge while using the Krylov solver. A warning is printed by the PETsc solver that it did not converge, but I can't seem to find a way to detect this programatically. The solve method returns a Function even if the solver did not converge.
> > >>
> > >> Thank you
> > >>
> > >> Renier
> > >
> > > We had a similar problem with the Newton solver last week. It didn't
> > > converge but we thought it did.
> > >
> > > I would also like to see an error when the solver doesn't converge.
> > >
> >
> > Just an error is bad. Presently, a warning message is printed, but we
> > can add a parameter to switch between error/warning.
>
> Sounds good. I think it should be set to error by default with the
> possibility to change it to a warning. That is safest for first time
> users. Someone with a little more experience would check for
> convergence and have a strategy for handling the case where things
> don't converge (change of parameters, time step etc).

Done. The parameter name is "error_on_nonconvergence".

--
Anders

Renier Marchand (renierm) said : #5

Thanks that looks better.

I assume this is to be set in the 'krylov_solver' submenu? If so it is not
in the parameter options (KeyError) in my last bzr pull (today)

Unless there is something I am missing.

Renier

On Thu, Apr 15, 2010 at 9:00 PM, Anders Logg <
<email address hidden>> wrote:

> Question #107349 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/107349
>
> Anders Logg proposed the following answer:
> On Wed, Apr 14, 2010 at 11:50:36AM +0200, Anders Logg wrote:
> > On Wed, Apr 14, 2010 at 09:33:20AM -0000, Garth Wells wrote:
> > > Question #107349 on DOLFIN changed:
> > > https://answers.launchpad.net/dolfin/+question/107349
> > >
> > > Garth Wells proposed the following answer:
> > >
> > > On 14/04/10 17:17, Anders Logg wrote:
> > > > On Wed, Apr 14, 2010 at 07:17:44AM -0000, bluejerry wrote:
> > > >> New question #107349 on DOLFIN:
> > > >> https://answers.launchpad.net/dolfin/+question/107349
> > > >>
> > > >> Is it possible to receive some sorf of error feedback when a
> solution did not converge while using the Krylov solver. A warning is
> printed by the PETsc solver that it did not converge, but I can't seem to
> find a way to detect this programatically. The solve method returns a
> Function even if the solver did not converge.
> > > >>
> > > >> Thank you
> > > >>
> > > >> Renier
> > > >
> > > > We had a similar problem with the Newton solver last week. It didn't
> > > > converge but we thought it did.
> > > >
> > > > I would also like to see an error when the solver doesn't converge.
> > > >
> > >
> > > Just an error is bad. Presently, a warning message is printed, but we
> > > can add a parameter to switch between error/warning.
> >
> > Sounds good. I think it should be set to error by default with the
> > possibility to change it to a warning. That is safest for first time
> > users. Someone with a little more experience would check for
> > convergence and have a strategy for handling the case where things
> > don't converge (change of parameters, time step etc).
>
> Done. The parameter name is "error_on_nonconvergence".
>
> --
> Anders
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp
>

Anders Logg (logg) said : #6

It's a global parameter now valid for both the Krylov and Newton
solvers, but perhaps it should be a local paramer. Opinions?

--
Anders

On Fri, Apr 16, 2010 at 01:33:26PM -0000, bluejerry wrote:
> Question #107349 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/107349
>
> Status: Answered => Open
>
> bluejerry is still having a problem:
> Thanks that looks better.
>
> I assume this is to be set in the 'krylov_solver' submenu? If so it is not
> in the parameter options (KeyError) in my last bzr pull (today)
>
> Unless there is something I am missing.
>
> Renier
>
> On Thu, Apr 15, 2010 at 9:00 PM, Anders Logg <
> <email address hidden>> wrote:
>
> > Question #107349 on DOLFIN changed:
> > https://answers.launchpad.net/dolfin/+question/107349
> >
> > Anders Logg proposed the following answer:
> > On Wed, Apr 14, 2010 at 11:50:36AM +0200, Anders Logg wrote:
> > > On Wed, Apr 14, 2010 at 09:33:20AM -0000, Garth Wells wrote:
> > > > Question #107349 on DOLFIN changed:
> > > > https://answers.launchpad.net/dolfin/+question/107349
> > > >
> > > > Garth Wells proposed the following answer:
> > > >
> > > > On 14/04/10 17:17, Anders Logg wrote:
> > > > > On Wed, Apr 14, 2010 at 07:17:44AM -0000, bluejerry wrote:
> > > > >> New question #107349 on DOLFIN:
> > > > >> https://answers.launchpad.net/dolfin/+question/107349
> > > > >>
> > > > >> Is it possible to receive some sorf of error feedback when a
> > solution did not converge while using the Krylov solver. A warning is
> > printed by the PETsc solver that it did not converge, but I can't seem to
> > find a way to detect this programatically. The solve method returns a
> > Function even if the solver did not converge.
> > > > >>
> > > > >> Thank you
> > > > >>
> > > > >> Renier
> > > > >
> > > > > We had a similar problem with the Newton solver last week. It didn't
> > > > > converge but we thought it did.
> > > > >
> > > > > I would also like to see an error when the solver doesn't converge.
> > > > >
> > > >
> > > > Just an error is bad. Presently, a warning message is printed, but we
> > > > can add a parameter to switch between error/warning.
> > >
> > > Sounds good. I think it should be set to error by default with the
> > > possibility to change it to a warning. That is safest for first time
> > > users. Someone with a little more experience would check for
> > > convergence and have a strategy for handling the case where things
> > > don't converge (change of parameters, time step etc).
> >
> > Done. The parameter name is "error_on_nonconvergence".
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~dolfin
> > Post to : <email address hidden>
> > Unsubscribe : https://launchpad.net/~dolfin
> > More help : https://help.launchpad.net/ListHelp
> >
>

Garth Wells (garth-wells) said : #7

On 16/04/10 18:51, Anders Logg wrote:
> Question #107349 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/107349
>
> Status: Open => Answered
>
> Anders Logg proposed the following answer:
> It's a global parameter now valid for both the Krylov and Newton
> solvers, but perhaps it should be a local paramer. Opinions?

It should definitely be possible to set it independently for different
instances of Krylov solvers and Newton solvers.

Garth

>
> --
> Anders
>
>
> On Fri, Apr 16, 2010 at 01:33:26PM -0000, bluejerry wrote:
>> Question #107349 on DOLFIN changed:
>> https://answers.launchpad.net/dolfin/+question/107349
>>
>> Status: Answered => Open
>>
>> bluejerry is still having a problem:
>> Thanks that looks better.
>>
>> I assume this is to be set in the 'krylov_solver' submenu? If so it is not
>> in the parameter options (KeyError) in my last bzr pull (today)
>>
>> Unless there is something I am missing.
>>
>> Renier
>>
>> On Thu, Apr 15, 2010 at 9:00 PM, Anders Logg<
>> <email address hidden>> wrote:
>>
>>> Question #107349 on DOLFIN changed:
>>> https://answers.launchpad.net/dolfin/+question/107349
>>>
>>> Anders Logg proposed the following answer:
>>> On Wed, Apr 14, 2010 at 11:50:36AM +0200, Anders Logg wrote:
>>>> On Wed, Apr 14, 2010 at 09:33:20AM -0000, Garth Wells wrote:
>>>>> Question #107349 on DOLFIN changed:
>>>>> https://answers.launchpad.net/dolfin/+question/107349
>>>>>
>>>>> Garth Wells proposed the following answer:
>>>>>
>>>>> On 14/04/10 17:17, Anders Logg wrote:
>>>>>> On Wed, Apr 14, 2010 at 07:17:44AM -0000, bluejerry wrote:
>>>>>>> New question #107349 on DOLFIN:
>>>>>>> https://answers.launchpad.net/dolfin/+question/107349
>>>>>>>
>>>>>>> Is it possible to receive some sorf of error feedback when a
>>> solution did not converge while using the Krylov solver. A warning is
>>> printed by the PETsc solver that it did not converge, but I can't seem to
>>> find a way to detect this programatically. The solve method returns a
>>> Function even if the solver did not converge.
>>>>>>>
>>>>>>> Thank you
>>>>>>>
>>>>>>> Renier
>>>>>>
>>>>>> We had a similar problem with the Newton solver last week. It didn't
>>>>>> converge but we thought it did.
>>>>>>
>>>>>> I would also like to see an error when the solver doesn't converge.
>>>>>>
>>>>>
>>>>> Just an error is bad. Presently, a warning message is printed, but we
>>>>> can add a parameter to switch between error/warning.
>>>>
>>>> Sounds good. I think it should be set to error by default with the
>>>> possibility to change it to a warning. That is safest for first time
>>>> users. Someone with a little more experience would check for
>>>> convergence and have a strategy for handling the case where things
>>>> don't converge (change of parameters, time step etc).
>>>
>>> Done. The parameter name is "error_on_nonconvergence".
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dolfin
>>> Post to : <email address hidden>
>>> Unsubscribe : https://launchpad.net/~dolfin
>>> More help : https://help.launchpad.net/ListHelp
>>>
>>
>

Garth Wells (garth-wells) said : #8

This has been made a local parameter in the development version.