8000 🔄 Update reaction variables to new style by chris-ashe · Pull Request #3656 · ukaea/PROCESS · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🔄 Update reaction variables to new style #3656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
May 14, 2025

Conversation

chris-ashe
Copy link
Collaborator
@chris-ashe chris-ashe commented May 8, 2025

Description

Since the restructuring of the fusion reactions done in #3345 came before the style guide the variable did not match. They have now been re-worded to fit the style guide.

Documentation enhancements:

  • Added new naming conventions for fusion rates (fusrat_) and fusion rate densities (fusden_) in standards.md.
  • Updated examples in documentation to reflect the new variable naming conventions, ensuring clarity and alignment with the codebase.

✨ New variables

p_beam_neutron_mw (See bugs section below)
fusrat_total
p_beam_dt_mw


🔄 Variable changes

Constriant

powfmax -> p_fusion_total_max_mw
ffuspow -> fp_fusion_total_max_mw

Total Powers

fusion_power -> p_fusion_total_mw
dt_power_total -> p_dt_total_mw
dt_power_plasma -> p_plasma_dt_mw
dd_power -> p_dd_total_mw
dhe3_power -> p_dhe3_total_mw


Rates

fusion_rate_density_total -> fusden_total
fusion_rate_density_plasma -> fusden_plasma
alpha_rate_density_total -> fusden_alpha_total
alpha_rate_density_plasma -> fusden_alpha_plasma


Alpha power

alpha_power_total -> p_alpha_total_mw
alpha_power_density_total -> pden_alpha_total_mw
alpha_power_plasma -> p_plasma_alpha_mw
alpha_power_density_plasma -> pden_plasma_alpha_mw
alpha_power_beams -> p_beam_alpha_mw
alpha_power_electron_density -> f_pden_alpha_electron_mw
alpha_power_ions_density -> f_pden_alpha_ions_mw


Neutron Power

neutron_power_total -> p_neutron_total_mw
neutron_power_density_total -> pden_neutron_total_mw
neutron_power_plasma -> p_plasma_neutron_mw
neutron_power_density_plasma -> pden_plasma_neutron_mw
neutron_power_beams -> p_beam_neutron_mw


Charged particle power

non_alpha_charged_power -> p_non_alpha_charged_mw
charged_particle_power -> p_charged_particle_mw
charged_power_density -> pden_charged_particle_mw


📝 Output changes

image

🐛 Bugs

The calculation of the total fusion power from the beam just used 5 as the multiplication power instead of using the proper ratio found in constants.f90

physics_variables.p_dt_total_mw = (
                physics_variables.p_plasma_dt_mw
                + 5.0e0 * physics_variables.p_beam_alpha_mw
            )

physics_variables.p_plasma_dt_mw
                + (1.0 / (1.0 - constants.dt_neutron_energy_fraction))
                * physics_variables.p_beam_alpha_mw
            )

The beam neutron power was being calculated in output (outplas()) instead of in the code. It was also using the wrong energy sharing fraction like for the alpha power above. This

self.outfile,
            "Neutron power: beam-plasma (MW)",
            "(p_beam_neutron_mw)",
            physics_variables.p_beam_alpha_mw * 4.0e0,
            "OP ",

physics_variables.p_beam_neutron_mw = physics_variables.p_beam_alpha_mw * (
                constants.dt_neutron_energy_fraction
                / (1 - constants.dt_neutron_energy_fraction)
            )

self.outfile,
            "Neutron power: beam-plasma (MW)",
            "(p_beam_neutron_mw)",
            physics_variables.p_beam_neutron_mw,
            "OP ",

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

@codecov-commenter
Copy link
codecov-commenter commented May 8, 2025

Codecov Report

Attention: Patch coverage is 36.30137% with 93 lines in your changes missing coverage. Please review.

Project coverage is 35.09%. Comparing base (b5572eb) to head (0bc8b5a).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
process/physics.py 36.14% 53 Missing ⚠️
process/fusion_reactions.py 54.16% 11 Missing ⚠️
process/stellarator.py 0.00% 11 Missing ⚠️
process/io/sankey_funcs.py 0.00% 8 Missing ⚠️
process/ife.py 0.00% 3 Missing ⚠️
process/evaluators.py 0.00% 1 Missing ⚠️
process/hcpb.py 50.00% 1 Missing ⚠️
process/objectives.py 0.00% 1 Missing ⚠️
process/physics_functions.py 0.00% 1 Missing ⚠️
process/power.py 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3656      +/-   ##
==========================================
- Coverage   36.36%   35.09%   -1.27%     
==========================================
  Files          88       88              
  Lines       22108    24951    +2843     
==========================================
+ Hits         8039     8757     +718     
- Misses      14069    16194    +2125     

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

chris-ashe added 22 commits May 8, 2025 13:42
< 10000 input type="hidden" name="disable_live_updates" value="false" autocomplete="off" data-targets="batch-deferred-content.inputs" />
… for consistency across variables
@chris-ashe chris-ashe force-pushed the update_reaction_variables branch from 0a3a8e9 to e4afc65 Compare May 8, 2025 13:15
@chris-ashe chris-ashe force-pushed the update_reaction_variables branch from 176c682 to e0ab864 Compare May 9, 2025 13:14
@chris-ashe chris-ashe marked this pull request as ready for review May 9, 2025 13:19
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates reaction variable names and related constants for fusion power calculations to conform with the new PROCESS style guide. Key changes include renaming variables (e.g. from fusion_power to p_fusion_total_mw and ffuspow to fp_fusion_total_max_mw), updating associated documentation examples, and modifying input data files to reflect the new naming conventions.

Reviewed Changes

Copilot reviewed 78 out of 78 changed files in this pull request and generated no comments.

Show a summary per file
File Description
process/costs_2015.py Updated cost scaling to use the new fusion power variable.
process/costs.py Changed fusion power references for cost calculations to the new variable names.
process/availability.py Revised fusion power scaling in availability calculations in line with the new style.
examples/scan.ipynb, examples/plot_solutions.ipynb Updated command-line and in-notebook references for fusion power variables.
examples/data/*.DAT Renamed fusion power variables in input data to match the updated naming convention.
documentation/proc-pages/physics-models/* Updated documentation to describe the new variable names and scaling factors.
documentation/proc-pages/development/* Adjusted standards and constraint equation documentation along with the variable renames.
Comments suppressed due to low confidence (1)

documentation/proc-pages/development/add-vars.md:256

  • Verify that the updated scaling factor expression correctly reflects the intended calculation. Using p_fusion_total_max_mw in both the numerator and denominator may simplify unexpectedly, so please ensure this is the desired behavior.
args%cc =  1.0D0 - fp_fusion_total_max_mw * p_fusion_total_max_mw/p_fusion_total_mw

@jonmaddock jonmaddock requested review from clmould and removed request for jonmaddock May 9, 2025 13:23
@chris-ashe chris-ashe force-pushed the update_reaction_variables branch from d875006 to 5bd4fe7 Compare May 9, 2025 13:45
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 with the variable name changes - all in line with the standard guide.

Copy link
Collaborator
@clmould clmould left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@timothy-nunn timothy-nunn merged commit 89f2296 into main May 14, 2025
14 of 18 checks passed
ym1906 pushed a commit that referenced this pull request May 16, 2025
* 📝 Add guidelines for fusion rates and fusion rate densities in style guide

* 🔄 Rename fusion_power to p_fusion_total_mw

* 🔄 Rename dt_power_total to p_dt_total_mw for consistency across variables

* 🔄 Rename dt_power_plasma to p_plasma_dt_mw for consistency across variables

* 🔄 Rename dd_power to p_dd_total_mw for consistency across variables

* 🔄 Rename dhe3_power to p_dhe3_total_mw for consistency across variables

* 🔄 Rename fusion_rate_density_total to fusden_total for consistency across variables

* 🔄 Rename fusion_rate_density_plasma to fusden_plasma for consistency across variables

* 🔄 Rename alpha_rate_density_total to fusden_alpha_total for consistency across variables

* 🔄 Rename alpha_rate_density_plasma to fusden_plasma_alpha for consistency across variables

* 🔄 Rename alpha_power_total to p_alpha_total_mw for consistency across variables

* 🔄 Rename alpha_power_density_total to pden_alpha_total_mw for consistency across variables

* 🔄 Rename alpha_power_plasma to p_plasma_alpha_mw for consistency across variables

* 🔄 Rename alpha_power_density_plasma to pden_plasma_alpha_mw for consistency across variables

* 🔄 Rename alpha_power_beams to p_beam_alpha_mw for consistency across variables

* 🔄 Rename alpha_power_electron_density to f_pden_alpha_electron_mw for consistency across variables

* 🔄 Rename alpha_power_ions_density to f_pden_alpha_ions_mw for consistency across variables

* 🔄 Rename neutron_power_total to p_neutron_total_mw for consistency across variables

* 🔄 Rename neutron_power_density_total to pden_neutron_total_mw for consistency across variables

* 🔄 Rename neutron_power_plasma to p_plasma_neutron_mw for consistency across variables

* 🔄 Rename neutron_power_density_plasma to pden_plasma_neutron_mw for consistency across variables

* 🔄 Rename neutron_power_beams to p_beam_neutron_mw for consistency across variables

* 🔄 Rename non_alpha_charged_power to p_non_alpha_charged_mw for consistency across variables

* 🔄 Rename charged_particle_power to p_charged_particle_mw for consistency across variables

* 🔄 Rename total_power_deposited_in_plasma to p_plasma_heating_total_mw for consistency across variables

* 🔄 Rename powfmax to p_fusion_total_max_mw

* 🔄 Rename  ffuspow to fp_fusion_total_max_mw

* 🔄 Rename  charged_power_density to pden_charged_particle_mw

* 🐛 Fix energy fraction of power from beam to total dt energy

* ❇️ Add p_beam_neutron_mw variable for neutron power from hot neutral beam ions

* 🐛 Make p_beam_neutron calculation use proper ratios

* Update test files with new variables

* 📝 update output with new variables

* 🐛 Rename pden_charged_particle_mw to pden_non_alpha_charged_mw across multiple files for clarity and consistency

* 📝 Add new obsolete variable mappings for fusion power in obsolete_vars.py

* Remove redundant statement about alpha power coupling in plasma heating

* Rename powfmax to p_fusion_total_max_mw for clarity in fusion power limits
ym1906 pushed a commit that referenced this pull request May 16, 2025
* 📝 Add guidelines for fusion rates and fusion rate densities in style guide

* 🔄 Rename fusion_power to p_fusion_total_mw

* 🔄 Rename dt_power_total to p_dt_total_mw for consistency across variables

* 🔄 Rename dt_power_plasma to p_plasma_dt_mw for consistency across variables

* 🔄 Rename dd_power to p_dd_total_mw for consistency across variables

* 🔄 Rename dhe3_power to p_dhe3_total_mw for consistency across variables

* 🔄 Rename fusion_rate_density_total to fusden_total for consistency across variables

* 🔄 Rename fusion_rate_density_plasma to fusden_plasma for consistency across variables

* 🔄 Rename alpha_rate_density_total to fusden_alpha_total for consistency across variables

* 🔄 Rename alpha_rate_density_plasma to fusden_plasma_alpha for consistency across variables

* 🔄 Rename alpha_power_total to p_alpha_total_mw for consistency across variables

* 🔄 Rename alpha_power_density_total to pden_alpha_total_mw for consistency across variables

* 🔄 Rename alpha_power_plasma to p_plasma_alpha_mw for consistency across variables

* 🔄 Rename alpha_power_density_plasma to pden_plasma_alpha_mw for consistency across variables

* 🔄 Rename alpha_power_beams to p_beam_alpha_mw for consistency across variables

* 🔄 Rename alpha_power_electron_density to f_pden_alpha_electron_mw for consistency across variables

* 🔄 Rename alpha_power_ions_density to f_pden_alpha_ions_mw for consistency across variables

* 🔄 Rename neutron_power_total to p_neutron_total_mw for consistency across variables

* 🔄 Rename neutron_power_density_total to pden_neutron_total_mw for consistency across variables

* 🔄 Rename neutron_power_plasma to p_plasma_neutron_mw for consistency across variables

* 🔄 Rename neutron_power_density_plasma to pden_plasma_neutron_mw for consistency across variables

* 🔄 Rename neutron_power_beams to p_beam_neutron_mw for consistency across variables

* 🔄 Rename non_alpha_charged_power to p_non_alpha_charged_mw for consistency across variables

* 🔄 Rename charged_particle_power to p_charged_particle_mw for consistency across variables

* 🔄 Rename total_power_deposited_in_plasma to p_plasma_heating_total_mw for consistency across variables

* 🔄 Rename powfmax to p_fusion_total_max_mw

* 🔄 Rename  ffuspow to fp_fusion_total_max_mw

* 🔄 Rename  charged_power_density to pden_charged_particle_mw

* 🐛 Fix energy fraction of power from beam to total dt energy

* ❇️ Add p_beam_neutron_mw variable for neutron power from hot neutral beam ions

* 🐛 Make p_beam_neutron calculation use proper ratios

* Update test files with new variables

* 📝 update output with new variables

* 🐛 Rename pden_charged_particle_mw to pden_non_alpha_charged_mw across multiple files for clarity and consistency

* 📝 Add new obsolete variable mappings for fusion power in obsolete_vars.py

* Remove redundant statement about alpha power coupling in plasma heating

* Rename powfmax to p_fusion_total_max_mw for clarity in fusion power limits
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.

6 participants
0