Debugging NonlinearVariationalProblem

Asked by minak

Dear All,

I have general question concerning NonlinearVariationalProblem. I am solving some systems of PDEs by Mixed FEM and I am using NonlinearVariationalProblem i.e. Newton solver.

I would like to find out why the solver does not work (probably sth is wrong with the system). What I found is set_log_level(PROGRESS) or set_log_level(DEBUG), but it just give me information about time of processes.

How can I display assembled matrix or current values of my variable?

The point is that when I start with zero boundary conditions I should receive zero solution but I got:

*** -------------------------------------------------------------------------
*** Error: Unable to solve nonlinear system with NewtonSolver.
*** Reason: Newton solver did not converge. Bummer.
*** Where: This error was encountered inside NewtonSolver.cpp.
*** -------------------------------------------------------------------------

It is a general question, no need to post code reproducing the error.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Marie Rognes
Solved:
Last query:
Last reply:
Revision history for this message
Hans Petter Langtangen (hpl) said :
#1

I would implement the Newton solver myself so that you explicitly form linear systems and can inspect them, see http://fenicsproject.org/documentation/tutorial/nonlinear.html for details on how to do Newton manually. Either you have an error in the formulation of the problem or the nonlinearity is too strong for Newton to converge. Relaxation or Picard iteration or continuation methods may help in the latter case. Turning off the nonlinearity is a good initial test - Newton will then converge in one iteration.

Hans Petter

Revision history for this message
Best Marie Rognes (meg-simula) said :
#2

On 12/08/2011 11:31 AM, minak wrote:
> Question #181260 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/181260
>
> Description changed to:
> Dear All,
>
> I have general question concerning NonlinearVariationalProblem. I am
> solving some systems of PDEs by Mixed FEM and I am using
> NonlinearVariationalProblem i.e. Newton solver.
>
> I would like to find out why the solver does not work (probably sth is
> wrong with the system). What I found is set_log_level(PROGRESS) or
> set_log_level(DEBUG), but it just give me information about time of
> processes.
>
> How can I display assembled matrix or current values of my variable?
>
> The point is that when I start with zero boundary conditions I should
> receive zero solution but I got:
>
> *** -------------------------------------------------------------------------
> *** Error: Unable to solve nonlinear system with NewtonSolver.
> *** Reason: Newton solver did not converge. Bummer.
> *** Where: This error was encountered inside NewtonSolver.cpp.
> *** -------------------------------------------------------------------------
>
> It is a general question, no need to post code reproducing the error.
>

Adjusting the behaviour of a solver can typically be accomplished
by adjusting its parameters. Try looking at:

     info(NonlinearVariationalSolver.default_parameters(), True)

to see all the adjustable parameters for the NonlinearVariationalSolver.

In particular, see the parameters 'print_matrix', and 'print_rhs' if you
want to print stuff. Parameters are set like this:

     solver = NonlinearVariationalSolver(...)
     solver.parameters["print_rhs"] = True

--
Marie

Revision history for this message
minak (piotrekminak) said :
#3

Thanks Marie Rognes, that solved my question.