FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
790 stars 182 forks source link

PETSc SNES API in `dolfinx.xxxx.petsc` namespace #3511

Open jorgensd opened 1 week ago

jorgensd commented 1 week ago

Describe new/missing feature

As PETSc SNES has way more features than our newton solver, and is not trivial to implement, it would be best to move the current implementation out of the tests and into the dolfinx.xxx.petsc namespace.

Suggested user interface

No response

jhale commented 1 week ago

It would be good to add a SNESNonlinearProblem class near the existing NonlinearProblem class with a clear docstring describing correct use with SNES:

https://github.com/FEniCS/dolfinx/blob/main/python/dolfinx/fem/petsc.py#L893

Even NonlinearProblem docstring could be improved; it's unclear that the only class in DOLFINx that can accept it is NewtonSolver. I'm also unsure whether the NewtonSolver should share its solution state with F and J - @jorgensd does not agree with me on this point (simplicity).