Fix bug in zero_fields_near_cylorigin for |m| >= 2#3164
Open
oskooi wants to merge 3 commits intoNanoComp:masterfrom
Open
Fix bug in zero_fields_near_cylorigin for |m| >= 2#3164oskooi wants to merge 3 commits intoNanoComp:masterfrom
zero_fields_near_cylorigin for |m| >= 2#3164oskooi wants to merge 3 commits intoNanoComp:masterfrom
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3164 +/- ##
==========================================
+ Coverage 73.81% 73.90% +0.09%
==========================================
Files 18 18
Lines 5423 5454 +31
==========================================
+ Hits 4003 4031 +28
- Misses 1420 1423 +3 🚀 New features to boost your workflow:
|
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.
Fixes #2644.
Root cause: The
zero_fields_near_cyloriginstability mechanism instep_db.cpp(lines 397-456) is incomplete for |m| >= 2. It only zeros field components on integer-r grid points (Dp, Dz for D_stuff; Br for B_stuff) but not the half-integer-r components (Dr for D_stuff; Bp, Bz for B_stuff).When an Er source extends to r=0, it injects current into Dr at the half-integer-r grid points near the origin (r = 0.02, 0.06 for resolution 25). Because Dr was not being zeroed, the nonzero Dr/Er at small r feeds into the Bz curl update via the im/r × Er term, which amplifies by ~100× at r=0.02 for m=2. This Bz then drives Hz, which feeds back into Dr via the im/r × Hz term — creating an exponentially growing feedback loop.
When
offset = 0.15(in the test script), the source region starts at r=0.075, placing no source current at the first two Er grid points (r=0.02, 0.06) that fall within the zeroing range, so the instability doesn't trigger.Fix (
src/step_db.cpp): Extended the field-zeroing to include all six D/B components near the cylindrical origin for |m| >= 2:This breaks the feedback loop by ensuring Bz is zeroed near r=0, so Hz remains zero and the im/r amplification never feeds back into Dr.