Repository navigation
Fix fast-ion density folding when modify_electron_density=true - #325
Merged
Merged
Conversation
fast_particles_profiles! folded the previous density_fast into density_thermal on every call and never undid it, so thermal ion densities (and n_e via quasi-neutrality) grew with each call. Now the thermal density of source-fed ions is restored before quasi-neutrality is enforced; unfed ions keep the old behavior.
…ectron_density=true The limit was taken from a thermal density that still held the fast ions of the previous call, so with a source strong enough to reach the cap the fast-ion density rose from call to call (to about twice the intended limit). Test: repeated calls leave the thermal ions alone, respect the cap and settle. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tomneiser
approved these changes
Nov 15, 2026
tomneiser
left a comment
Member
There was a problem hiding this comment.
Nice catch, thanks @nanshi1177!
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.
fast_particles_profiles! folded the previous density_fast into density_thermal on every call and never undid it, so thermal ion densities (and n_e via quasi-neutrality) grew with each call. Now the thermal density of source-fed ions is restored before quasi-neutrality is enforced; unfed ions keep the old behavior.