Skip to content

972 pf power supplies accounting 2#4089

Open
grmtrkngtn wants to merge 37 commits intomainfrom
972-pf-power-supplies-accounting-2
Open

972 pf power supplies accounting 2#4089
grmtrkngtn wants to merge 37 commits intomainfrom
972-pf-power-supplies-accounting-2

Conversation

@grmtrkngtn
Copy link
Copy Markdown
Collaborator

Description

Updates pfpwr equation to account for additional components in pf power management: busbar, power supply and storage system.

  1. We have added separate functions to calculate the power loss for each component.
  2. pfpwr has been adapted to use these new functions to account for the pf power supply - previously they were lumped into one value.
  3. A mild refactor of pfpwr function (modularising it a bit, renaming some variables)

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 February 9, 2026 16:07
@grmtrkngtn grmtrkngtn linked an issue Feb 9, 2026 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.61%. Comparing base (09c52f5) to head (095bc14).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4089      +/-   ##
==========================================
+ Coverage   48.04%   49.61%   +1.57%     
==========================================
  Files         144      148       +4     
  Lines       30211    29772     -439     
==========================================
+ Hits        14515    14772     +257     
+ Misses      15696    15000     -696     

☔ View full report in Codecov by Sentry.
📢 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.

@grmtrkngtn
Copy link
Copy Markdown
Collaborator Author

@j-a-foster I've pushed my changes here for your review

@chris-ashe chris-ashe self-requested a review February 10, 2026 10:31
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticing quite a few large regression changes. Have made some initial minor comments

Unsurprisingly it has changed the PF power profile, though has it changed the PF current profile diagram in plot_proc?

@timothy-nunn timothy-nunn self-assigned this Feb 10, 2026
@timothy-nunn timothy-nunn requested a review from mkovari February 10, 2026 14:14
@timothy-nunn
Copy link
Copy Markdown
Collaborator

I'll add @mkovari to review since he made the original issue

@j-a-foster
Copy link
Copy Markdown
Collaborator

Should've fixed all subscripts in docs now.

Copy link
Copy Markdown
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly comments on index names

Copy link
Copy Markdown
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Graeme. Happy with the code, will approve and merge when the others reviewers are happy.

je-cook and others added 8 commits February 17, 2026 16:14
* CI cleanup

* move tf data to json file

* add biome for json formatting and format

* general formatting cleanup

* add plotting option to tests

* add marker to list

* fix python selection

* add parallelism

* move python version to env workflow level

* fix CI
* Rename Fw class to FirstWall and update references throughout the codebase

* Add methods to calculate first wall geometry and areas in FirstWall class

* Add method to calculate elliptical first wall areas in FirstWall class

* Add dz_fw_half variable for first wall half-height in fwbs_variables.py

* Add method to apply first wall coverage factors in FirstWall class

* Refactor first wall geometry calculations into FirstWall class methods

* Requested changes

* Refactor first wall area calculations to use first_wall_variables and add first_wall_variables.py
* Add average neutron flux variable for plasma surface

* Add average neutron flux calculation for plasma surface

* Add average neutron flux display in plasma information plot
* Add PlasmaBeta class and integrate into Physics initialization

* Refactor beta normalization calculations to use PlasmaBeta class methods

* Add static method to PlasmaBeta for calculating normalized beta

* Refactor beta information output to PlasmaBeta class for improved organization

* Move total normalised beta calc to outside of calculate_plasma_current

* Add static method to PlasmaBeta for calculating plasma energy from beta

* Refactor plasma energy calculations to use PlasmaBeta methods for improved clarity and maintainability

* Refactor fast alpha beta calculation into PlasmaBeta class and remove redundant function from physics_functions.py

* Refactor beta limit calculation into PlasmaBeta class and remove redundant function from physics.py

* Refactor poloidal beta calculation to use PlasmaBeta class methods and remove redundant function

* Refactor thermal beta normalization calculation to use PlasmaBeta class method

* Refactor beta norm max calculation to use PlasmaBeta class property for improved maintainability

* Refactor beta norm max calculation to use BetaNormMaxModel Enum method and improve error handling

* Update plasma beta documentation to include function references for Wesson, Original Scaling, Menard, Tholerus, and Stambaugh relations

* Refactor plasma current documentation for clarity and consistency in variable formatting

* Refactor plasma beta calculations into a dedicated run method for improved organization and maintainability

* Refactor normalized beta calculations into PlasmaBeta class for improved organization and maintainability
* Fixed negativity in sqrt in costs.py by np.clip.

* Introduced a local variable sqrt_p_plant_electric_net_mw in the scope of the method coelc to warn in case p_plant_electric_net_mw is negative. Also caught a third place where sqrt_p_plant_electric_net_mw is needed .(missed earlier as it was commented out)

* Update process/costs.py

Clarified what's the purpose of the calculation inside the warning.

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>

* Bug fixes so regression test passes - Undid the comment line change (previously over-corrected)

---------

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
* Add PlasmaInductance class and integrate into physics and stellarator models

* Refactor internal inductance calculations to use PlasmaInductance class methods and remove redundant static methods

* Refactor internal inductance calculation to use IndInternalNormModel and PlasmaInductance class for improved clarity and maintainability

* Refactor output of volt-second information into PlasmaInductance class for improved organization and maintainability

* Update documentation for PlasmaInductance: add method references to Wesson and Menard relations

* Refactor internal inductance calculations: move logic to PlasmaInductance class and streamline execution with run method
* Add method to calculate reduced mass of two particles

* Refactor classical distance of closest approach calculation to use reduced mass and relative velocity

* Add method to calculate average relative velocity and update usage in detailed physics calculations

* ❇️ Add deuteron thermal velocity profile to physics variables

* Add deuteron thermal velocity profile calculations to detailed physics

* Add electron-deuteron Coulomb logarithm profile to physics variables

* Add electron-deuteron Coulomb logarithm calculations and plotting

* Add deuteron Larmor frequency profile to physics variables

* Add deuteron toroidal Larmor frequency profile calculations and plotting

* Add triton thermal velocity profile to physics variables

* Add electron-triton Coulomb logarithm profile to physics variables

* Add triton Larmor frequency profile to physics variables

* Add triton thermal velocity, Larmor frequency, and Coulomb logarithm profiles to physics variables

* Add triton velocity, Larmor frequency, and Coulomb logarithm profiles to plotting functions

* Update vel_relative parameter to be required in distance calculation method
@grmtrkngtn
Copy link
Copy Markdown
Collaborator Author

Hi Graeme @ym1906 . Could you summarise the changes in the regression tests and in the profile of stored energy and power required? Thanks

Hi Michael - the main change in terms of the pf coil power accounting are as follows

p_pf_electric_supplies_mw: 1.02 → 3.18 MW (+212%)

The PF power profile variables (p_pf_electric_supplies_profile_mw1–4) scale consistently with this change.

Do you think this seems reasonable?

@grmtrkngtn
Copy link
Copy Markdown
Collaborator Author

Hi Graeme @ym1906 . Could you summarise the changes in the regression tests and in the profile of stored energy and power required? Thanks

Hi Michael @mkovari could you respond to this comment for review? #4089 (comment)

@mkovari
Copy link
Copy Markdown
Collaborator

mkovari commented Feb 27, 2026

I am puzzled why there isn't any energy requirement in the charge and discharge phases.
The central solenoid current is changing all the time. (It doesn't change between time points 2 and 3 as there are the same time.)

All three loss terms should be non-zero:

533c6318-db6a-4da4-abd3-8c710d10168c
image

image @ym1906 @timothy-nunn

@grmtrkngtn
Copy link
Copy Markdown
Collaborator Author

@mkovari the character of these profiles is the same on main and the changes made in this branch. If this behaviour is unusual, it's a separate problem. @chris-ashe or @ajpearcey do you have any comment on this?

@grmtrkngtn grmtrkngtn requested a review from j-a-foster April 7, 2026 15:39
Copy link
Copy Markdown
Collaborator

@j-a-foster j-a-foster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with changes.

@timothy-nunn timothy-nunn requested a review from chris-ashe April 9, 2026 10:35
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a rename to do. Doc changes look good

@grmtrkngtn
Copy link
Copy Markdown
Collaborator Author

Thanks Chris, should have pushed the last rename now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PF power supplies accounting 2

8 participants