Unfreeze densities and replay ion density instead of density_thermal#1057
Merged
Unfreeze densities and replay ion density instead of density_thermal#1057
Conversation
- Uses SimpleDFSane if gradient based methods don't converge - GKNN uses basic_polyalg by default
This allows the density to stay constant if `density_fast` changes
Collaborator
Author
|
Companion to ProjectTorreyPines/IMAS.jl#292 |
Contributor
Collaborator
Author
|
@nanshi1177 What shot and mode is this? |
3 tasks
8e122e1 to
e2d91da
Compare
…files CER and Thomson scattering are independent diagnostics that can be inconsistent at the edge, causing n_imp * Z_imp > ne at some radial points. This made enforce_quasi_neutrality!(:D) error on the new unfreeze_density branch which no longer silently allows negative density. Clip each impurity's density against the remaining electron budget after accounting for all other impurities, ensuring n_D >= 0 after QN enforcement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When using Jacobian-based algorithms (e.g. basic_polyalg, broyden, trust region), a SingularException can occur if the Jacobian becomes degenerate due to density state changes in the unfreeze_density branch. Catch any such exception and fall back to SimpleDFSane which is derivative-free and never inverts the Jacobian. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e48ce8a to
e8ddbbd
Compare
- Unfreeze density_thermal after blending ion.density so expression recomputes correctly as density - density_fast - Clamp density_fast to not exceed total density after blending - Freeze density_thermal to store the computed value - Remove scale_ion_densities_to_target_zeff! call which conflicts with replay density handling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Start time set by init! - Reduce time step
This was referenced Mar 3, 2026
This reverts commit a114584.
Collaborator
Author
|
@nanshi1177 @jmcclena @tomneiser @TimSlendebroek Green/red means better/worse than
|
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.




Summary
IMAS.unfreeze!calls throughout actors (fits, pedestal, core transport, EPED profiles, flux matcher) after modifyingdensity_thermal, so that thedensityexpression stays correctdensityinstead ofdensity_thermalin replay actors (core transport, flux matcher, pedestal), so that total density remains constant whendensity_fastchangesSimpleDFSaneas a fallback in the flux matcherbasic_polyalgand default GKNN to usebasic_polyalgTest plan
🤖 Generated with Claude Code