feat(equilibrium): calculate q(psi) from 2D psi map and F(psi) (#647) - #680
Merged
Merged
Conversation
- Expose q_from_flux_surface_averages in vaft.formula.equilibrium for the pure geometric formula with explicit 2*pi normalization and COCOS sign - Extend flux_surface_quantities in vaft.process.equilibrium to compute and return 'q' on each resolved contour and extrapolate q0 to magnetic axis in psi_N - Implement calculate_q_profile_from_psi in vaft.process.equilibrium supporting full COCOS compliance (Wb vs Wb/rad, signs), flexible f_profile inputs (scalar, array, callable, tuple), and return_details - Benchmark against exact analytic Solov'ev axis limit q0 and high-precision 1D contour quadrature across surfaces
- Add docstring unit tag [-] for cocos in q_from_flux_surface_averages. - Remove q_from_flux_surface_averages from vaft.process.equilibrium module exports to fix Jekyll doc building. - Extrapolate q to axis using low-degree polynomial over innermost resolved surfaces to filter discrete contour jitter. - Interpolate q gaps linearly in psi_N instead of sqrt(psi_N). - Handle unsorted/descending levels and extrapolate q_axis when 0.0 is not present in return_details. - Infer negative toroidal field (sigma_b0 = -1) when negative F is supplied with default sigma_b0=1. - Make spline evaluation lazy and move formula import outside inner loop. - Add regression tests covering all cold review cases.
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.
geometric formula with explicit 2*pi normalization and COCOS sign
'q' on each resolved contour and extrapolate q0 to magnetic axis in psi_N
full COCOS compliance (Wb vs Wb/rad, signs), flexible f_profile inputs
(scalar, array, callable, tuple), and return_details
contour quadrature across surfaces