4269 inconsistent use of eps variable in functions#4282
Conversation
There was a problem hiding this comment.
Pull request overview
This PR standardizes how inverse aspect ratio (eps) is handled across plasma current / field calculations by deriving it from aspect where appropriate, and aligns naming (ip → cur_plasma) to reduce ambiguity in physics routines.
Changes:
- Remove explicit
epsarguments from Peng-related calculations and computeeps = 1 / aspectinternally. - Rename plasma current parameter from
iptocur_plasmain the surface-averaged poloidal field calculation and its call sites. - Reformat reference sections in docstrings for consistency.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tests/unit/models/physics/test_physics.py |
Updates unit tests to match revised function signatures/inputs and expected numeric outputs. |
process/models/physics/plasma_fields.py |
Adjusts surface-averaged poloidal field API (cur_plasma, derive eps) and uses PlasmaCurrentModel enum for model selection. |
process/models/physics/plasma_current.py |
Updates Peng scaling to derive eps from aspect, removes the older poloidal-field helper, and switches several calls to keyword arguments for clarity. |
process/models/physics/physics.py |
Updates the physics model to call the revised poloidal-field routine with cur_plasma and without eps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Peng scaling for double null divertor; TARTs [STAR Code] | ||
| elif model == PlasmaCurrentModel.PENG_DIVERTOR_SCALING: | ||
| plasma_current = 1.0e6 * self.calculate_plasma_current_peng( | ||
| q95, | ||
| aspect_ratio, | ||
| eps, | ||
| rminor, | ||
| b_plasma_toroidal_on_axis, | ||
| kappa, | ||
| triang, | ||
| q95=q95, | ||
| aspect=aspect_ratio, | ||
| eps=eps, | ||
| rminor=rminor, | ||
| b_plasma_toroidal_on_axis=b_plasma_toroidal_on_axis, | ||
| kappa=kappa, | ||
| triang=triang, | ||
| ) |
| result = physics.fields.calculate_surface_averaged_poloidal_field( | ||
| i_plasma_current, | ||
| c_plasma, | ||
| q95, | ||
| b_plasma_toroidal_on_axis, | ||
| aspect, | ||
| eps, | ||
| kappa, |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4282 +/- ##
=======================================
Coverage 48.81% 48.81%
=======================================
Files 151 151
Lines 29097 29091 -6
=======================================
- Hits 14203 14202 -1
+ Misses 14894 14889 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7b1cfda to
177d4a5
Compare
…s variable and update parameter names for clarity
177d4a5 to
4066e1d
Compare
| expected, | ||
| physics, | ||
| ): | ||
| """Parametrized test for calculate_poloidal_field.""" |
There was a problem hiding this comment.
| """Parametrized test for calculate_surface_averaged_poloidal_field.""" |
| ), | ||
| ], | ||
| ) | ||
| def test_calculate_polidal_field( |
There was a problem hiding this comment.
| def test_calculate_surface_averaged_poloidal_field( |
| physics, | ||
| ): | ||
| """Parametrized test for calculate_poloidal_field.""" | ||
| result = physics.fields.calculate_surface_averaged_poloidal_field( |
There was a problem hiding this comment.
Can you pass these as keyword arguments , and this will fix the error pointed out by copilot
| inverse aspect ratio | ||
| kappa : | ||
| plasma elongation | ||
| delta : |
Description
Checklist
I confirm that I have completed the following checks: