Skip to content

p_fast_reduction default 'sum' (IMAS.jl per-degree-of-freedom convention) - #48

Open
d-burg wants to merge 3 commits into
mainfrom
fix/pfast-imas-convention
Open

p_fast_reduction default 'sum' (IMAS.jl per-degree-of-freedom convention)#48
d-burg wants to merge 3 commits into
mainfrom
fix/pfast-imas-convention

Conversation

@d-burg

@d-burg d-burg commented Sep 4, 2026

Copy link
Copy Markdown
Owner

p_fast_reduction default "trace""sum".

IMAS.jl/FUSE store the fast-ion pressure per degree of freedom (pressure_fast_parallel and pressure_fast_perpendicular each carry a third of the isotropic value; the IMAS.jl total is p_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_fast directly) do not.

🤖 Generated with Claude Code

…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.
Copilot AI lite review requested due to automatic review settings September 4, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 in isotropize_fast_pressure() and update validation/error messages.
  • Add a regression test covering the IMAS.jl per-DOF convention (pressa/3 in 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 thread bouquet/config.py
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 thread bouquet/physics.py
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:

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants