dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #23916
New interface for solving variational problems
Dear all,
I have now implemented the discussed changes (in the dolfin/logg
branch). Problems can now be solved in one of two ways. The interfaces
look very similar in C++ and Python and very similar for linear and
nonlinear problems (same number of arguments etc). Here's what it
looks like now.
1. Short option
solve(a == L, u, bc)
solve(F == 0, u, bc, J=J)
* The bc argument is optional and can be either a single bc or a list.
* The J=J argument is not yet handled.
2. Long (advanced) option
problem = LinearVariationalProblem(a, L, u, bc)
solver = LinearVariationalSolver(problem)
solver.parameters[...] = ...
solver.parameters[...] = ...
solver.solve()
problem = NonlinearVariationalProblem(a, L, u, bc)
solver = NoninearVariationalSolver(problem)
problem.set_jacobian(J)
solver.parameters[...] = ...
solver.parameters[...] = ...
solver.solve()
* The reason for the separate set_jacobian function is that this is
not necessary for all nonlinear solvers. We could add other solvers
that don't require it.
Let me know if this looks good. It may have implications on the code
examples in the FEniCS book.
The old VariationalProblem class is still there and gives an
informative error message.
--
Anders
Follow ups