Conversation
aad5ff0 to
03be7fa
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4148 +/- ##
==========================================
+ Coverage 49.63% 49.69% +0.06%
==========================================
Files 148 148
Lines 29746 30098 +352
==========================================
+ Hits 14764 14957 +193
- Misses 14982 15141 +159 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds additional detailed physics outputs for collisions (times/frequencies/mean free paths), Spitzer slowing-down time, and Spitzer resistivity, and exposes them through unit tests, MFILE output, and summary plotting.
Changes:
- Compute and output new collision-related profiles plus Spitzer slowing-down time and Spitzer resistivity in
DetailedPhysics.run()/output_detailed_physics(). - Extend the physics variable data structure and initialization to include the new profiles.
- Add plotting helpers and extra summary pages to visualize the new profiles; extend the detailed-physics unit test to assert the new outputs are finite and correctly shaped.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit/test_physics.py |
Adds assertions for the new detailed-physics profiles. |
process/models/physics/physics.py |
Computes new collision/resistivity/slowing-down profiles; outputs them to MFILE. |
process/data_structure/physics_variables.py |
Adds new profile variables and initializes them. |
process/core/io/plot/summary.py |
Adds plots for new profiles and adjusts summary pagination/layout. |
documentation/source/physics-models/detailed_physics.md |
Documents new formulas for the added detailed-physics quantities. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
|
|
||
| # ============================ | ||
| # Resistivites |
There was a problem hiding this comment.
Section header comment has a typo ("Resistivites"). Please correct to "Resistivities" for consistency and readability.
| # Resistivites | |
| # Resistivities |
| physics_variables.res_plasma_fuel_spitzer_profile = self.calculate_spitzer_resistivity( | ||
| n_charge=1, | ||
| electron_ion_coulomb_log=physics_variables.plasma_coulomb_log_electron_deuteron_profile, | ||
| temp_plasma_electron_kev=self.plasma_profile.teprofile.profile_y, | ||
| ) |
There was a problem hiding this comment.
Spitzer resistivity is being stored in res_plasma_fuel_spitzer_profile, but the data structure also introduces rho_plasma_spitzer_classical_profile (which remains unused). Please align naming/usage (e.g., populate the newly-added *_spitzer_classical_profile, or remove/rename it) so there is a single canonical variable for the Spitzer resistivity profile.
| physics_variables.res_plasma_fuel_spitzer_profile = self.calculate_spitzer_resistivity( | |
| n_charge=1, | |
| electron_ion_coulomb_log=physics_variables.plasma_coulomb_log_electron_deuteron_profile, | |
| temp_plasma_electron_kev=self.plasma_profile.teprofile.profile_y, | |
| ) | |
| physics_variables.rho_plasma_spitzer_classical_profile = self.calculate_spitzer_resistivity( | |
| n_charge=1, | |
| electron_ion_coulomb_log=physics_variables.plasma_coulomb_log_electron_deuteron_profile, | |
| temp_plasma_electron_kev=self.plasma_profile.teprofile.profile_y, | |
| ) | |
| physics_variables.res_plasma_fuel_spitzer_profile = ( | |
| physics_variables.rho_plasma_spitzer_classical_profile | |
| ) |
je-cook
left a comment
There was a problem hiding this comment.
Mostly minors on top of my docstring one from before. I havent looked into the maths. I assume your tests cover the results of the calculations, if not we need a test for that
…anization and maintainability
… and profiles to DetailedPhysics class
… DetailedPhysics class
…eron, electron-triton, and electron-alpha interactions in plasma
…ctions in DetailedPhysics class
…s in DetailedPhysics class
…ons, and alpha particles
…ron, electron-triton, deuteron-triton, and electron-alpha interactions
…ity profile plots
…, electron-deuteron, electron-triton, and electron-alpha interactions
…ctron, electron-deuteron, electron-triton, and electron-alpha interactions
…, electron-deuteron, electron-triton, and electron-alpha interactions
…s for electrons, deuterons, and tritons
77f37c3 to
0e12fc7
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lify docstrings and improve readability
…g box styles for improved readability
je-cook
left a comment
There was a problem hiding this comment.
Approving from the code side. Modelling should be reviewed too
* Add methods to calculate electron-electron and electron-ion collision times * Refactor plotting functions into DetailedPhysics class for better organization and maintainability * Add profile for electron-electron collision time in plasma * Add collision time calculations and plotting to DetailedPhysics class * Add profiles for electron-deuteron and electron-triton collision times in plasma * Add electron-deuteron and electron-triton collision time calculations and profiles to DetailedPhysics class * Add profile for electron-alpha collision time in plasma * Add electron-alpha thermal collision time calculations and profile to DetailedPhysics class * Add collision frequency profiles for electron-electron, electron-deuteron, electron-triton, and electron-alpha interactions in plasma * Add collision frequency calculations and plotting for electron interactions in DetailedPhysics class * Add mean free path profiles for electron interactions in physics_variables module * Add mean free path calculations and plotting for electron interactions in DetailedPhysics class * Add Spitzer ion slowing down time calculation to DetailedPhysics class * Add electron-alpha Spitzer slowing down time profile to physics_variables module * Add Spitzer ion slowing down time calculation and plotting to DetailedPhysics class * Add Spitzer resistivity calculations and plotting to DetailedPhysics class * Adjust subplot spacing in main_plot function for improved layout * Post rebase commits * Update docs and tidy functions * Add fuel-specific Spitzer resistivity calculations and update related tests * Add volume averaged thermal velocities for electrons, deuterons, tritons, and alpha particles * Add volume averaged Coulomb logarithm calculations for electron-deuteron, electron-triton, deuteron-triton, and electron-alpha interactions * Update Spitzer label formatting in ion slowing down time and resistivity profile plots * Add volume averaged collision time calculations for electron-electron, electron-deuteron, electron-triton, and electron-alpha interactions * Add volume averaged collision frequency calculations for electron-electron, electron-deuteron, electron-triton, and electron-alpha interactions * Add volume averaged mean free path calculations for electron-electron, electron-deuteron, electron-triton, and electron-alpha interactions * Add volume averaged Spitzer resistivity calculations for plasma fuel ions * Add volume averaged plasma frequency and Larmor frequency calculations for electrons, deuterons, and tritons * Add volume averaged toroidal Larmor radius calculations for deuterons and tritons * Add volume averaged electron-alpha Spitzer slowing down time calculations * Add function to plot detailed plasma parameters from physics data * Add test for detailed physics profile computations with monkeypatching * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Refactor Debye length and velocity profile plotting functions to simplify docstrings and improve readability * Refactor plot_detailed_plasma_parameters to use variables for bounding box styles for improved readability --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request adds several new plasma physics variables to the
physics_variables.pydata structure, primarily focused on collision times, collision frequencies, mean free paths, and resistivity profiles for various plasma species. These additions enhance the granularity and detail of plasma modeling, especially for electron interactions with deuterons, tritons, and alpha particles.New plasma variable additions:
Added profiles for Spitzer classical resistivity, electron-alpha Spitzer slowing down time, and various collision times, collision frequencies, and mean free paths between electrons and other plasma species (deuterons, tritons, alpha particles) to the data structure (
process/data_structure/physics_variables.py).Initialization updates:
Updated the
init_physics_variablesfunction to include initialization and zeroing of the new plasma variable profiles and to ensure these new variables are properly set up as empty lists or default values (process/data_structure/physics_variables.py).Checklist
I confirm that I have completed the following checks: