Repository navigation
PENTRC - BUG FIX - Stop the edge collision frequency spline from ringing (#321) - #336
Merged
Merged
Conversation
…n from a cold edge node read_kin samples the kinetic table on a regular grid up to psi_n = 1 and cubic-splines nu_i, nu_e and logLambda on it. When the table ends short of psi_n = 1 (or reaches T = 0 there), the edge node is cold: logLambda < 0, nu is huge and negative (or infinite), and the global cubic spline of nu rings inward to psi_n ~ 0.87, flipping the sign of the collisional damping. - Floor T at 1 meV and logLambda at 1 inside the nu and logLambda formulas only (warning when either applies). n and T are not modified. - Refit only the logLambda, nu_i, nu_e columns with local monotone (pchip) node slopes, so one steep node cannot ring inward. n, T, omega_E keep their cubic spline and are bit-identical to before. - error stop on n <= 0 or T < 0 at the sampled nodes (previously NaN and an LSODE abort). Fixes #321. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMDGyfQKRZQMdk3NJXsKQE
krystophny
pushed a commit
to krystophny/GPEC
that referenced
this pull request
Oct 21, 2026
…format="rates-v1" With kinetic_format="rates-v1" in PENT_INPUT, the kinetic_file carries three extra columns (logLambda, nu_i, nu_e in s^-1) that replace the internal collision model. They are interpolated in log on the table so nodes stay positive, and they reuse the pchip nu slopes from the edge-collisionality fix. The default "legacy" path is unchanged. DCON kin_flag passes the same format. Slim replacement for the supplied-rates part of PrincetonUniversity#322 on top of PrincetonUniversity#336. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMDGyfQKRZQMdk3NJXsKQE
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.
Fixes #321.
Visual review package (figures, before/after): https://claude.ai/artifact/ETbq28nZE7HmCG7WuRa14Z
Problem
read_kinsamples the kinetic table on 101 regular nodes up to ψ_N = 1 and cubic-splines ν_i, ν_e and ln Λ on them. The CI kinetic table ends at ψ_N = 0.998, so the ψ = 1 node is extrapolated to T ≈ 1e-4 eV. There ln Λ = −7.6 and ν_i = −2e14 /s, and the global cubic spline of ν rings inward from that one node. On develop, ν_i first goes negative at ψ = 0.8725 and changes sign 13 times before the edge. The torque density goes negative (anti-damping) from ψ ≈ 0.87 to the edge. A table with T(1) = 0, as an analytic equilibrium would give, is worse: ν = ∞ at the node makes the whole ν spline NaN, and DCON aborts in LSODE at ψ = 0.13.Change (
pentrc/inputs.f90,read_kinonly, +22/−5)spline_fit(kin,"extrap"), replace the node slopes of the ln Λ, ν_i and ν_e columns with pchip slopes (spline_fit_pchipfrom EQUIL, RDCON, PENTRC - FEATURE - Monotone (pchip) fits for the tabulated Zeff and kinetic profiles #300).spline_evaluses only node values and slopes, so these columns become a local, monotone, non-overshooting interpolant, and a steep node cannot ring inward. The n, T, ω_E and Zeff columns keep their cubic spline.error stopon n ≤ 0 or T < 0 at the sampled nodes. These previously gave NaN and an LSODE abort.The table sampling is unchanged. An earlier draft held the end values beyond the table instead, but that bent T inside the table's last grid interval, so it was dropped. See the design note in the review package.
Results (gfortran, CI Solovev examples)
gpec_control_output, which follows DCON's kinetic W.Bad-input behavior
ERROR: read_kin - temperatures must be non-negativeERROR: read_kin - densities must be positiveReview
Two independent red-team reviews of the slope overwrite (
kin%fs1(:,6:8) = tmp_nu%fs1):kin_flagvia fourfit.F) evaluates throughfs/fs1only. Nothing refitskinafterread_kin, no code takes a derivative of columns 6–8, and OpenMPcopyindeep-copies the slopes.spline.oreproduces scipy'sPchipInterpolatorto 1e-15. It shows no overshoot on 1e6 → 1e14 edge profiles (where the cubic dips to −5e12) and leaves the untouched columns bit-identical.🤖 Generated with Claude Code
https://claude.ai/code/session_01VMDGyfQKRZQMdk3NJXsKQE