Skip to content

Conversation

@chris-ashe
Copy link
Collaborator

@chris-ashe chris-ashe commented Sep 18, 2024

This pull request includes several changes to the documentation related to plasma current and bootstrap current terminology updates. The most important changes include renaming variables for consistency and clarity, and restructuring the documentation and physics.py for better readability.

Bug Fixes:

  • The coefficient for the plasma current calculation was set to an approximation of 5.0e6, it has now been set explicitly with the constants as constants.twopi / constants.rmu0
  • The 2nd Todd plasma current scaling is now properly used when i_plasma_current = 6 as it would check for value 7 when only testing condition if in [5,6]
  • The cboot parameter has now been placed outside the bootstrap_fraction_iter89() function to be the same as other models
  • Fixed typo in Sakai bootstrap scaling and fixed model by adding inverse aspect term (eps) into the exponent of rli. Original issue 954 bootstrap current fraction scaling formula for steady state machines #3268
  • The Nevins bootstrap function was incorrectly using the density weighted temperature ten instead of just the volume average te
  • If i_plasma_current = 2 then the first action in physics() was to set q95 to the qbar equivalent. This would propagate a wrong value of q95 to other models when only the qbar term was meant to the used in the plasma current scaling. This assignment is now within the plasma current function

Terminology Updates:

  • Main plasma current calculation in physics.py is now named calculate_plasma_current() instead of culcur()

  • The plasma current model selection switch is now named i_plasma_current instead of icurr

  • The Peng plasma current scaling has been renamed to calculate_plasma_current_peng() instead of plasc()

  • The diamagnetic current model selection switch is now named i_diamagnetic_current instead of idia

  • The bootstrap current model selection switch is now named i_bootstrap_current instead of ibss

  • The Pfirsch-Schluter current model selection switch is now named i_pfirsch-schluter_current instead of ips

  • The Nevins plasma current scaling integral function has been renamed to _nevins_intgeral() instead of bsinteg()

  • The function, hcsa() used in the Sauter bootstrap model has been renamed to, _calculate_l31_32_coefficient()

  • The function, hcsa() used in the Sauter bootstrap model has been renamed to, _calculate_l31_32_coefficient()

  • The function, dcsa() used in the Sauter bootstrap model has been renamed to, _calculate_l31_coefficient()

  • The function, xcsa() used in the Sauter bootstrap model has been renamed to, _calculate_l34_alpha_31_coefficient()

  • The function, coulg() used in the Sauter bootstrap model has been renamed to, _coloumb_logarithm)sauter()

  • The function, nuee() used in the Sauter bootstrap model has been renamed to, _electron_collisions_sauter()

  • The function, nuess() used in the Sauter bootstrap model has been renamed to, _electron_collisionality_sauter()

  • The function, nui() used in the Sauter bootstrap model has been renamed to, _ion_collisions_sauter()

  • The function, nuis() used in the Sauter bootstrap model has been renamed to, _ion_collisionality_sauter()

  • The function, beta_poloidal_local() used in the Sauter bootstrap model has been renamed to, beta_poloidal_sauter()

  • The function, beta_poloidal_local_total() used in the Sauter bootstrap model has been renamed to, _beta_poloidal_total_sauter()

  • The variable magnetic_moment in the Sauter bootstrap fractions has been re-named to inverse_q

  • Changed input variable names have been added to obsolete_vars

Documentation Reorganization:

Other Updates:

  • General rename of function variables to be more explicit
  • The plasma current and related functions now all have type hints and updated Python styled docstrings.
  • All plasma current models are now standalone functions instead of being left as switch arguements inside the Physics class
  • The functions in physics.py have now been grouped and organised into sections with block comment headers
  • The old documentation/proc-pages/eng-models/heating-and-current-drive.md file has been removed. It should have been removed in WIP:Update the heating and current drive docs to include all models #3171

Checklist

I confirm that I have completed the following checks:

  • 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.

…d coded values replaced with constants variables, in-line commnets removed with increased spacing, import re-arranged in-line with PEP standards
Update the documentation for the ps_fraction_scene function to provide a clear explanation of its purpose and parameters.
…value in multiple files. "ibss" added to obsolete variables list
…asma current shaping function for calculate_plasma_current
…place it outside the function the same as the other bootstrap fraction calculations
…tiple files

This should prevent parsing problems due to / no longer present.
Variable name change is technically not PEP8 complinat but is a stand in to make the code explicit
…atting shown in the source document. Added additional context in the docs also
Copy link
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.

General comments on documentation - need to review code next.

@chris-ashe chris-ashe marked this pull request as ready for review October 1, 2024 18:14
@chris-ashe chris-ashe changed the title 🚧 WIP:3263 update the plasma current section of the docs to show and explain all models 🚧 :3263 update the plasma current section of the docs to show and explain all models Oct 1, 2024
@chris-ashe chris-ashe changed the title 🚧 :3263 update the plasma current section of the docs to show and explain all models :3263 update the plasma current section of the docs to show and explain all models Oct 1, 2024
Copy link
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.

Consider naming some of the supporting functions with an _. Generally, is a function general (calculating an important physical quantity, a scaling function, etc) or is its only purpose to provide scaling constants to other functions.

I have checked for quality, I leave technical implementation and documentation correctness to Jack.

Copy link
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.

Only 1 minor comment to see if something looks better

Copy link
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 for this to be merged.

@chris-ashe chris-ashe merged commit 032399f into main Oct 9, 2024
@chris-ashe chris-ashe deleted the 3263-update-the-plasma-current-section-of-the-docs-to-show-and-explain-all-models branch October 9, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Physics Relating to the physics models

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the plasma current section of the docs to show and explain all models

5 participants