FEniCS / dolfinx

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

Additional features for nonlinear solving #2965

Open mikesha2 opened 10 months ago

mikesha2 commented 10 months ago

Describe new/missing feature

Hello! I come from the machine learning side of nonlinear solving, and I've been using the default NewtonSolver for some hyperelasticity problems. I was wondering if it's worth adding some simple regularization options (e.g. spectral normalization, gradient scaling, gradient clipping) and/or adaptive gradient algorithms (Adam)? I've had instances where doing some initial relaxation of the solution is necessary for convergence, but I thought that maybe the project would benefit from easy-to-use alternative solvers.

I can definitely work on a PR when I have some time, maybe as a separate solver using the existing NewtonSolver C++ class as a template

Suggestion user interface

No response

garth-wells commented 10 months ago

@mikesha2 , thanks for the suggestions. The nonlinear solver is one of the few (only?) areas that we've paid very little attention to in developing DOLFINx from DOLFIN. We don't yet have a clear view on how we want to design it and how much functionality we want to add.

If you'd like to try some ideas out outside of the core we'd be happy to follow development. With DOLFINx we aim for ideas to be worked out outside of the core for possible inclusion later once the design matures.

In the meantime, for more nonlinear solver features it's reasonably easy to use the PETSc SNES nonlinear solver. There are some examples of its use in the tests, e.g. at https://github.com/FEniCS/dolfinx/blob/427a6557b3eb309488b171de5d3212547c2ea111/python/test/unit/nls/test_newton.py#L163.