Criticality Search

I am trying to run a criticality search using boron as my parameter as I am intending to setup a system of depletion->refuelling->boron crit search (until conc=0)->adjuster rod crit search->next depletion step. Can someone better explain the criticality search function, in particular, what does the tolerance signify. I would have thought that it would be the difference off of criticality, therefore with a tolerance of 1e-2 it would search until it was within the bounds 0.99>1.01, but this doesn’t seem to be the case from my testing, and from the example that has the following results,

The example is located here,

Otherwise I would have expected it to stop at iteration 5 instead of continuing. My other guess is the tolerance is the allowed change of the parameter, therefore being the resolution of the test, but this doesn’t make sense to me why the example would state that this is a rather high tolerance on the final k value, and in the use of it within the example they are carrying the concentration by a factor of 10-3.

Furthermore, when I am running it using an initial guess it has to use the secant method, and since my initial guess was so close it gave the following results,


Using the following settings,

I don’t know how it calculated the actual critical concentration when it never ran a k-eff search at that specific concentration, and when this critical concentration is fed back into the original model the k-eff ends up being,

which is clearly not critical. When I run with a tolerance of 10-3, the same thing happens, when i run with tolerance of 10-4 I get the following,


Which does get used in the original model correctly outputting the same k-eff. So why was the first two runs not working correctly? Thank you for your assistance in advance.

I ran using the following two sets of settings,


Resulting in the following two outputs respectively,


and

They both resulted in the same concentration for boron, but different k-eff, and the value that is actually written into crit_ppm is different from the iterations value. I would have expected no change since the only difference was how the output should be printed. All around this function just feels so random.

search_for_keff basically calls a scipy optimizer under the hood ( last time I checked). So my best guess is that tol parameter is for the optimizer (not something like |k_eff - target_k_eff| ) which should answer why you are getting weird results for low tolerances.

I see, I searched a little more into the documentation and I understand the tolerance now, and makes sense why it was causing issues with the tolerances I was using. For anyone else looking at this problem, the initial guess method it uses x1-x0>tol while the bracketed method appears to use (x1-x0)/x1>tol to determine what iteration to stop at. Also, using the initial guess method will guess between the current iteration and the last if it deems it close but not quite within the tolerance, so while it might not state it as a iteration the final value for whatever parameter you are evaluating might not be at your last iteration but between that one and the previous iteration. Thanks for you help!