- edited description
Generalize NewtonSolver and NonlinearProblem to handle preconditioners etc.
NewtonSolver
passes single operator to linear solver every nonlinear step. There needs to be a mechanism to pass second preconditioning operator. Obvious fix is to add NonlinearProblem::J_pc
.
More serious problem is that user might want an access to linear solver during setup callbacks. Current available mechanisms
virtual bool NewtonSolver::converged(const GenericVector& r, const NonlinearProblem& nonlinear_problem, std::size_t iteration)
virtual void NonlinearProblem::form(GenericMatrix& A, GenericVector& b, const GenericVector& x)
virtual void NonlinearProblem::F(GenericVector& b, const GenericVector& x)
virtual void NonlinearProblem::J(GenericMatrix& A, const GenericVector& x)
don't allow to access linear solver. We could think about something like
virtual void NewtonSolver::solver_setup(std::shared_ptr<GenericLinearSolver> solver,
const NonlinearProblem& nonlinear_problem,
std::size_t iteration)
which would be called after this line to allow overriding linear_solver.set_operator(A)
.
Modification of relaxation parameter has been suggested @nate-sime at 118250c. I'd suggest to handle this by accessing this->parameters["relaxation_parameter"]
in user's overload of NewtonSolver::solver_setup
.
Comments (9)
-
reporter -
I'm inclined to improve the PETScSNES interface rather than extend
NewtonSolver
. -
reporter What about extending
NonlinearProblem
which can be hooked to bothNewtonSolver
andPETScSNESSolver
? -
That's fine if it can be done without twisting it in knots,
-
- changed milestone to 2017.1
-
reporter See also #556.
-
reporter -
assigned issue to
-
assigned issue to
-
reporter Merge branch 'jan/fix-issue-714'
-
Allow preconditioner matrix in
NonlinearProblem
andOptimisationProblem
interface and use that byNewtonSolver
,PETScSNESSolver
andPETScTAOSolver
, seetest/unit/python/nls/test_PETScSNES_solver.py
for usage.NonlinearProblem::form(A, b, x)
is deprecated in favour ofform(A, P, b, x)
andNonlinearProblem::J_pc(P, x)
is added. -
Avoid reallocating matrices on subsequent SNES solves - should fix
#786. -
Add PetscErrorCode checks in
PETScSNESSolver
. -
Add
NewtonSolver::solver_setup(A, P, nonlinear_problem, interation)
to allow user to do magic between subsequent Newton steps. This could be subsequently moved intoGenericNonlinearSolver
when implementing #556. -
Add
NewtonSolver::get/set_relaxation_parameter
which in a combinationNewtonSolver::solver_setup
can be used for tweaking the parameter between the steps, see#714. -
Add
NewtonSolver::update_solution(x, dx, relaxation_parameter, nonlinear_problem, iteration)
to allow user to do magic between subsequent Newton steps. This could be subsequently moved intoGenericNonlinearSolver
when implementing #556. -
See also #814.
→ <<cset fc5621655379>>
-
-
reporter - changed status to resolved
- Log in to comment
Added comment on @nate-sime 's relaxation parameter problem.