Add Mercier gradient with respect to the flux slopes#7
Merged
Conversation
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.
Summary
Completes the analytic Mercier scalar-slope gradient by adding
∂d_mercier/∂toroidal_flux_slopeand∂d_mercier/∂poloidal_flux_slope(pressure_slope and iota_slope were already done). Both flux slopes are genuine paths in the objective gradient — a boundary/profile change moves the equilibrium's flux derivatives.toroidal_flux_slope(=flux_slope) couples through nearly every term:psi_slope(→ shear,iota_psi,dp_dpsi,d2v_dpsi2,current_slope_ratio),grad_psi = |psi_slope|·area/|J|(in every integral,∂grad_psi/∂flux = grad_psi/flux), AND the β denominator.poloidal_flux_slopeenters only the β denominator.∂β_mn/∂flux = −β_mn·(∂denom_mn/∂flux)/denom_mn, with∂denom/∂φ_t = −2πn,∂denom/∂φ_p = +2πm, zeroing the same resonant modes.d_mercier_d_toroidal_flux_slope(:),d_mercier_d_poloidal_flux_slope(:); existing fields and output kept.Verification
Before
The flux-slope gradients and their test do not exist on
main.After
FD (re-running grad_psi, the β solve, and the integrals at the perturbed slope) matches the analytic full gradient:
ctest -R mercier→ 4/4 (mercier_diagnostic,mercier_gradient,mercier_full_gradient,mercier_fluxslope_gradient); full suite 38/38. Behaviour-preserving:gliss_mercieronW7X_gst_ns64_MN12.ncbyte-identical to pristinemain(md5unchanged).-Werror,fo lint,fo fmtall clean.