-
Notifications
You must be signed in to change notification settings - Fork 17
Ensure i_plasma_pedestal=0 profile does not have 0 elements #4038
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4038 +/- ##
==========================================
- Coverage 46.30% 46.30% -0.01%
==========================================
Files 123 123
Lines 28961 28962 +1
==========================================
Hits 13411 13411
- Misses 15550 15551 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
46a0131 to
0bcdc2e
Compare
|
Did this remove the error for you @timothy-nunn ? |
process/profiles.py
Outdated
| self.profile_y = n0 * (1 - rho**2) ** alphan | ||
| # profile values of 0 cause divide by 0 errors so ensure the profile value is at least 1e-8 | ||
| # which is small enough that it won't make a difference to any calculations | ||
| self.profile_y = np.maximum(n0 * (1 - rho**2) ** alphan, 1e-8) |
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.
This is actually being overwritten by the following code, so the fix isn't applied and the error persists. We should add a return statement after this, then an else or "if physics.variables.i_plasma_pedestal == 1" to ensure the code runs correctly.
ym1906
left a comment
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.
Please make the adjustment recommended in profiles.py
0bcdc2e to
560284b
Compare
|
One more thing @timothy-nunn the change is only applied to the ne profile but actually the bug occurs with the te profile, we should apply the same solution there. |

Adds in a check of the
profile_ywheni_plasma_pedestal=0to set any 0 elements to be slightly above 0, hence avoiding divide by 0's.