Repository navigation
Conversation
…R#15-16: Replaces PR#11: swaps out OFT loading scheme entirely (for the new, more pythonic virtualenvironment install from PyPi), scales the individual filament currents such that the effective poloidal surface current density is normalized [1 A/m], adds an option to the filament tracer to just directly solve the magnetic field ODE, adds an option to bound the root-solver for psi(q), which slightly fixes some edge cases from DIII-D where the x-point confused the algorithm. OFT swap is validated to work in pytest, as is the new Field tracing option (see test_field_trace_matches_average_endpoint)
…, DIII-D gEQDSK no longer ships with OFT
…tween the raw interpolation for psi(q) and the Newton or bounded root-solver method
| "eqdsk_d3d", | ||
| marks=pytest.mark.skipif( | ||
| condition=not os.path.exists(D3D_EQDSK_FILE), | ||
| reason="Test requires DIII-D data which is not open source", |
There was a problem hiding this comment.
This file is open-source. In install.sh just have it get downloaded from here: https://github.com/OpenFUSIONToolkit/OpenFUSIONToolkit/blob/v26.9/src/examples/TokaMaker/DIIID/g192185.02440
Put it in a place like synthwave/tests/test_data so that we always know where it is.
There was a problem hiding this comment.
Are any of these diagnostic scripts necessary? They seem like things used during the development process but should not live in the repo itself.
| CLAUDE.md | ||
|
|
||
| # Install | ||
| submodules/OpenFUSIONToolkit |
There was a problem hiding this comment.
I think it'd be safe to leave this in, or perhaps ignore all submodules going forward.
| sed -i "s|^LD_LIBRARY_PATH=|LD_LIBRARY_PATH=${HDF5_LIB_PATH}:|" "${SCRIPT_DIR}/.env" | ||
| fi | ||
|
|
||
| # Create setup_env.sh |
There was a problem hiding this comment.
Now that we are using PyPI for OFT, we should be able to completely remove setup_env.sh.
| return np.array([Br, Bt, Bz]) | ||
|
|
||
| def get_psi_of_q(self, q): | ||
| def get_psi_of_q_old(self, q): |
There was a problem hiding this comment.
This method is no longer called anywhere. If we're replacing it, remove it.
| sign_Bp = int(psi_increasing * sign_Ip) | ||
|
|
||
| def _e_Bp(eqdsk): | ||
| def _e_Bp_new(eqdsk): |
| from synthwave.magnetic_geometry.utils import cylindrical_to_cartesian | ||
|
|
||
|
|
||
| def _average_phi0_poloidal_arc_spacing( |
There was a problem hiding this comment.
Maybe I don't fully understand what you're doing here, but is the average poloidal arc spacing not just
total_arc * n_local / (num_filaments * m_local)?
| psi_norm_1d, | ||
| np.asarray(eqdsk.ffprime, float), | ||
| ) | ||
| # RHS from the stored profiles, mapped over the raw physical psi grid. |
There was a problem hiding this comment.
Could you please send me the DIII-D eqdsk where this differs? I'm finding the result is bit-identical for the included g192185.02440, as well as some C-Mod and TCV shots.
|
Left some comments, we should chat briefly Monday/Tuesday. |
|
|
||
| # Bound possible psi values around initial guess from psi grid | ||
| psi_lo = ( | ||
| self.psi_grid[psi_guess_index - 5] |
There was a problem hiding this comment.
Why 5 and 10 in particular? Could these be made constants defined at the top with some descriptive names?
Key changes building on Filament vectorization and tracing harmoics PR #15 - #16: Replaces PR #11
e_Bpfor COCOS is calculated (this will also be migrated intodispy-extraOFT swap is validated to work in pytest (
test_thincurr.py), as is the new Field tracing option (seetest_field_trace_matches_average_endpointwithintest_filaments.py)Note: OFT no longer ships with the example DIII-D gEQDSK file at
OpenFUSIONToolkit/examples/TokaMaker/DIIID/g192185.02440, this impacts pytest options.Note that the pytests in
test_flux_matrix.pyneeded to be updated to handle assertions of current as normalized density not normalized amplitude.All
pytestscripts pass.Minor fix for

e_Bp, produces more stable outcomes.Bounding root-solver for psi(q) fixes some edge cases with high m/n on DIII-D
