Repository navigation
Oft interface improvements using ifiles - #298
Open
StuartBenjamin wants to merge 31 commits into
Open
StuartBenjamin wants to merge 31 commits into
StuartBenjamin wants to merge 31 commits into
Conversation
…explitcit indexing control to match Zeff spline assignment
…r frame VACUUM runs on a theta-reversed boundary, so wv comes back complex-conjugated relative to wp; conjugate it after mscvac (free_run and free_wvmats). The eigenvector norm used jmat(jpert-ipert), the transpose of the plasma-matrix index order; use jmat(ipert-jpert). Up-down symmetric cases are unchanged; asymmetric ones no longer depend on the theta origin.
…er frame Same change as DCON: conjugate wv after mscvac (free_run and free_get_wvac, used by the Galerkin solve) and transpose the norm.
…ier frame STRIDE called mscvac with complex_flag false, keeping only Re(wv), which is itself origin-dependent. Keep the full matrix, conjugate it as in DCON, and transpose the norm.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ler-supplied knot derivatives Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…' and p' (efit, ldp_i)
New equil.in variable profile_source:
values - tabulated f, p; spline-fitted derivatives (default, unchanged)
hermite - tabulated f, p with the tabulated derivatives as knot slopes
integrate - f**2/2 and p integrated inward from the boundary values
(as in Julia GPEC PR #506), tabulated derivatives as slopes
read_eq_efit no longer discards FFPRIM and PPRIME, and fixes an
out-of-bounds index when the g-file has no q profile. read_eq_ldp_i
reads optional trailing FF' and p' records. Falls back to values with a
warning when the derivatives are non-finite or disagree in sign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nverse sq construction sq_in and sq are fit with spline_fit_hermite so the profile slopes from profile_source are not re-derived by spline differentiation. newq0 rescaling updates the f slope consistently (f' -> f'/ffac). With profile_source = values, output is bit-for-bit unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Against a TokaMaker equilibrium with known profiles, integrate gives F'' errors of 0.1-0.8% (0.1 < psi_n < 0.85) that fall with resolution, where values and hermite give 2-47% that grow with mpsi (single-precision f amplified by differentiation). STRIDE Delta' is correspondingly more consistent across g-file resolutions. Set profile_source="values" to recover the previous behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… end-slope order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dcon-vacuum-theta-frame) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A second assignment of 4 titles reallocated sq%title, so the dump record was 6 bytes short and read_eq_dump failed (I/O past end of record). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
equil_out_dump appends the supplied-derivative flags with sq%fs1(:,1:2), then eqfun; read_eq_dump reads them when present (older dumps read as before) and no longer fails when the equilibrium is re-read (STRIDE psilim reform). DCON efit -> dump -> dcon reproduces f, mu0p, q, D_I, D_R exactly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bulated data without derivatives Fritsch-Carlson interior slopes with scipy PchipInterpolator's end slopes, so Python front ends (bouquet, TPS) can reproduce GPEC's interpolant exactly. Unit test checks values and derivatives against scipy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…profile table The tabulated Zeff (RDCON MRE terms) and the PENTRC kinetic input table carry pedestal-scale gradients; a cubic spline rings there, pchip does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Derivative sign taken from f and p together, so a flat p (or f) no longer forces the values fallback; the dump writes eqfun only when it exists; shorter equil.in entry; unit test drops redundant wrappers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tabulated values paired with tabulated derivatives put the values' rounding noise into f'' (the worst option in the comparison). spline_fit_hermite stays, used by integrate to keep the derivatives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…format
With f < 0 (e.g. a TokaMaker equilibrium with B_t < 0) inverse_run built a
negative q and stopped ('Invalid extrapolation near axis'). Flipping the sign of
f in an i-file now gives identical results.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ev is COMPLEX but zheev returns REAL eigenvalues, so W_v_eigenvalue in the netcdf output had the eigenvalues packed pairwise into the real and imaginary parts of the first half of ev, with stale values in the rest. zheev also got lwork=2*mpert+1 for a work array of 2*mpert-1. Use a REAL buffer and the correct lwork. Only W_v_eigenvalue changes; all other outputs (Delta', W_t, eigenvectors) are bit-identical on the DIII-D resistive example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rf info) gal_solve ignored info from zgbtrf/zpbtrf, so an indefinite matrix with solver='cholesky' gave a garbage Delta' with no warning (g147131 n=1: 2/1 = 2.3e7). Now program_stop with the info value. LU results unchanged (bit-identical Delta' on g147131). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Galerkin matrix is not positive definite zpbtrf info was ignored, so solver='cholesky' on an indefinite matrix gave a garbage Delta' (g147131 n=1: 2/1 = 2.3e7). Now the lower band is kept, and on zpbtrf failure the same Hermitian matrix is solved by LU (2/1 = 7.3787; solver='LU' gives 7.3641, its boundary rows differ). zgbtrf failure stops the run. solver='LU' results are bit-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…flowed to '**' at 25+ singular surfaces and crashed rdcon writing delta_gw.out) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@StuartBenjamin we are trying to wrap up fortran dev... fill out the reviewer and assignee and labels metadata asap to get this in before 1.6. I suggest Matt or Daniel. Same for your other PRs. Proceed without me |
This branch has not been deployed
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.
GPEC PR report:
OFT_interface→developThis PR adds 1 commit on top of PR #297.
Purpose
Getting OpenFUSIONToolkit/TokaMaker i-files accurately read with
eq_type = "ldp_i". The work that went into this is spre spread over three PRs:ifile_fixes_for_GPEC_interface: points lie exactly on their flux surfaces, and FF′ and p′ records are written. See Ifile fixes for gpec interface OpenFUSIONToolkit/OpenFUSIONToolkit#357.spline_improvements: reads FF′ and p′ records withprofile_source = integrate(new default).Changes
read_eq_ldp_itakes |F| (19a8099b), asread_eq_efitdoes.inverse_runcomputes q in proportion to F. An i-file with F < 0 (TokaMaker with B_t < 0) therefore stopped with "Invalid extrapolation near axis".Results: i-file vs g-file
One TokaMaker reference equilibrium (DIII-D-like, q0 = 1.25, q95 = 4.49), written by
save_ifilewith FF′ and p′ records and bysave_eqdsk, run through STRIDE withprofile_source = integrate. The last surface is at the same true ψ_N = 0.985 in every run. Integrated GSE is the θ-integrated residual over the θ-integrated source, median over 0.05 < ψ_N < 0.95.efit)ldp_i)Status
Zeff_profile_support99378252, which also has the vacuum fix, on the full chain (OFT_interface = spline_improvements + this commit):logLambda/nuwere already unphysical (negative) with the cubic spline and change value.How to reproduce
The scripts and their inputs ship with this PR as OFT_interface_scripts.zip: its
README.mdhas the commands.