You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add option for resetting failing Newton solver #38
Sometimes when you solve a nonlinear problem, the solver might diverge which leaves the solver in a bad state.
Consider the following scenario
solver=NewtonSolver(...)
target_value=1.0step=0.1whileparameter.value<target_value:
parameter.value+=steptry:
solver.solve()
exceptRuntimeError:
# Do smaller step and reset solverparameter.value-=stepstep/=2.0
However, when the solver fails it might be in a bad state which needs to be reset to the last good state. My suggestion would be to allow for resetting the state in a seamless way, e.g
Can’t you simply control this with adding some checks, and change error_on_no convergence to False?
a set_state (rather than a reset state) could be ok with the appropriate documentation (that data is copied out of an array, rather than re-assigned in the ufl forms.
Activity
jorgensd commentedon Sep 30, 2024
Can’t you simply control this with adding some checks, and change error_on_no convergence to False?
a set_state (rather than a reset state) could be ok with the appropriate documentation (that data is copied out of an array, rather than re-assigned in the ufl forms.
finsberg commentedon Oct 3, 2024
My current workaround is as follows
I think it would be nice if we could do this without the need for creating a new solver.
jorgensd commentedon Oct 3, 2024
Maybe I am missing the point, but what exactly has to be reset (except the unknown ?)