3385 Update the plasma composition docs to include all new models#3386
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3386 +/- ##
=======================================
Coverage 30.60% 30.60%
=======================================
Files 80 80
Lines 19269 19254 -15
=======================================
- Hits 5897 5893 -4
+ Misses 13372 13361 -11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
229400e to
80e5a83
Compare
d0adab7 to
b24d113
Compare
c98dec3 to
e4c93b2
Compare
j-a-foster
left a comment
There was a problem hiding this comment.
Just a couple of minor things, otherwise docs all look good.
c5c962b to
016270b
Compare
j-a-foster
left a comment
There was a problem hiding this comment.
Additions to constants.f90 are all correct.
timothy-nunn
left a comment
There was a problem hiding this comment.
Happy with changes. Just want to check a section with lots of comments has all of them referenced.
| de2o = 1.0e-20 * physics_variables.ne0 | ||
| pao = 6.04e3 * (physics_variables.rminor * de2o) / physics_variables.bt | ||
| gfun = 0.93e0 * ( | ||
| 1.0e0 | ||
| + 0.85e0 * np.exp(-0.82e0 * physics_variables.rmajor / physics_variables.rminor) | ||
| ) | ||
| kfun = (physics_variables.alphan + 3.87e0 * physics_variables.alphat + 1.46e0) ** ( | ||
| -0.79e0 | ||
| ) | ||
| kfun = kfun * (1.98e0 + physics_variables.alphat) ** 1.36e0 * tbet**2.14e0 | ||
| kfun = kfun * (tbet**1.53e0 + 1.87e0 * physics_variables.alphat - 0.16e0) ** ( | ||
| -1.33e0 | ||
| gfun = 0.93e0 * (1.0e0 + 0.85e0 * np.exp(-0.82e0 * physics_variables.aspect)) | ||
| kfun = ( | ||
| (physics_variables.alphan + 3.87 * physics_variables.alphat + 1.46) ** -0.79 | ||
| * (1.98 + physics_variables.alphat) ** 1.36 | ||
| * physics_variables.tbeta**2.14 | ||
| * (physics_variables.tbeta**1.53 + 1.87 * physics_variables.alphat - 0.16) | ||
| ** -1.33 |
There was a problem hiding this comment.
Do all of these constants and factors come from the referenced papers?
There was a problem hiding this comment.
I will be coming back to this when I look at the radiation properly in another PR, was doing it originally with the composition review
8492e38 to
9a0d9e7
Compare
…t into its own file and update references
…r consistency across documentation and code
…one function docstring for clarity
…tended. Value was fixed to 2.0
…eplace with physics_variables.kappa for clarity
…e Physics class for better organization
… the density weighted calculation
…harge with constants for improved accuracy
…y across data files and code
… in calculations and documentation
…code and documentation
…cs_functions.py and use new values from constants.f90
…ctrons in obsolete_vars.py
…ces and iteration variables
9a0d9e7 to
fecf4a8
Compare
j-a-foster
left a comment
There was a problem hiding this comment.
Happy for this to be merged.
) * Rename and reorganize plasma documentation: separate radiation content into its own file and update references * 🔄 Rename impurity species count variable from nimp to n_impurities for consistency across documentation and code * 🔄 Rename afuel variable to m_fuel_amu for consistency across the codebase * 🔄 Update fuel species mass calculations to use constants for improved accuracy * 🔄 Rename abeam variable to m_beam_amu for consistency across documentation and code * ✅ Update unit tests failing due to using proper fuel species atomic masses * 🔄 Rename dnalp variable to nd_alphas for consistency across the codebase * 🔄 Rename dnprot variable to nd_protons for consistency across the codebase * 🔄 Rename protium variable to f_nd_protium_electrons for consistency across the codebase * 🔄 Rename dnbeam variable to nd_beam_ions for consistency across the codebase * 🔄 Rename dnitot variable to nd_ions_total for consistency across the codebase * 🔄 Rename dnz variable to nd_impurities for consistency across the codebase * 🔄 Rename aion variable to m_ions_total_amu for consistency across the codebase * 🔄 Add atomic mass constants for various elements to improve code clarity and maintainability * 📝 Update documentation to reflect changes in plasma composition and impurities section * 🔄 Rename pradmw variable to p_plasma_rad_mw for consistency across the codebase * 🔄 Rename photon_wall variable to p_fw_rad_mw for consistency across the codebase * 🔄 Rename peakradwallload variable to p_fw_rad_max_mw for consistency across the codebase * 🔄 Rename pinnerzoneradmw variable to p_plasma_inner_rad_mw for consistency across the codebase * 🔄 Rename pouterzoneradmw variable to p_plasma_outer_rad_mw for consistency across the codebase * 🔄 Rename peakfactrad variable to f_fw_rad_max for consistency across the codebase * ♻️ Rename p_fw_rad_mw and p_fw_rad_max_mw to pflux_fw_rad_mw and pflux_fw_rad_max_mw for consistency across the codebase * 🔄 Rename radpwr() to calculate_radiation_power() and add type hints and docstring * 🔄 Rename psyncpv to pden_plasma_sync_mw for consistency across the codebase * 🐛 fix old nimp variable name for new init.py * 🔄 Rename pradpv to pden_plasma_rad_mw for consistency across the codebase * 🎨 Update plasma radiation documentation and improve psync_albajar_fidone function docstring for clarity * 🐛 Add the tbeta parameter to the synchrotron power calculations as intended. Value was fixed to 2.0 * 🐛 Remove unused kap variable from psync_albajar_fidone function and replace with physics_variables.kappa for clarity * 🔄 Rename ssync to f_sync_reflect for clarity and consistency across the codebase * 🚚 Move coulomb logarithm definitions to the appropriate section in the Physics class for better organization * ➕ Add new m_proton_amu variable and multiply it by the proton mass in the density weighted calculation * 🐛 Refactor zeffai calculation to use mass-weighted plasma effective charge with constants for improved accuracy * 🎨 Update plasma_composition() doc section * 🎨 Enhance plasma radiation documentation with detailed loss functions and references * 🔄 Rename 'ralpne' to 'f_nd_alpha_electron' for clarity and consistency across data files and code * 🔄 Rename 'rnbeam' to 'f_nd_beam_electron' for clarity and consistency in calculations and documentation * 🔄 Rename 'deni' to 'nd_fuel_ions' for clarity and consistency across code and documentation * 🎨 Update ion density labels for clarity and consistency in output * 🔥 Remove the ATOMIC_MASS_DEUTERIUM and ATOMIC_MASS_TRITIUM from physics_functions.py and use new values from constants.f90 * 📝 Add output for average mass of fuel and beam ions in physics calculations * 🚚 Move density limit output to correct section * 🎨 Update output labels for electron and ion densities for clarity and consistency * 🎨 Add new variable mappings for peak factor, impurities, and beam electrons in obsolete_vars.py * 🎨 Clean up obsolete_vars.py and add separators in physics.py for better readability * 🎨 Enhance plasma composition documentation with impurity species indices and iteration variables * Requested review changes * 🎨 Refactor total calculation in Power class for improved readability
Description
This PR was originally meant to cover the radiation section of the code as well but will be put into a separate issue to prevent conflicts.
zeffainow added to output.Namespace changes
Functions
radpwr()->calculate_radiation_powers()Variables
Plasma Composition
afuel->m_fuel_amu: This has now been added to outputabeam->m_beam_amu: This has now been added to outputdnalp->nd_alphasdnprot->nd_protonsprotium->f_nd_protium_electronsdnbeam->nd_beam_ionsdnitot->nd_ions_totaldnz->nd_impuritiesaion->m_ions_total_amuralpne->f_nd_alpha_electronrnbeam->f_nd_beam_electrondeni->nd_fuel_ions⚡ Radiation
pradpv->pden_plasma_rad_mwpradmw->p_plasma_rad_mwpeakfactrad->f_fw_rad_maxpouterzoneradmw->p_plasma_outer_rad_mwpinnerzoneradmw->p_plasma_inner_rad_mwphoton_wall->pflux_fw_rad_mwpeakradwallload->pflux_fw_rad_max_mwpsyncpv->pden_plasma_sync_mwssync->f_sync_reflect✨ New additions
The new constants have been added to
constants.f90for the different fuel species atomic masses from NIST. These updated mass values caused the plasma composition and first wall heating unit tests to fail.m_deuteron_amu: 2.0 -> 2.013553212544m_helion_amu: 3.0 -> 3.014932246932m_triton_amu: 3.0 -> 3.01550071597m_alpha_amu: 4.0 -> 4.001506179129m_proton_amu:1.0 -> 1.0072764665789The
ATOMIC_MASS_DEUTERIUMandATOMIC_MASS_TRITIUMlocal variables inphysics_functions.pyhas been replaced with the values above.The same has been done for the impurity species taking in
impurity_radiation.py:m_protium_amu: 1.01 -> 1.00782503223m_helium_amu: 4.003 -> 4.002602m_beryllium_amu: 9.01 -> 9.0121831m_carbon_amu: 12.01 -> 12.0096m_nitrogen_amu: 14.01 -> 14.00643m_oxygen_amu: 15.999 -> 15.99903m_neon_amu: 20.18 -> 20.1797m_silicon_amu: 28.09 -> 28.084m_argon_amu: 39.95 -> 39.948m_iron_amu: 55.85 -> 55.845m_nickel_amu: 58.70 -> 58.6934m_krypton_amu: 83.80 -> 83.798m_xenon_amu: 131.30 -> 131.293m_tungsten_amu: 183.85 -> 183.84🐛 Bugs
psync_albajar_fidone()the temperature profile parametertbetawas not used as intended by the model authors but was just fixed to a value of 2.0.psync_albajar_fidone()the plasma elongationkappais not given to the function as intded, instead it was calculated internally as follows:plasma_composition()the proton density was not multiplied by its true mass value and was just set to 1.0.zeffai) did not use the true masses of the particles in atomic mass units. Impleneting the true masses causes a change in unit tests as such:Checklist
I confirm that I have completed the following checks: