DCON - NEW FEATURE - Adds kinetic damping matrix infrastructure#113
DCON - NEW FEATURE - Adds kinetic damping matrix infrastructure#113
Conversation
Implements the Julia equivalent of Fortran's fourfit_kinetic_matrix (method 0) to enable kinetic damping effects in DCON stability analysis. Changes: - Added KineticParams struct with minimal parameter (nl) - Extended FourFitVars with 14 kinetic matrix spline fields - Created Kinetic.jl with placeholder compute_tpsi_matrices function - Implemented make_kinetic_matrix function in Fourfit.jl (~240 lines) - Integrated workflow in Main.jl to call when kin_flag=true - Added kinetic branch in sing_der! for future ODE implementation Key design principles: - Idiomatic Julia: no global variables, clean parameter passing - Uses LU factorization for non-Hermitian kinetic A matrix - Placeholder tpsi returns zeros for infrastructure testing - Throws informative error at ODE integration (prevents silent bugs) Future work deferred to separate PRs: - Real PENTRC interface for compute_tpsi_matrices - Kinetic ODE equations in sing_der! - Kinetic metric tensor (fmodb) - Kinetic singular surface crossings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
@mfairborn23 here is claude code's attempt to implement the conversion of the dcon kinetic damping terms we discussed. I told it to include params it needed in a new KineticParams struct and a new table in the dcon.toml but not to convert over all the pentrc params quite yet because I thought it would be overly distracting. The idea is to use a dummy function that returns dummy Feel free to work off of this or on your own separate branch! I am just flexing my new pro claude account to see what it can do. If this is no good, let me know so I can continue to improve my ai prompting to be more helpful next time around |
|
@mfairborn23 if this is good enough to work off of, |
|
@logan-nc thanks for this! This looks like a great start and I would love to work on this further. |
…ction to fourfit.jl and sing.jl. Also added TODOs and notes on what still needs to be changed. Also tried running the pre-commit
…etic_damping_in_force_free_states to keep this branch up to date
…st sing_der and it's dependencies left
… going particularly well, both the AIs I was working with are doing it in the oddest way, so I will restart this from scratch shortly. The sing_der in here works but only has ideal implemented. Also added the full sing_der unit test so we can ensure it continues to work for the ideal case after the kinetic modifications
|
@mfairborn23 have you gotten the code to work without using any modified The joy of the kinetic damping is that it removes the singularities. When a user sets We did all the singular surface identifications and crossings and everything because we could and that brings things in line with ideal DCON and it is necessary when kinetic effects are really small. Here,
It might be good to chat with @jhalpern30 about the general structure of how we integrate in JPEC to identify the path of least resistance towards getting some initial results. I think you should basically just need to make the fourfit matrix modifications and then tell the This is not to say that all your hard work on |
…s_ideal (may not be quite right yet but passes preliminary unit tests) and began converting ode_axis_init
…have extremely basic unit tests too
…c matrices. Also very minor unit tests were added and tested a crude implementation of an f vs psi plot
…unctionality to our fourfit.jl and forgot to delete it
…f sing_der has been added. Also, added a kinetic DIII-D like example to run. Seems to make it fairly far through the run and run into expected integration issues taking too small of steps.
…uld be able to use a sigma*I (identity matrix) ad hoc kwmats and ktmats, but it still needs to be tested more fully. Need to switch branches to run the ideal example and make sure the one here is still behaving properly
…nd so far adjusting sigma on the sigma*I matrices doesn't seem to be doing much to the least stable eigenmodes (the plots all look the same) so I will be investigating this further.

Implements the Julia equivalent of Fortran's fourfit_kinetic_matrix (method 0) to enable kinetic damping effects in DCON stability analysis.
Changes:
Key design principles:
Future work deferred to separate PRs:
🤖 Generated with Claude Code