Skip to content

Add pressure peaking fraction value - #4483

Open
chris-ashe wants to merge 8 commits into
mainfrom
add_pressure_peaking_fraction_value
Open

Add pressure peaking fraction value#4483
chris-ashe wants to merge 8 commits into
mainfrom
add_pressure_peaking_fraction_value

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces several enhancements to how plasma pressure and temperature profiles are calculated, stored, and reported, particularly improving the handling of pedestal profile cases. The main changes include adding new derived quantities (such as central-to-volume-averaged ratios), calculating and outputting pedestal and separatrix pressures, and updating the summary plots and output files to reflect these new metrics.

Enhancements to plasma profile calculations:

  • Added calculation and storage of the ratio of central to volume-averaged plasma electron temperature (f_temp_plasma_electron_on_axis_vol_avg) and plasma thermal pressure (f_pres_plasma_thermal_on_axis_vol_avg). These are now computed in both parabolic and pedestal parameterisations, and in the profile factors calculation.

  • For pedestal profile cases, the code now calculates and stores the plasma thermal pressure at the pedestal (pres_plasma_pedestal_thermal) and at the separatrix (pres_plasma_separatrix_thermal).
    Output and reporting improvements:

  • The output file generation now includes the new ratio quantities and, for pedestal profiles, the pedestal and separatrix pressures.

  • 🐛 Fixed units in the output for plasma thermal energies from [W] to [J] for clarity and correctness.

Plotting and summary display updates:

  • The plasma summary plots now display the new ratios and, when appropriate, show pedestal and separatrix pressures in the plot annotations.

Codebase and import updates:

  • Added necessary imports for PlasmaProfileShapeType to support the new logic for pedestal profile handling.

These changes improve the physical fidelity and reporting of plasma profile data, especially for cases with pedestal structure, and enhance the usability of the output for analysis and validation.## Description

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.

@chris-ashe chris-ashe added Physics Relating to the physics models New Variables labels Jul 29, 2026
@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.16216% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.72%. Comparing base (83d9f63) to head (542e0ed).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
process/core/io/plot/summary.py 0.00% 7 Missing ⚠️
process/models/physics/physics.py 0.00% 6 Missing ⚠️
process/models/physics/plasma_profiles.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4483      +/-   ##
==========================================
+ Coverage   48.67%   48.72%   +0.04%     
==========================================
  Files         151      151              
  Lines       29734    29778      +44     
==========================================
+ Hits        14474    14508      +34     
- Misses      15260    15270      +10     

☔ 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 marked this pull request as ready for review July 29, 2026 10:24
@chris-ashe
chris-ashe requested a review from a team as a code owner July 29, 2026 10:24
@chris-ashe
chris-ashe force-pushed the add_pressure_peaking_fraction_value branch from c0cd8b3 to 542e0ed Compare July 29, 2026 10:29
@timothy-nunn timothy-nunn self-assigned this Jul 31, 2026
@timothy-nunn
timothy-nunn requested a review from a team July 31, 2026 07:44
pres_plasma_thermal_on_axis: float = 0.0
"""Plasma central thermal pressure (p₀) (no fast ions or beam pressure) [Pa]"""

f_pres_plasma_thermal_on_axis_vol_avg: float = 0.0

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.

Maybe this is a real nit-pick but if it's a ratio should we use the "fraction" prefix for the variable name?

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.

We dont really have anything else in the style guide that fits the bill. f_ still represents a dimensionless unit that is the portion of something else

@mkovari

mkovari commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Hi Chris, Could you quote the actual equations from Johner that you have used, or your own derivations? For example in def tcore(), I can see that the result arises from the integral in Appendix C, but the actual derivation of the function is not too obvious.

mask = np.zeros_like(rho, dtype=bool)
mask[closest_idx:] = True
dpres_drho_pedestal = dpres_drho[mask]
max_grad_idx_pedestal = np.argmax(dpres_drho_pedestal)

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.

Should this use np.argmin? Since the pressure decreases with increasing radius, the steepest pedestal gradient should be the most negative value

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.

I found that using np.argmin gets you closer to the pedestal in the large tokamak case as it plateus very quickly before the pedestal point. If you go for the max at the pedestal drop their is about a 10kPa difference. I do worry that this will break if a very flat profile is used so the pressure profile is practically vertical before the pedestal point

image

@chris-ashe

chris-ashe commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Hi Chris, Could you quote the actual equations from Johner that you have used, or your own derivations? For example in def tcore(), I can see that the result arises from the integral in Appendix C, but the actual derivation of the function is not too obvious.

Hi @mkovari if this is for the pedestal pressure I have done a very quick estimate via the first derivative at the pedestal point which is normally the local minimum. Though I am thinking if we are able to just take the arithmetic mean of the two pedestal positions for density and temperature and then take a value at that index of the pedestal profile. Though I am open to sugestions on how to calculate. An analytical expression would always be better in this case

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

Labels

New Variables Physics Relating to the physics models

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants