⏲️ Update confinement time docs#3493
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3493 +/- ##
==========================================
+ Coverage 30.84% 31.20% +0.36%
==========================================
Files 80 81 +1
Lines 19327 19440 +113
==========================================
+ Hits 5961 6066 +105
- Misses 13366 13374 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
72b5075 to
4fc3e48
Compare
bb322ae to
590113b
Compare
There was a problem hiding this comment.
@j-a-foster Dont forget to add the doc page
06c80a4 to
e97a78d
Compare
j-a-foster
left a comment
There was a problem hiding this comment.
Some minor comments, otherwise happy with the docs.
| | 48 | NSTX gyro-Bohm (Buxton) (H-mode; spherical tokamak) | P. Buxton et al. 2019 Plasma Phys. Control. Fusion 61 035006 | | ||
| | 49 | Use input `tauee_in` | | | ||
| | 50 | ITPA20 (H-mode) | G. Verdoolaege et al 2021 Nucl. Fusion 61 076006 | | ||
| Normally most confinement scalings will be of the form: |
There was a problem hiding this comment.
Caveat that not all scalings listed contain all of these parameters e.g. epsilon
|
|
||
| $$ | ||
| \tau_{\text{E}} = 0.0367 I^{1.006} R^{1.731} \kappa_{\text{IPB}}^{1.45} P^{-0.735} \\ | ||
| \times \frac{\overline{n}_{19}^{0.49}}{1+e^\left({-9.403\left(\frac{\overline{n}_{19}^{0.49}}{B_{\text{T}}}\right)^{-1.365}}\right)} |
There was a problem hiding this comment.
The exponent in the 1+e in the denominator could be substituted for e.g. X and then underneath, define X = -9.403(n/Bt)^-1.365, just to tidy up the formula a bit. Not absolutely needed, will leave up to you to decide.
timothy-nunn
left a comment
There was a problem hiding this comment.
Happy with code changes, thanks for writing tests for each one. Please fix the conflicts.
| case ('ftaulimit') | ||
| call parse_real_variable('ftaulimit', ftaulimit, 0.001D0, 1.0D0, & | ||
| 'f-value for lower limit on taup/taueff the ratio of alpha particle to energy confinement times') | ||
| case ('falpha_energy_confinement') |
There was a problem hiding this comment.
The old variables do not appear to have been added to obsolete variables
…tion for available scalings
…cy across the codebase
…nsistency in confinement time scaling law
…istency across the codebase
…ency across the codebase
…nsistency across the codebase
…stency across the codebase
…y across the codebase
… in energy loss power calculations
…stency across input files and documentation
…lity and consistency
…nfinement calculations
… the codebase and documentation
…ariables for clarity and accuracy
c8f6e73 to
97ae8fb
Compare
j-a-foster
left a comment
There was a problem hiding this comment.
Happy with the docs - okay to be merged.
* ❇️ Create new confinement time file and add neo_alcator scaling * ✨Add Merezhkin-Mukhovatov confinement time calculation and update Neo-Alcator scaling * 🔄 Rename 'isc' to 'i_confinement_time' for clarity in confinement time scaling law * ♻️ Make user input confinement time be option zero for i_confinement_time * ✨ Add Mirnov confinement time calculation and integrate into physics module * ✨ Add Shimomura confinement time calculation and integrate into physics module * ✨ Add Kaye-Goldston confinement time calculation and update documentation for available scalings * ✨ Add ITER 89-P L-mode confinement time calculation and update documentation * ♻️ Update number of energy confinement time scaling laws to 50 and remove unused label * 📝 Add L-H power threshold scalings documentation and integrate into MkDocs navigation * ✨ Add ITER 89-O L-mode confinement time calculation and update documentation * ✨ Add Rebut-Lallia L-mode confinement time calculation and update documentation * ✨ Add Goldston L-mode confinement time calculation and update documentation * ✨ Add T-10 L-mode confinement time calculation and update documentation * ✨ Add JAERI / Odajima-Shimomura L-mode confinement time calculation and update documentation * ✨ Add ITER H90-P H-mode confinement time calculation and update documentation * ✨ Add Kaye "big" L-mode confinement time calculation and update documentation * 🔄 Rename variable 'iradloss' to 'i_rad_loss' for consistency in power balance calculations and update related documentation * ✨ Add minimum of ITER 89-P and ITER 89-O confinement time calculation and update documentation * ✨ Add Riedel L-mode scaling confinement time calculation and update documentation * ✨ Add Christiansen L-mode scaling confinement time calculation and update documentation * ✨ Add Lackner-Gottardi L-mode scaling confinement time calculation and update documentation * ✨ Add Neo-Kaye L-mode scaling confinement time calculation and update documentation * ✨ Add Riedel H-mode scaling confinement time calculation and update documentation * ✨ Add amended ITER H90-P confinement time calculation and update documentation * ✨ Add Sudo et al. stellarators/heliotron scaling confinement time calculation and update documentation * ✨ Add Gyro-reduced Bohm scaling confinement time calculation and update documentation * ✨ Add Lackner-Gottardi stellarator scaling confinement time calculation and update documentation * ✨ Add ELM-free ITER H-mode scaling confinement time calculation and update documentation * ✨ Add ELMy ITER H97-P(y) scaling confinement time calculation and update documentation * ✨ Add ITER-96P (ITER-97L) L-mode scaling confinement time calculation and update documentation * ✨ Add IPB98(y) ELMy H-mode scaling confinement time calculation and update documentation * 🔄 Rename kappaa_IPB to kappa_ipb for consistency in variable naming * 📝 Add more information about the kappa_ipb change * ✨ Add IPB98(y,1) ELMy H-mode scaling confinement time calculation and update documentation * ✨ Add IPB98(y,2) ELMy H-mode scaling confinement time calculation and update documentation * ✨ Add IPB98(y,3) ELMy H-mode scaling confinement time calculation and update documentation * ✨ Add IPB98(y,4) ELMy H-mode scaling confinement time calculation and update documentation * ✨ Add ISS95 stellarator scaling confinement time calculation and update documentation * ✨ Add ISS04 stellarator scaling confinement time calculation and update documentation * ✨ Add DS03 beta-independent H-mode scaling confinement time calculation and update documentation * ✨ Add Murari "Non-power law" H-mode scaling confinement time calculation and update documentation * ✨ Add Petty H-mode scaling confinement time calculation and update documentation * ✨ Add Hubbard I-mode nominal scaling confinement time calculation and update documentation * ✨ Add Hubbard I-mode lower scaling confinement time calculation and update documentation * ✨ Add Hubbard I-mode upper scaling confinement time calculation and update documentation * ✨ Add Menard NSTX H-mode scaling confinement time calculation and update documentation * ✨ Add Menard NSTX-Petty08 hybrid confinement time calculation and update Petty scaling references in documentation * ✨ Add Buxton NSTX gyro-Bohm confinement time calculation and update documentation * ✨ Add ITPA20 H-mode scaling confinement time calculation and update documentation * 🔄 Refactor pcond to calculate_confinement_time * ✨ Add ITER-93 ELM-free H-mode scaling confinement time calculation and update documentation * ✅ Fix integration test indexing fail * 🔥 Remove igmarcal function and put functionality into outplas * 🔄 Rename taup to t_alpha_confinement for clarity and update related documentation * 🔄 Rename tauei to t_ion_confinement for clarity and update related references * 🔄 Rename tauee to t_electron_confinement for clarity and update related references * 🔄 Rename t_alpha_confinement_taueff to f_alpha_energy_confinement for clarity and update related references, create it as a new variable * 🔄 Rename taueff to t_energy_confinement for clarity and update related references * 🔄 Rename taulimit to f_alpha_energy_confinement_min for clarity and update related references * ❇️ Add nTtau variable for Lawson triple product and update related references * 🔄 Rename dntau to ntau for clarity and update related references * 📝 Enhance plasma confinement documentation with overview, key constraints, and detailed scaling laws *⚠️ Add warning about TITAN Reversed-Field Pinch scaling being removed * ❇️ Add Lang high density H-mode scaling and related confinement time calculation * 👕 Apply new ruff linting rules * ❇️ Implement Valovic modified ELMy-H mode scaling for confinement time calculation and update documentation * ❇️ Add Kaye modified L-mode scaling for confinement time calculation and update documentation * ❇️ Add ITERH-PB98P(y) H-mode scaling for confinement time calculation and update documentation * Refactor confinement time calculations to use m_fuel_amu instead of afuel for improved accuracy * 🎨 Add all references to mkdocs page * Update documentation and code to use 'vol_plasma' instead of 'plasma_volume' for consistency in confinement calculations * 🔥 Remove unused inverse quadrature switch from L-mode scaling and related documentation * Add constants to ion/electron confinement time calc instead of loose floats * 🔥 Remove references to 'kappaa' from physics calculations and related tests for clarity and consistency * Refactor variable names for consistency: update 'kappaa' to 'kappa' in physics calculations and tests * Refactor physics variable names for clarity: update 'a_plasma_poloidal' to 'None' and 'aion' to 'm_ions_total_amu' * 🐛 Fix too many variables called to Neo Kaye scaling * Refactor ion confinement variable names for clarity: update 't_ion_confinement' to 't_ion_energy_confinement' across multiple files * Refactor electron confinement variable names for clarity: update 't_electron_confinement' to 't_electron_energy_confinement' across multiple files * ➖ rearranged hfact multiplication calc * ➕ Added ITPA20-IL confinement scaling for papercut * ➕ Added comment for ITPA20-IL scaling * 📝 Updated docs for new scaling * 📝 updated tauscl and ipnlaws * ➕ Added unit tests for various confinement time calculations * ➖ Removed inverse quadrature switch from multiple MFILE and IN files * Refactor confinement time calculations and update output formatting in physics module * 🔄 Rename ipnlaws to n_confinement_scalings for clarity and consistency across the codebase * 🔄 Update references from tauscl to labels_confinement_scalings for consistency in confinement time scaling law * 🔥 Remove overwritten ion confinement calculation * 🔄 Rename total_energy_conf_time to t_energy_confinement_beta for consistency across the codebase * 🔄 Rename ptripv to pden_ion_transport_loss_mw for clarity and consistency across the codebase * 🔄 Rename ptrepv to pden_electron_transport_loss_mw for clarity and consistency across the codebase * 🔄 Rename ptremw to p_electron_transport_loss_mw for clarity and consistency across the codebase * 🔄 Rename ptrimw to p_ion_transport_loss_mw for clarity and consistency across the codebase * 🔄 Update plasma confinement documentation for clarity and consistency in energy loss power calculations * 🔄 Rename ftaulimit to falpha_energy_confinement for clarity and consistency across input files and documentation * 🔄 Adjust formatting in energy confinement output for improved readability and consistency * 🔄 Clarify comments in physics.py regarding ion and electron energy confinement calculations * Rename powerht to p_plasma_loss_mw for clarity and consistency across the codebase and documentation * 🔄 Refactor H-factor calculation methods for clarity and consistency in physics module * 🔄 Fix typos in plasma confinement documentation and Fortran physics variables for clarity and accuracy * 📝 Doc review updates * 📝 Requested review changes, add variables to obsolete dictionary * 📝 Add subscripts to plasma current and loss power --------- Co-authored-by: Jack <jack.foster@ukaea.uk>
Description
A new file called
confinement_time.pyhas been created to store all of the confinement time scalings as seperate functions instead of being privately stored in thepcond()function.i_confinement_time == 0Namespace changes
Functions
pcond()->calculate_confinement_time()igmarcal->output_confinement_comparison(): Plotting the confinement time scaling comparison table is now a callable function that shows all scalings.fhfac()->find_other_h_factors(): The functionfhz()has now been placed inside as an internal function as it is only called byfind_other_h_factors().Variables
kappaa_IPB->kappa_ipbtaup->t_alpha_confinementtauei->t_ion_energy_confinementtauee->t_electron_energy_confinementt_alpha_confinement/taueff->f_alpha_energy_confinementtaueff->t_energy_confinementtaulimit->f_alpha_energy_confinement_mindntau->ntauiinvqd: Removed as source cannot be foundkappaa: Removed as variable is no longer used due to not checking legacy docsipnlaws->n_confinement_scalingstauscl->labels_confinement_scalingstotal_energy_conf_tim->t_energy_confinement_beta: This variable describes the confinement time calculated intrinsically from the total thermal energy and the chosen loss power.ptripv-> `pden_ion_transport_loss_mwptrepv->pden_electron_transport_loss_mwftaulimit->falpha_energy_confinementptrimw->p_ion_transport_loss_mwptremw->p_electron_transport_loss_mwpowerht->p_plasma_loss_mwisc->i_confinement_scaling✨ New additions
f_alpha_energy_confinement: Created as a new variable instead of being calculated as a fraction inoutplas(). Is now calculated and set in thephyaux()functionnTtau: New variable to properly represent the Lawson triple product as a calculated variable inphyaux()function.New expanded scaling output that now shows all scalings:
🧪 Tests
test_confinement_time.pyfile has been created intests/unitto test all of the scaling for the case where all the scaling inputs are equal to one. This should catch if any of the scaling exponents or variable definitions are changed🐛 Bugs
kappaa_IPBwas being called askappaa_ipbCoefficiecnt value for the ITER93-H scaling form ELM-free had the wrong coefficient of
0.053when the literature says0.036Calculating the ion and electron ransport losses has raw constants floats instead of using constants.f90. This caused the
calculate_confinement_time()tests to fail. Though only by a difference at the 5th decimal placeOld
New
calculate_confinement_time()beofre applying any of the scalings and is of the form:However at the bottom of the file it is simpky re-written as equal to the electron confinement time such as:
This has been in the code from the old GitLab version and the Git blame can always see this there. It has therefore been removed.
Checklist
I confirm that I have completed the following checks: