zk/cocos#10
Merged
Merged
Conversation
…parallel with the field lines
chandrarn
approved these changes
May 12, 2026
Collaborator
chandrarn
left a comment
There was a problem hiding this comment.
COCOS conversion looks good, branch confirmed to run with TARS. Branch does not yet integrate into my one-equilibrium-reconstruction ChiSq fit code due to a difference in how the sensor names are interpreted (my branch still uses the C-Mod sensor naming convention), but this issue can be resolved on my end, or in a later commit.
Code is confirmed to work with gEQDSK files on my end, and produces a reasonable synthetic Mirnov signal output for a synthetic 1/1 mode.
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.
Our goal is to deploy on several different devices, so we need to carefully handle all the different coordinate conventions used. I propose converting everything to COCOS 1 and use that internally. This PR does that like so:
Two helper functions
detect_cocosandconvert_cocos.Given an arbitrary eqdsk,
detect_cocoswill determine which COCOS is being used.Then,
convert_cocoswill use the proper sign mapping to convert the eqdsk into the target COCOSOn creation of
EquilibriumField, the eqdsk is automatically converted to COCOS 1Now during field line tracing we can always be confident we know the correct vector for the field lines based on the signs of B0 and Ip.
One lingering thing which we might want to address is our definition of 'helicity'. At the moment, we're saying helicity is synonymous with the sign of m/n, where positive values are parallel to the field lines and negative values are antiparallel. I'm not sure this is technically correct but we can simply rename this to be something else (like
mn_signor whatever), or we can revisit in the future.