Skip to content

Citations#155

Merged
jhalpern30 merged 4 commits intodevelopfrom
citations
Feb 13, 2026
Merged

Citations#155
jhalpern30 merged 4 commits intodevelopfrom
citations

Conversation

@logan-nc
Copy link
Collaborator

This branch adds more specific citations.
I let Claude read the foundational papers and put specific citations where possible.
It didn't find too many, which is good - didn't go crazy making things up.
I also standardized the citation style, which cleans up the various Chance references we already had there.

logan-nc and others added 2 commits February 12, 2026 21:55
…mat across all modules

Add standardized paper citations throughout the codebase using the format:
[Lead Author Last Name, Journal, Year Page]

Changes:
- Vacuum module: Add citations to Chance 1997 and 2007 papers for equations
  and algorithms in Kernel2D.jl, Vacuum.jl, VacuumFromEquilibrium.jl
- ForceFreeStates module: Standardize Glasser 2016 citations in EulerLagrange.jl,
  Free.jl, Mercier.jl, Fourfit.jl, and Sing.jl
- PerturbedEquilibrium module: Add Park et al. citations (2007-2009) to
  ResponseMatrices.jl, SingularCoupling.jl, and FieldReconstruction.jl

This improves traceability between theory papers and implementation, making it
easier for users to understand the mathematical foundation of the algorithms.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…s throughout Vacuum, ForceFreeStates, and PerturbedEquilibrium modules

Enhance code documentation with specific equation and section references from key papers:

Vacuum module (Kernel2D.jl):
- Add eq. 36-38, 41-42, 44, 51, 73, 76 citations for Green's function derivatives,
  Legendre parameters, Simpson integration, and Lagrange polynomials
- Improve comments on coordinate transformations and coupling terms
- Clarify physical interpretation of each computation step

ForceFreeStates module:
- Fourfit.jl: Add eq. 29, A5-A7 citations for nonsingular matrix forms and
  Schur complement reduction from [Glasser Phys. Plasmas 2016 112506 Appendix A]
- Sing.jl: Add eq. 24 citation for Euler-Lagrange equation derivative du/dψ

PerturbedEquilibrium module:
- ResponseMatrices.jl: Add eq. 4 citations from [Park Phys. Plasmas 2009 056115]
  for normal magnetic field computation and singular factor definition
- Add Section II citation from [Park Phys. Plasmas 2007 052110] for physical
  interpretation of displacement-to-field conversion
- FieldReconstruction.jl: Add eq. 8-10 citations from [Park Phys. Plasmas 2007 052110]
  for ideal MHD relations computing contravariant field components (b^ψ, b^θ, b^ζ)

These additions make it much easier to trace implementation back to theoretical
foundations and verify correctness of numerical algorithms.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@logan-nc logan-nc requested a review from jhalpern30 February 13, 2026 03:12
@logan-nc logan-nc added the documentation Improvements or additions to documentation label Feb 13, 2026
Copy link
Collaborator

@jhalpern30 jhalpern30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Note I also added full deprecation of is_closed_toroidal since this PR referenced some equations specific to that and it was removed from the WallGeometry struct so I think it only partially implemented anyway

@claude
Copy link

claude bot commented Feb 13, 2026

Code Review - PR #155: Citations

This PR standardizes citation format and adds specific equation references throughout the codebase. The changes improve traceability between theory and implementation.

Positive Aspects

  1. Citation standardization: The new format [Chance Phys. Plasmas 1997 2161] is clear and consistent across all modules.

  2. Specific equation references: Adding equation numbers (e.g., eq. 78, eq. A5-A7) will be useful for developers cross-referencing the papers.

  3. Expanded physical interpretation: The additions in ResponseMatrices.jl:102-106 and FieldReconstruction.jl:201-210 clarify the physics behind the equations.

  4. Code cleanup: Removing the unused is_closed_toroidal branching logic in Kernel2D.jl:209-216 simplifies the code since only the closed toroidal case is currently supported.

Issues Found

1. Type annotation removal in Vacuum.jl:343 (Minor)

-    xzpts = zeros(Float64, inputs.mtheta, 4)
+    xzpts = zeros(inputs.mtheta, 4)

The explicit Float64 type annotation was removed. While Julia's type inference will likely produce the same result, the explicit annotation documents the intended type and could prevent subtle issues if inputs.mtheta changes type in the future. Consider keeping the explicit type.

2. Incomplete citation in VacuumFromEquilibrium.jl:38-41 (Minor documentation)

The reference section was reformatted but the actual content "Matches GPEC's ahg_write..." appears disconnected from the [Chance Phys. Plasmas 1997 2161] citation. The docstring should clarify which aspect relates to Chance 1997.

3. Potential behavior change with is_closed_toroidal removal (Needs verification)

In Vacuum.jl:310, the condition changed from:

(n == 0 && !wall.nowall && wall.is_closed_toroidal)

to:

(n == 0 && !wall.nowall)

This removes the wall.is_closed_toroidal check. While the PR body states that simplification is appropriate, this changes when the n=0 regularization is applied. Verify that:

  • The wall.is_closed_toroidal field always equals true in the current codebase
  • Or confirm that the regularization should apply regardless of topology

4. Inconsistent citation detail (Minor)

Some citations include specific sections (e.g., Section VI in EulerLagrange.jl:141) while others only include equation numbers. Consider whether section references should be standardized or removed for consistency.

Recommendations

  1. Keep the explicit Float64 type annotation in Vacuum.jl:343
  2. Clarify the reference in VacuumFromEquilibrium.jl:38-41
  3. Document the is_closed_toroidal removal in the commit message or add a comment explaining why the check was removed
  4. Consider standardizing whether to include section numbers in citations

Test Coverage

The PR should pass existing tests since it's primarily documentation changes. However, the is_closed_toroidal removal in Kernel2D.jl and Vacuum.jl involves logic changes that should be verified against the vacuum response tests.


Overall, this PR improves code documentation and will be useful for developers working with the theoretical foundations. The citation format is clear and the equation references are valuable additions.

@jhalpern30 jhalpern30 merged commit 490f2d8 into develop Feb 13, 2026
1 of 2 checks passed
@jhalpern30 jhalpern30 deleted the citations branch February 13, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants