Skip to content

4692 bug avoid eta cd dimensionless hcd primary nan when p hcd primary injected mw 0 - #4694

Merged
timothy-nunn merged 2 commits into
mainfrom
4692-bug-avoid-eta_cd_dimensionless_hcd_primary-nan-when-p_hcd_primary_injected_mw-0
Oct 16, 2026
Merged

timothy-nunn merged 2 commits into
mainfrom
4692-bug-avoid-eta_cd_dimensionless_hcd_primary-nan-when-p_hcd_primary_injected_mw-0

Conversation

@grmtrkngtn

Copy link
Copy Markdown
Collaborator

Description

Issue

PROCESS calculates three current-drive efficiency quantities for the primary H&CD system:

  • eta_cd_hcd_primary: absolute current-drive efficiency in A/W.
  • eta_cd_norm_hcd_primary: normalised current-drive efficiency, which scales eta_cd_hcd_primary by plasma density and major radius.
  • eta_cd_dimensionless_hcd_primary: dimensionless current-drive efficiency, which additionally normalises the efficiency using the plasma electron temperature.

Currently, eta_cd_dimensionless_hcd_primary is calculated using:

c_hcd_primary_driven / p_hcd_primary_injected_mw

However, when no auxiliary current drive is required, PROCESS can produce:

p_hcd_primary_injected_mw = 0
c_hcd_primary_driven = 0

This causes 0 / 0, giving:

eta_cd_dimensionless_hcd_primary = NaN

eta_cd_hcd_primary is already calculated from the selected i_hcd_primary model, so eta_cd_dimensionless_hcd_primary should use eta_cd_hcd_primary directly rather than recalculating the same efficiency from realised current and power.

Proposed fix

Refactor calculate_dimensionless_current_drive_efficiency() to take eta_cd_hcd instead of c_hcd_driven and p_hcd_injected

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

@grmtrkngtn
grmtrkngtn requested a review from a team as a code owner October 16, 2026 09:45
@grmtrkngtn grmtrkngtn self-assigned this Oct 16, 2026
@grmtrkngtn grmtrkngtn added the Bug Something isnt working label Oct 16, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.28%. Comparing base (db9f377) to head (e011e37).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4694   +/-   ##
=======================================
  Coverage   50.28%   50.28%           
=======================================
  Files         181      181           
  Lines       30532    30532           
=======================================
  Hits        15353    15353           
  Misses      15179    15179           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timothy-nunn
timothy-nunn merged commit 493ed99 into main Oct 16, 2026
10 of 11 checks passed
@timothy-nunn
timothy-nunn deleted the 4692-bug-avoid-eta_cd_dimensionless_hcd_primary-nan-when-p_hcd_primary_injected_mw-0 branch October 16, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isnt working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Avoid eta_cd_dimensionless_hcd_primary = NaN when p_hcd_primary_injected_mw = 0

4 participants