Skip to content

Update some constraints vars#4299

Open
chris-ashe wants to merge 28 commits into
mainfrom
update_constraints_vars
Open

Update some constraints vars#4299
chris-ashe wants to merge 28 commits into
mainfrom
update_constraints_vars

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

This pull request focuses on standardizing and updating variable names across the codebase and input files for improved clarity and consistency, especially for constraint and physics-related parameters. It also updates documentation to reflect these new names and ensures all example input files use the revised identifiers.

Variable Renaming and Consistency

  • Updated variable names in process/core/input.py and all example input files to use clearer, more descriptive identifiers for key constraints and physics parameters, such as:
    • fdenef_nd_plasma_electron_limit_max
    • fiooicf_j_tf_wp_critical_max
    • psepbqarmaxp_div_bt_q_aspect_rmajor_max_mw
    • nflutfmaxflu_tf_neutron_fast_max
    • f_alpha_energy_confinement_minf_t_alpha_energy_confinement_min
    • zeff_maxn_charge_plasma_effective_vol_avg_max
    • aplasmin -> rminor_min
    • avail_min -> f_t_plant_available_min
    • fradpwr -> f_p_plasma_seperatrix_rad_max
    • pseprmax -> p_plasma_separatrix_rmajor_max_mw

Documentation Updates

  • Updated all relevant documentation files to reference the new variable names and provide accurate descriptions of their usage and default values, ensuring alignment with code changes.

Example Input File Modernization

  • Refactored all example input files to use the new variable names, ensuring they are compatible with the updated code and documentation.

Minor Improvements

  • Clarified comments and docstrings for improved readability in the codebase.

These changes collectively improve the maintainability and clarity of the codebase by enforcing consistent naming conventions and ensuring that documentation and examples are up to date.

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.

@codecov-commenter

codecov-commenter commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.58170% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.79%. Comparing base (89e1ebe) to head (64d5835).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
process/core/solver/constraints.py 42.85% 8 Missing ⚠️
process/models/physics/exhaust.py 33.33% 4 Missing ⚠️
process/models/physics/physics.py 50.00% 3 Missing ⚠️
process/core/scan.py 66.66% 1 Missing ⚠️
process/models/stellarator/coils/calculate.py 0.00% 1 Missing ⚠️
process/models/stellarator/coils/output.py 0.00% 1 Missing ⚠️
process/models/stellarator/stellarator.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4299   +/-   ##
=======================================
  Coverage   48.79%   48.79%           
=======================================
  Files         151      151           
  Lines       29383    29396   +13     
=======================================
+ Hits        14337    14344    +7     
- Misses      15046    15052    +6     

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

@chris-ashe chris-ashe force-pushed the update_constraints_vars branch 2 times, most recently from f8b768b to 611674f Compare June 18, 2026 08:53
@chris-ashe chris-ashe changed the title Update constraints vars Update some constraints vars Jun 18, 2026
@chris-ashe chris-ashe marked this pull request as ready for review June 18, 2026 14:47
@chris-ashe chris-ashe requested a review from a team as a code owner June 18, 2026 14:47
@timothy-nunn timothy-nunn self-assigned this Jun 18, 2026
Comment thread examples/data/scan_example_file_IN.DAT Outdated
@@ -1005,9 +1005,10 @@ def run(self):
+ self.data.current_drive.p_hcd_injected_total_mw
)
self.data.physics.f_p_plasma_separatrix_rad = (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This was being multiplied by 1e6 before, why is that no longer happening?

This seems to be causing some differences in the regression tests

Image

And might be why some of the regression tests are now failing to converge

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Have noticed now, p_heat above had the _mw suffix but will still being output in Watts. Have removed the 1e6 from that at clarified the docstring. The units should align now

- data.physics.beta_fast_alpha
- data.physics.beta_beam
)
value = data.physics.beta_thermal_vol_avg

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Were beta_fast_alpha and beta_beam always 0 before?

This constraint is active in the large tokamak eval file with i_beta_component = 1 and it does not appear to be changing the constraint value in the MFile.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This shouldnt change any value in the regression. Its just to use the actual calculated variable instead of doing redundant calculation

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is the definition on line 3193 of physics.py

self.data.physics.beta_thermal_vol_avg = (
            self.data.physics.beta_total_vol_avg
            - self.data.physics.beta_fast_alpha
            - self.data.physics.beta_beam

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can a modeller or two please review the changes to the constraints in this file, specifically 1, 17, 24, 56, 62, 68

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@j-a-foster Can you please take a look?

Comment thread process/data_structure/physics_variables.py Outdated
…ency in physics and constraint data structures
…and consistency; update related references in constraints and input files.
…stency; update related references in constraints, cost variables, and input files.
… for clarity and consistency; update related references across multiple files.
…ent_min` for clarity and consistency; update all related references across multiple files.
…ity and consistency; update all related references across multiple files.
… and consistency; update all related references across multiple files.
…rove docstring for p_div_bt_q_aspect_rmajor_mw
chris-ashe and others added 7 commits June 19, 2026 10:12
…cy; update all related references across multiple files.
- Updated docstrings for clarity, including detailed descriptions of parameters and return values.
- Refactored power calculations in the PlasmaExhaust class to use a new method for radiation fraction calculation.
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
@chris-ashe chris-ashe force-pushed the update_constraints_vars branch from cb91810 to ceeaa08 Compare June 19, 2026 09:13
Comment thread examples/data/scan_example_file_IN.DAT Outdated
@chris-ashe chris-ashe force-pushed the update_constraints_vars branch from ce05696 to e7485b3 Compare June 19, 2026 09:39
@chris-ashe chris-ashe force-pushed the update_constraints_vars branch from e7485b3 to 22a3bad Compare June 19, 2026 09:53
@chris-ashe chris-ashe force-pushed the update_constraints_vars branch from 6a2d98c to 10cd0fa Compare June 19, 2026 10:18

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the constraint equation changes and all look good to me. Happy with the other changes.

@chris-ashe chris-ashe force-pushed the update_constraints_vars branch 2 times, most recently from 64d5835 to 10cd0fa Compare June 22, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants