-
-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prevent float overflow when calculating He I population #2522
prevent float overflow when calculating He I population #2522
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2522 +/- ##
==========================================
- Coverage 68.74% 68.73% -0.01%
==========================================
Files 165 165
Lines 13999 14001 +2
==========================================
+ Hits 9623 9624 +1
- Misses 4376 4377 +1 ☔ View full report in Codecov by Sentry. |
Good find. My issue with this solution is that nothing in a TARDIS simulation should ever be that cold! |
The issue only occurs in the most outer layer in some of the cases (in some of the models there are shells >40k km/s with low T_rad ). Alternative is printing out a warning state why the overflow is encountered there, so the user can modify their models accordingly with that Info? |
I would suggest a combination of both. A warning that the n_electron calculation has overflowed, telling the user that their temperatures are too low (with a printout of the problem temperature value and possibly the shells that are affected) |
*beep* *bop* Hi, human. The Click here to see your results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A warning is perhaps optimistic but we shall see how it goes
📝 Description
When the T_radiative in the shell is below 404 K, the highlighted part in the screenshot below will return Inf due to float overflow, which cause the nan values in the calculation of electron density.
This PR initially aims to prevent the overflow by capping the value to be the max float value allowed in the program. However a better way to do this maybe raise an error when the input model T_radiative is below certain threshold (1000K is chosen in this PR), so the user can double check the input model.
Fun fact, the low T_rad also cause kernel crash when using the macroatom setting.
📌 Resources
Examples, notebooks, and links to useful references.
🚦 Testing
How did you test these changes?
☑️ Checklist
build_docs
label