Skip to content

Add comprehensive sign conventions reference documentation - #253

Closed
krystophny wants to merge 1 commit into
PrincetonUniversity:developfrom
itpplasma:sign-conventions-docs
Closed

Add comprehensive sign conventions reference documentation#253
krystophny wants to merge 1 commit into
PrincetonUniversity:developfrom
itpplasma:sign-conventions-docs

Conversation

@krystophny

Copy link
Copy Markdown
Collaborator

Summary

  • New docs/sign_conventions.rst documenting all sign conventions in one place
  • Cross-reference from docs/outputs.rst to the new page
  • Added to docs/site.rst toctree
  • Summary in CLAUDE.md for AI-assisted development

What is documented

  • Coordinate system (psi, theta, zeta/phi) definitions and normalization
  • Helicity and handedness (ip_direction, bt_direction, helicity = +/-1)
  • F = R*Bt forced positive, q NOT forced positive
  • Why positive m is always resonant (nn > 0 and q > 0 by convention)
  • Spectrum output sign conventions (real-space, SURFMN, VACUUM interfaces)
  • Rotation velocity conventions in PENTRC (omega_E, diamagnetic frequencies, total rotation)
  • COCOS compatibility note (GPEC does not use COCOS)
  • Quick reference table and source code line references

Motivation

These conventions are currently scattered across docs/outputs.rst, dcon/README,
inline code comments, and tribal knowledge. Having a single authoritative reference
reduces user confusion, especially around rotation sign conventions and the
positive-m resonance design choice.

Test plan

  • Build Sphinx docs (cd docs && make html) and verify no RST warnings
  • Verify cross-references resolve correctly
  • Review for physics accuracy

Documents all sign conventions in one place: coordinate system,
helicity, F and q handling, mode number resonance (why positive m
is always resonant), spectrum output flips, rotation velocity
(omega_E), diamagnetic frequencies, and COCOS compatibility note.
@krystophny

Copy link
Copy Markdown
Collaborator Author

@logan-nc I let Claude deep-dive into sign conventions. Could you have a look if this is accurate some time and let me know what is wrong?

@logan-nc

Copy link
Copy Markdown
Contributor

Awsome @krystophny!
@matt-pharr and @ebursch have often struggled with sign and normalization conventions in the code and would be best to review this I think.

Note that we have a new Julia version of GPEC @ https://github.com/OpenFUSIONToolkit/GPEC with documentation at https://openfusiontoolkit.github.io/GPEC/dev/. My hope is that we rewrite things with more consistent / clear conventions - but it would be great to add explicit documentation like this there as well.

@krystophny

krystophny commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator Author

Awsome @krystophny! @matt-pharr and @ebursch have often struggled with sign and normalization conventions in the code and would be best to review this I think.

Note that we have a new Julia version of GPEC @ https://github.com/OpenFUSIONToolkit/GPEC with documentation at https://openfusiontoolkit.github.io/GPEC/dev/. My hope is that we rewrite things with more consistent / clear conventions - but it would be great to add explicit documentation like this there as well.

Thanks for the fast reply, @logan-nc . Good to hear that there is a modernized version. Don't forget that we are working on Julia level of user friendliness in Fortran e.g. on https://github.com/lfortran/lfortran and https://github.com/lazy-fortran/fortplot ;)

@krystophny
krystophny marked this pull request as ready for review April 16, 2026 14:12
@matt-pharr

Copy link
Copy Markdown
Collaborator

Rebasing this onto a native branch so I can push a tweak to it, will reopen a new PR. Thanks for the contribution

@matt-pharr matt-pharr closed this Jun 8, 2026
@matt-pharr matt-pharr mentioned this pull request Jun 8, 2026
@logan-nc

Copy link
Copy Markdown
Contributor

@krystophny and @matt-pharr I think there may have been and oversight in the q and cocos claims. This claims q is simply read in, but in reality it is calculated from the field line integrations of the Equilibrium module. I don't think I have ever never seen a negative q in GPEC, so believe it is always positive (this documentation says it can be either sign). Since resonant m are always positive, q must be positive.

Note also that users have reported g-files need to be in COCOS=2. I am no expert, but am surprised to see the convention here has somehow escaped all COCOS numbering... are you sure it isn't 2? I admit I didn't have time to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants