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

to
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
*** -------------------------------------------------------------------------​

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