Add cross-collisions diagnostics to the GK LBO app - #1013
Closed
Maxwell-Rosen wants to merge 9 commits into
Closed
Conversation
…using ion-electron collisions in 2x
…ove unused mirror failure file
Maxwell-Rosen
requested review from
Antoinehoff,
JunoRavin,
manauref and
tnbernard
May 13, 2026 14:30
manauref
requested changes
May 14, 2026
…write_diagnostics
…This took me hours to debug and claude found it in 30 seconds, but I wouldn't have been able to focus claude in the right areas without the debugging.
Collaborator
Author
|
Continued in #1076 |
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.
Feature
This PR is nearly 100% Claude, but it's not AI slop. I verify that this implementation is how I would do it, also.
Summary
Purpose: My mirror simulations are exposing an issue with the implementation of cross-species collisions. The moments can go negative if$m_i \gg m_e$ , $T_e \ll T_i$ , $u_{\parallel,i} \ll u_{\parallel,e}$ . This is just in the mathematics of how these cross-moments are computed. By outputting detailed cross-species collision diagnostics, we can effectively diagnose such issues.
Implementation Details
Key changes: gk_species_lbo.c is expanded to include a new diagnostic for the cross-species collisions. Since these diagnostics are on intermediate quantities, they must be re-computed, so I refactored the update function as well.
I decided to reuse some memory from the prim_moms_ho and nu_sum_ho to save some memory and avoid additional allocations.
I could see someone arguing that this should just be under the
write_diagnosticsflag and not a separate flag. It's good to keep this modular.Automated testing: Existing tests
Example Use
Community Standards
layer/zeroshould have a unit test, e.g.,core/zero.Testing:
make checkand unit tests all pass.Additional Notes