dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22709
Re: [Question #153459]: krylov solver parameters
Question #153459 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/153459
Status: Answered => Open
Chaffra is still having a problem:
How about the following changes to dolfin... This works for me.
void NonlinearVariationalSolver::solve(Function& u,
const VariationalProblem& problem,
const Parameters& parameters)
{
begin("Solving nonlinear variational problem.");
// Create nonlinear problem
_NonlinearProblem nonlinear_problem(problem, parameters);
// Create Newton solver and set parameters
NewtonSolver newton_solver(parameters["linear_solver"],
parameters["preconditioner"]);
newton_solver.parameters.update(parameters("newton_solver"));
//update linear_solver parameters
std::string solver_type = parameters["linear_solver"];
if (solver_type == "lu" || solver_type == "cholesky"){
newton_solver.linear_solver().parameters.update(parameters("lu_solver"));
}
else{
newton_solver.linear_solver().parameters.update(parameters("krylov_solver"));
}
// Solve nonlinear problem using Newton's method
newton_solver.solve(nonlinear_problem, u.vector());
end();
}
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.
References