Skip to content

Rnc/testing merge in from cocos#11

Open
chandrarn wants to merge 24 commits into
mainfrom
rnc/Testing_Merge_In_From_COCOS
Open

Rnc/testing merge in from cocos#11
chandrarn wants to merge 24 commits into
mainfrom
rnc/Testing_Merge_In_From_COCOS

Conversation

@chandrarn
Copy link
Copy Markdown
Collaborator

@chandrarn chandrarn commented May 15, 2026

  • Physics changes:

    • added synthwave/magnetic_geometry/filaments._solve_root_with_adaptive_bracket() to catch edge cases better than the Newton solver for R_maj, a_min vs eta. The goal here is to better handle $m/n \approx 1$ and $m/n>>1$ cases. The adaptive bracket uses 'scipy.optimize.root_scalar' for scalar optimization with bounds of [self.eq_field.eqdsk.rbdry.max() - self.eq_field.eqdsk.rmagx + 0.2]. It falls back on the Newton method via root_scalar if the minimized value cannot be found.
  • Pytest changes:

    • synthwave/tests/test_equilibrium_field.py skips machine-specific individual tests for cases where the respective gEQDSK file is not found.
    • synthwave/tests/test_thincurr.py modified to change the interpretation of eta as a per-filament resistivity to a per-conducting structure mesh group resistivity. The former interpretation was incorrect, but did not break the code. However, the current dev branch update of OFT removes this leniency: the number of conducting structure "groups" in the .h5 file now must exactly match the number of eta values. Previously, although the interpretation of eta was incorrect, ThinCurr just grabbed the n eta values it needed, disregarding the rest. The correct does not introducing breaking changes for the older OFT copy: there is now the correct number of eta values, just not more than that.

Note: uv.lock and pyproject.toml are not included in this PR, so as to not mess with the existing handling of the OFT import. I will keep my versions changed independently on my branch (the .whl import strategy)

chandrarn and others added 17 commits February 17, 2026 19:22
…ality we only need one helicity value in the end, and it should be pulled from Sgn[Ip, B_t].
… gracefully and consistently with helicity wrapping direction. Issue likely arrises from COCOS reasons
…solute value of m/n is probably constant due to fixed helicity, the sign of both can change together, to account for rotation direction. This appears to fix the issue on shot 1120906030. Interestingly, it still predicts negative rotation for mode-conversion flow shot 1110316031
…nor value during filament tracking: limits now use r_magx and r_bdry.max from gEQDSK file
…o close to outer boundary b, move the boundary backwards
Testing merge from COCOS updates/Zander's branch into my branch. My
branch includes updates for detecting R_m, a_m of target rational
surface as eta evolves. New branch changes helicity interpretations and
probe naming conventions. Naming convention changes accepted for now.
…ed on a per-filament basis, instead of a per-mesh basis: breaking changes in the current OFT branch now no longer allow the number of resistivity values to be inequal (including, now, more than) the number of conducting structure groups. Updated test_equilibrium_field.py to skip TVC, DIII-D, as well as C-Mod tests if their respective gEQDSK files are missing
…ed on a per-filament basis, instead of a per-mesh basis: breaking changes in the current OFT branch now no longer allow the number of resistivity values to be inequal (including, now, more than) the number of conducting structure groups. Updated test_equilibrium_field.py to skip TVC, DIII-D, as well as C-Mod tests if their respective gEQDSK files are missing

ammending change: removing uv.lock and pyproject.toml from commit due to
breaking changes in the way that we handle importing OFT
…/SynthWave into rnc/Testing_Merge_In_From_COCOS

Prepping for PR
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates filament root solving for equilibrium tracing and adjusts tests for missing machine-specific data and ThinCurr eta semantics.

Changes:

  • Adds an adaptive root-solving helper in filament tracing.
  • Skips EQDSK-dependent tests when required files are missing.
  • Updates a ThinCurr test to pass a single resistivity value for the conducting structure group.

Reviewed changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 10 comments.

File Description
synthwave/magnetic_geometry/filaments.py Adds adaptive root solving and updates equilibrium tracing root calls.
synthwave/tests/test_equilibrium_field.py Centralizes EQDSK paths and skips C-Mod/DIII-D tests when files are unavailable.
synthwave/tests/test_filaments.py Skips C-Mod-dependent filament tests when the EQDSK file is unavailable.
synthwave/tests/test_thincurr.py Updates ThinCurr eta input in the direct/frequency response comparison test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread synthwave/magnetic_geometry/filaments.py
Comment thread synthwave/magnetic_geometry/filaments.py Outdated
Comment thread synthwave/magnetic_geometry/filaments.py Outdated
Comment thread synthwave/magnetic_geometry/filaments.py Outdated
Comment thread synthwave/magnetic_geometry/filaments.py
Comment thread synthwave/magnetic_geometry/filaments.py Outdated
Comment thread synthwave/magnetic_geometry/filaments.py
Comment thread synthwave/tests/test_filaments.py
Comment thread synthwave/magnetic_geometry/filaments.py Outdated
Comment thread synthwave/magnetic_geometry/filaments.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
chandrarn and others added 2 commits May 15, 2026 11:25
Acceptable fix

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator Author

@chandrarn chandrarn left a comment

Choose a reason for hiding this comment

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

review of copilot suggestions complete

chandrarn added 2 commits May 15, 2026 11:59
…ity sign, and thus wouldn't change direction under the parallel or antiparallel transformation
…ity sign, and thus wouldn't change direction under the parallel or antiparallel transformation
Comment thread g1120906030_1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this here? If it's a g file used in tests it should be moved to tests/input_data
However, I don't see it being referenced anywhere.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I do not see this file being referenced anywhere. Is it necessary?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

20 MB file that isn't part of this repo should not be getting tracked in git history.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

New method looks ok to me, but I'd like to see a test that demonstrates it actually has improved convergence. Do you have an instance where the previous method failed and this one works?

)

# Test one frequency
# Disable HODLR compression to improve convergence
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is HODLR compression on by default?
Also only the comment changed in this file, are we really doing anything differently now?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants