NewtonSolver without call to NonlinearProblem.form
Issue #82
new
In dolfin's NewtonSolver::solve()
, the following calls are performed:
// Compute F(u)
nonlinear_problem.form(*_matA, *_matP, *_b, x);
nonlinear_problem.F(*_b, x);
, see https://github.com/FEniCS/dolfin/blob/d09c0bd4648c9c80996f929c97da38d2dec44999/dolfin/nls/NewtonSolver.cpp, line 128.
In dolfin-adjoint's
NewtonSolver.solve()
, only this call is performed:
factory.F(b=b, x=vec)
.
This fails, if only the NonlinearProblem.form
performs the assembly, see the comment on line 57 at https://github.com/FEniCS/dolfin/blob/d09c0bd4648c9c80996f929c97da38d2dec44999/dolfin/nls/NewtonSolver.cpp.
Changing factory.F(b=b, x=vec)
to
factory.form(None, b, vec)
b = factory.b
seems to work.