Setup preconditioners for linear solver in NonlinearVariationalSolver

Hi all,

I am solving a nonlinear problem so that a Newton method is used. I am trying to setup a preconditioner for the linear solver in each Newton iteration. But, I do not know how I can do it:

problem = NonlinearVariationalProblem(F, u, bcs, Jac)
solver = NonlinearVariationalSolver(problem)

prm = solver.parameters
prm['newton_solver']['relaxation_parameter'] = rel_par
prm['newton_solver']['maximum_iterations'] = max_iter
prm['newton_solver']['absolute_tolerance'] = 1E-6
prm['newton_solver']['relative_tolerance'] = tol_tstep * tol_fac

prm['newton_solver']['krylov_solver']['monitor_convergence'] = True
prm['newton_solver']['krylov_solver']['absolute_tolerance'] = 1E-10
prm['newton_solver']['krylov_solver']['relative_tolerance'] = 1E-6

prm['newton_solver']['linear_solver'] = 'bicgstab' 
prm['newton_solver']['preconditioner'] = 'hypre_amg'   

Then I try to do something like: solver.linear_solver.set_operator(P), 

May I ask how i can do it.

Thanks,
Leon