PERTURBED EQUILIBRIUM - Coupling matrices and resonant vectors for singular coupling#201
Merged
Merged
Conversation
… review' comments claude.yml was matching any '@claude' mention, including '@claude review', causing both workflows to fire simultaneously. Added !contains('@claude review') exclusion so review requests are handled exclusively by claude-code-review.yml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…claude-reviews GITHUB ACTIONS - BUG FIX - Prevent duplicate Claude reviews on @claude review comments
…vectors for singular coupling Replaces the zero-padded [npert, msing] singular coupling arrays with a dense [n_rational × numpert_total] coupling matrix structure matching Fortran GPEC's C_f_x_out / Phi_res output format. Key changes: - PerturbedEquilibriumState: add C_ coupling matrices [n_rational × numpert_total], applied resonant vectors [n_rational], and surface metadata (rational_psi, rational_q, rational_m_res, rational_n, rational_surface_idx); remove legacy coupling_coefficient and resonant_amplitude fields - SingularCoupling: rewrite compute_singular_coupling_metrics! to collect all resonant (surface, n) pairs, compute full coupling rows from off-diagonal ca_l/ca_r columns (jump_vec = ca_r[:,resnum,2,s] - ca_l[:,resnum,2,s]), precompute L_surf once per pair, apply forcing via R = C * amp_vec; update compute_island_diagnostics! for new [n_rational] vector structure - Utils: rewrite write_outputs_to_HDF5 to write ComplexF64 directly (no _real/_imag split), write all C_ matrices, applied vectors, and metadata; remove ctrl parameter (unused) - benchmarks/benchmark_fortran.jl: new script comparing Julia vs Fortran GPEC outputs using Fortran NC files; updated to read new h5 paths (rational_psi/rational_q for surface matching, resonant_flux as [n_rational] vector) - benchmarks/Project.toml: separate project for NCDatasets (benchmark-only dep) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
Author
|
Current status (bad disagreement to be fixed in the other branch) GPEC Fortran vs Julia Comparison — DIIID_ideal_example Scalar Parameters — excellent match: W_t Eigenvalue (least stable) — 0.7% difference (very good) q Profile RMS — 0.00% (essentially identical) Mercier Criterion — ~1.4% RMS mismatch (small) Resonant Surface Comparison — the coupling structure is now working (4 surfaces found, matching Fortran's 4 rational |
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
PerturbedEquilibriumState: Replaces zero-padded[npert, msing]arrays and legacycoupling_coefficient/resonant_amplitudefields with dense[n_rational × numpert_total]coupling matrices (C_resonant_flux,C_resonant_current,C_island_width_sq,C_penetrated_field,C_delta_prime) and applied resonant vectors[n_rational]= C · amp_vec. Adds surface metadata arrays (rational_psi,rational_q,rational_m_res,rational_n,rational_surface_idx). Matches Fortran GPEC'sC_f_x_out/Phi_resoutput structure.SingularCoupling: Rewritescompute_singular_coupling_metrics!to collect all resonant (surface, n) pairs, compute full coupling rows using the off-diagonalca_l/ca_rcolumn (jump_vec = ca_r[:,resnum,2,s] - ca_l[:,resnum,2,s]), precomputeL_surfonce per pair, and apply forcing viaR = C * amp_vec. Updatescompute_island_diagnostics!for the new[n_rational]vector structure.Utils: Rewriteswrite_outputs_to_HDF5to writeComplexF64directly (no_real/_imagsplits), write allC_matrices, applied vectors, and metadata. Removes unusedctrlparameter.benchmarks/benchmark_fortran.jl: New script comparing Julia vs Fortran GPEC outputs using Fortran NetCDF files; readsrational_psi/rational_qfor surface matching,resonant_fluxas[n_rational]vector.benchmarks/Project.toml: Separate benchmarks project forNCDatasets(benchmark-only dependency, not in mainProject.toml).Test plan
benchmark_fortran.jlagainstDIIID_ideal_exampleto confirm 4 resonant surfaces are found with matching ψ locations (--skip-runafter first run)gpec.h5structure:perturbed_equilibrium/singular_coupling/should containC_resonant_flux (4,34),resonant_flux (4,),rational_psi (4,), etc.🤖 Generated with Claude Code