Set tolerances/solver for AdaptiveNonlinearVariationalSolver

6 months ago by
I resent switched my solver from
auto solver = std::make_shared<dfn::NonlinearVariationalSolver>(prob);

auto solver = std::make_shared<dfn::AdaptiveNonlinearVariationalSolver>(prob, goal);​

The code seems to be running fine but I can't figure out the syntax to change the solver/tolerances.  Previously, I was using
solver->parameters["nonlinear_solver"] = "snes";
solver->parameters("snes_solver")["maximum_iterations"] = maxit;
solver->parameters("snes_solver")["absolute_tolerance"] = atol;
solver->parameters("snes_solver")["relative_tolerance"] = rtol;

but that now gives the error

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error:   Unable to access parameter.
*** Reason:  Parameter "adaptive_solver.nonlinear_solver" not defined.
*** Where:   This error was encountered inside Parameters.cpp.
*** Process: 0
*** DOLFIN version: 2017.1.0.dev0
*** Git changeset:  241684bbf19fc2dd9d035d1e7c1d16a14dfeade2
*** -------------------------------------------------------------------------​

Update: I can get the solver to use SNES by adding

solver->parameters("nonlinear_variational_solver")["nonlinear_solver"] = "snes";

But I still cannot figure out how to set things like the linear search or tolerances.

Community: FEniCS Project

1 Answer

6 months ago by

see this
That is documentation for prehistoric version 1.4. Please, avoid reading docs for such old versions unless you can't upgrade the fenics.
written 6 months ago by Michal Habera  
You are right Michal.You should also upload the right tutorial.
written 6 months ago by Minas Mattheakis  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »