Skip to content

Fix fast-ion density folding when modify_electron_density=true - #325

Merged
tomneiser merged 2 commits into
masterfrom
fix/fast-ion-qn-ratchet
Nov 15, 2026
Merged

tomneiser merged 2 commits into
masterfrom
fix/fast-ion-qn-ratchet

Conversation

@nanshi1177

Copy link
Copy Markdown
Contributor

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.

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.
@nanshi1177
nanshi1177 requested a review from jmcclena November 11, 2026 23:50
…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 tomneiser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch, thanks @nanshi1177!

@tomneiser
tomneiser merged commit daa4093 into master Nov 15, 2026
2 checks passed
@tomneiser
tomneiser deleted the fix/fast-ion-qn-ratchet branch November 15, 2026 11:27
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.

2 participants