Pressio / pressio

core C++ library
Other
45 stars 7 forks source link

Nonlinear solver should complete if line search cannot reduce residual magnitude #425

Closed pjb236 closed 1 year ago

pjb236 commented 2 years ago

To prevent the nonlinear solver from running more steps than needed, the line search should tell it to terminate nicely, but with a warning if the line search fails to find an update step that reduces the magnitude of the residual.

For example, if we reach line 141 in solvers_armijo.hpp, then the nonlinear solver should complete and a warning should be printed to the terminal or log file. For a steady solver, the solver will terminate nicely. For an unsteady solver, we should proceed to the next time step or throw an exception to reduce the time step.

eparish1 commented 1 year ago

@fnrizzi @pjb236 Let's get this done ASAP. @fnrizzi what's the best path for this. Would you like to do it or would it be helpful if one of us took a stab at it?

eparish1 commented 1 year ago

Preferred behavior with the backtrack search as an example:

IF we hit the blocks on line 96-104 of the backtrack search, a flag stating that the line search failed to find an acceptable step should be returned to line 346 of solver.hpp. If on line 346 of solver.hpp we detect that this line search failed, we need to then exit the loop starting in solver.hpp on line 281 and ending on 352. If we don't exit this loop, Pressio will just stall repeatedly doing the same line search and failing until we hit the max number of iterations. Ideally Pressio would flash a warning that we failed to converge, but this will also be obvious looking a residual history and line search output.

p.s., this looks like it's the same as issue #31