I have a complicated nonlinear system that may have different solutions depending on my initial guess. I want to know how I can use the NonlinearVariationalProblem with an initial guess.
The FEniCS tutorial on page 73 has an example of how to implement a nonlinear variational problem. I have copied it below. The tutorial says that u_ is the most recently computed solution. I'm confused, is this a solution that the solver will find and then reuse or do I need to give it some initial guess? If I don't give it an initial guess what guess will it use?
du = TrialFunction(V)
v = TestFunction(V)
u_ = Function(V) # the most recently computed solution
F = inner(q(u_)nabla_grad(u_), nabla_grad(v))dx
J = derivative(F, u_, du) # Gateaux derivative in dir. of du
problem = NonlinearVariationalProblem(F, u_, bcs, J)
solver = NonlinearVariationalSolver(problem)
...
solver.solve()
How could I make an initial guess so that the system converges easier? (I have an idea more or less of what the solution should look like.) Would I insert some initial solution for u_?
u_ = Function(V)
u_.interpolate(Expression*)
Any input would be very helpful.