p_fast_reduction default 'sum' (IMAS.jl per-degree-of-freedom convention) - #48
Open
d-burg wants to merge 3 commits into
Open
p_fast_reduction default 'sum' (IMAS.jl per-degree-of-freedom convention)#48d-burg wants to merge 3 commits into
d-burg wants to merge 3 commits into
Conversation
…t pressure
IMAS.jl writes pressa/3 into each of pressure_fast_{parallel,perpendicular}
and defines pressure = p_par + 2*p_perp. 'trace' on such a dd keeps one third
of the fast-ion pressure (8-35% of the total on DIII-D 150000/171317/173982/
174823; closes to <2% with 'sum'). Default unchanged.
There was a problem hiding this comment.
🟡 Changes recommended
User-facing docs/examples still describe the default p_fast_reduction as "trace", which will mislead users after this behavior change.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates bouquet’s IMAS fast-ion pressure isotropization defaults to match the IMAS.jl/FUSE convention where directional fast-pressure fields are stored per degree of freedom, so the IMAS-path baseline uses the correct total fast-ion pressure by default.
Changes:
- Change the default fast-pressure reduction from
"trace"to"sum"(IMAS-path defaults). - Add
"sum"as a supported reduction method inisotropize_fast_pressure()and update validation/error messages. - Add a regression test covering the IMAS.jl per-DOF convention (
pressa/3in each directional field).
File summaries
| File | Description |
|---|---|
| tests/test_physics.py | Adds a test asserting "sum" recovers the IMAS.jl per-DOF fast pressure while "trace" yields one-third. |
| bouquet/physics.py | Changes isotropize_fast_pressure() default to "sum" and implements the new reduction option. |
| bouquet/io/imas.py | Changes read_imas_baseline() default p_fast_reduction to "sum" for IMAS-path baselines. |
| bouquet/config.py | Updates the config default/validation to include "sum" and documents the convention in config comments. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
183
to
+191
| # How to collapse anisotropic fast-ion pressure (p_perp, p_par) to the scalar | ||
| # p_fast that a scalar-pressure GS solver needs. See | ||
| # bouquet.physics.isotropize_fast_pressure. | ||
| # "trace" -> (2*p_perp + p_par)/3 [DEFAULT; tr(P)/3, preserves fast energy] | ||
| # "sum" -> p_par + 2*p_perp [DEFAULT; IMAS.jl stores per-degree-of-freedom | ||
| # fields, pressa/3 each -- "trace" keeps 1/3 of p_fast] | ||
| # "trace" -> (2*p_perp + p_par)/3 [tr(P)/3 for sources storing full p_perp/p_par] | ||
| # "mean" -> (p_perp + p_par)/2 | ||
| # "perp" -> p_perp (diamagnetic-dominant) | ||
| p_fast_reduction: str = "trace" | ||
| p_fast_reduction: str = "sum" |
Comment on lines
45
to
47
| For a gyrotropic pressure tensor ``P = p_par b b + p_perp (I - b b)`` the | ||
| standard scalar pressure is one-third of the trace: | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
p_fast_reductiondefault"trace"→"sum".IMAS.jl/FUSE store the fast-ion pressure per degree of freedom (
pressure_fast_parallelandpressure_fast_perpendiculareach carry a third of the isotropic value; the IMAS.jl total isp_par + 2 p_perp). The trace reduction therefore kept one third of the fast-ion pressure on FUSE-produced IDS input: 8–35 % of the total pressure on the DIII-D cases checked, closing to < 2 % with the sum."trace","mean","perp"remain available.Consequence: every IMAS-path baseline changes; g-file-path runs (which supply
p_fastdirectly) do not.🤖 Generated with Claude Code