dolfinx.nls.petsc

Methods for solving nonlinear equations using PETSc solvers.

Classes

NewtonSolver(comm, problem)

A Newton solver for non-linear problems.

class dolfinx.nls.petsc.NewtonSolver(comm: MPI.Intracomm, problem: NonlinearProblem)[source]

Bases: dolfinx.cpp.nls.petsc.NewtonSolver

A Newton solver for non-linear problems.

property A: PETSc.Mat

Jacobian matrix

property b: PETSc.Vec

Residual vector

setP(P: types.FunctionType, Pmat: PETSc.Mat)[source]

Set the function for computing the preconditioner matrix

Parameters
  • P – Function to compute the preconditioner matrix

  • Pmat – Matrix to assemble the preconditioner into

solve(u: dolfinx.fem.function.Function)[source]

Solve non-linear problem into function u. Returns the number of iterations and if the solver converged.