Add D3D-like kinetic profiles and update example equilibrium#295
Add D3D-like kinetic profiles and update example equilibrium#295d-burg wants to merge 10 commits into
Conversation
…56 grid Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR updates the DIII-D-like example to use a corrected, grid-converged setup and adds “D3D-like” kinetic profiles enabling an NTV-torque diagnostic/regression.
Changes:
- Update the example radial grid configuration (switch to
grid_type="ldp"and fixedmpsi=256) to avoid edge under-resolution impacting δW/Δ′. - Add a kinetic profile input file and enable
[KineticForces]in the example to compute NTV torque. - Re-pin parallel-integration and Δ′ matrix regression assertions to the corrected equilibrium/grid, and add an NTV torque regression quantity.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/runtests_parallel_integration.jl | Tightens/pivots regression assertions for et[1] and Δ′ matrix real parts based on the corrected grid behavior. |
| regression-harness/cases/diiid_n1.toml | Adds an NTV torque quantity (FGAR) to the regression harness outputs. |
| examples/DIIID-like_ideal_example/gpec.toml | Switches grid settings and enables [KineticForces] for NTV torque diagnostics. |
| examples/DIIID-like_ideal_example/TkMkr_D3Dlike_Hmode_kinetic.gpeckf | Introduces a 6-column kinetic profile file used by the new [KineticForces] config. |
| # Parallel FM et[1] regression — pinned tightly, NOT bracketed. et[1] is grid-sensitive | ||
| # (log_asymptotic/auto-mpsi gives a spurious −0.09; ldp/mpsi=256 gives the converged | ||
| # +0.504), so a loose bracket would mask exactly that accuracy regression. Value is | ||
| # deterministic and reproducible (parallel and standard ODE paths agree to rel_diff=0). | ||
| @test isapprox(et_par, 0.504306; rtol=2e-2) |
| # No explicit parallel-vs-standard cross-path check: both paths share the equilibrium | ||
| # grid, so they agree (rel_diff=0) even on a bad grid — a cross-path check is blind to | ||
| # grid/accuracy regressions. The tight absolute pin above is the guard for those. |
| [quantities.ntv_torque_fgar] | ||
| h5path = "kinetic_forces/fgar/total_torque" | ||
| type = "real_vector" | ||
| extract = "all_real" | ||
| label = "NTV torque FGAR (Re,Im) [N·m]" |
| @@ -0,0 +1,515 @@ | |||
| psi_n n_i[m^-3] n_e[m^-3] T_i[eV] T_e[eV] omega_E[rad/s] | |||
|
Thanks @d-burg! Two comments before doing a full review:
|
…ptures q=6) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add read_kinetic_file (extension dispatch) and write_kinetic_h5 for a GPEC HDF5 kinetic schema (psi, n_i, n_e, T_i, T_e, omega_E; optional omega_tor, chi_e, chi_phi). Legacy 6-column ASCII (.gpeckf/.kin) still reads via the same path; the NTV loader is refactored onto the dispatcher with bit-identical results. Adds round-trip / ASCII-vs-HDF5 equivalence tests and docs; .gitignore tracks kinetic .h5 inputs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…brium, analytic ExB, HDF5 profiles Edge-current-matched equilibrium (q=6 retained at psihigh=0.995; fixed mpsi to avoid edge under-resolution, see #302). Kinetic profiles carry an analytic ExB rotation (omega_E = omega_tor - omega_dia) and synthetic transport diffusivities chi_e/chi_phi, shipped in the new .h5 (gpec.toml points at it; .gpeckf retained for back-compat). Relax NTV psi-quadrature tolerances as an interim mitigation (see #303). Re-pin the parallel-integration regression (et[1], Delta-prime diagonal) for the updated equilibrium. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… torque Drop leftover println/printf debug in tpsi! that flooded stdout during the psi-quadrature (see #303). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Latest changes
Related issues
|
|
this looks very promising! I like the new rotation. thanks for getting it together. I'll need to find time to look into the related issues, but we can get through them I'm sure. almost there! |
Drop the unverified 'parallel and standard ODE paths agree to rel_diff=0' claim from the DIIID-like testset (it only runs the parallel path); note the cross-path agreement is verified on the Solovev testset. Addresses PR review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@logan-nc do we have your blessing to merge this new profile architecture, or should I run it by @matt-pharr first? |
|
definitely get a second human to review it before merging plz. I probably won't get to read any gpec code until Thursday |
|
@d-burg I can review this. I want to see this so I can get profiles set up for resistive |
|
(Updated with final numbers from #313, which panels the ψ quadrature at the rational surfaces and the located kinetic resonances Ω_ℓ(x=1)=0 for the case's full ℓ ∈ −nl:nl range.) Ran this PR's DIII-D-like example through the #303 fix branch (PR #313). Data files from this branch (geqdsk +
Takeaways:
|




Adds kinetic profiles and an NTV-torque demonstration to the DIII-D-like example, and fixes a grid setting that was producing inaccurate ideal stability results. Closes #268.
Changes
TkMkr_D3Dlike_Hmode_kinetic.gpeckf): six columnspsi_n, n_i, n_e, T_i, T_e, omega_E.
Grid fix
mpsi = 0(auto), which under-resolves the edge (~11 edge points) and produced a spurious, sign-flipped delta_W and unphysical edge delta-prime (order 1e4). Switched togrid_type = "ldp"with a fixedmpsi = 256. Ideal delta_W and the inner-surface delta-prime values now agree with Fortran DCON.Test updates
et[1]and the inner-surface (q = 2, 3, 4) delta-prime are pinned tightly; the near-separatrix surfaces (q = 5, 6) are only checked for finiteness, since their values and signs are not grid-converged.Notes
diiid_n1regression baseline shifts as expected from the equilibrium and grid changes; the new values are the correct ones.grid_type='log_asymptotic'