DedalusProject/dedalus

Add stop_iteration to NLBVP

bpbrown opened this issue · 1 comments

It would be handy to have a method for stopping NLBVP iterations if they exceed some threshold. Sometimes a NLBVP can get stuck in oscillatory non-convergent states, and a user-defined threshold could prevent a solution in that space from continuing to run.

This can be done by the user inside their main loop, but we have the concept of solver.stop_iteration for IVP, and extending this to NLBVP would keep the same approach for addressing similar situations.

Default value should probably be:

solver.stop_iteration = np.inf

to parallel IVP behaviour and current experience with NLBVP.

kburns commented

I think the easiest thing is just to wrap this into the newton loop in the script, like:

while error > tolerance and solver.iteration < 20:
    ...