See for instance Custom Newton solvers — FEniCSx tutorial
which goes through what you would need to create your own Newton/iterative solver.
You could also consider: Implementing the Newton Method per hand - #3 by j-507
among one of many different posts on the subject
1 Like