Currently I’m using nonlinearvariationalsolver in my problem with for loop to follow incremental loading. I wonder if there is a solver parameter that allows the nonlinear solver incremental loading without any for loop definition. For example, let’s say I will apply 100 N force. Nonlinear solver firstly will try in a single step and suppose it diverged in 10 iteration (max iteration), then I want to force the solver with F/2 increment, if it fails again it will goes up to F/1024 as an load fraction until it converges or it will stop at F/1024. Is it possible with a solver parameter ? Thanks.
A second question, is it possible to add “while loop” to change the relaxation and maximum iteration number as a parameter in the code iteratively by checking the convergece status of the problem ? How can I reach the residual and use as a data in the code ? Thanks.
According to the reference manualNonlinearVariationalSolver() returns two values, number of Newton iterations and convergence. Maybe you can try to use try: and except:when solver diverges to change increment, maximum iteration number and relaxation parameter?
Thank you for your answer. Can you give me an simple example about how can I return number of iterations and convergence as a parameter or number in the code by using NonlinearVariationalSolver() ?
I don’t think that it is possible by using NonlinearVariationalSolver. Maybe you can create custom solver as described here. The example for the Newton Method at the PDE Level can be found here. Be careful, the code needs modification before you can use it, since some parts are outdated.