Repository navigation
prevent log(0) in sauter bootstrap calculation - #4717
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4717 +/- ##
=======================================
Coverage 50.26% 50.26%
=======================================
Files 181 181
Lines 30629 30630 +1
=======================================
+ Hits 15395 15396 +1
Misses 15234 15234 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
I am sure this is fine for the moment. The profile code has a lot of places where density or temperature could become negative or where the gradients could become negative. In the future it would be nice to sort this out properly. |
mkovari
approved these changes
Oct 30, 2026
timothy-nunn
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a small lower bound to the electron-density profile before it is used in the Sauter bootstrap-current calculation:
Calculate electron and ion density profiles
context
During normal PROCESS optimisation the density profile remains within the expected physical domain, but UQ sampling deliberately explores a much wider region of parameter space, including trial points that may be far from a feasible solution.
At some of these trial points, one or more values in the calculated electron-density profile can reach zero. Passing these values into the Sauter calculation results in log(0), producing non-finite values and causing the model evaluation to fail.
This is particularly problematic for because an invalid intermediate trial point can terminate or destabilise the optimisation even when a valid equilibrium exists elsewhere in the search space.
solution
The guard is applied only to the local density array used in the bootstrap-current calculation and does not modify the underlying PROCESS density variable or density profile. Itprevents log(0) and subsequent NaN propagation and allows the optimiser to move through otherwise invalid intermediate trial points.