Fix #357: Msat=0 affects exchange#372
Merged
JonathanMaes merged 6 commits into3.11.1from Jun 17, 2025
Merged
Conversation
JLeliaert
approved these changes
Jun 17, 2025
Closed
|
Hi in mumax3.11. I cannot get the output of the stray field from a nanomagnet at a certain distance away from the nanomagnet. it is showing always zero |
JonathanMaes
added a commit
that referenced
this pull request
Mar 18, 2026
Fix bug from #372 that made B_demag==0 where Msat==0
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.
This PR fixes issue #357, where cells with
Msat=0were reported to affect other cells through the exchange interaction.Background
As correctly identified by @jplauzie, this bug appeared in mumax3.10 as part of PR #115 (6303d01), which addressed an "increasing-energy" problem related to Eq. (9) of the mumax³ paper. Note that, since 3.10, Eq. (9) in the paper is no longer the actually implemented equation. Originally, it was
but this was changed in PR #115 to
In other words, since then, the exchange interaction of a spin with its neighbours has no longer been scaled by the
Msatof each neighbour separately, but only byMsatof the spin itself.Edge case for
Msat=0While PR #115 solved the "increasing-energy" problem, it also caused magnets with nonzero
Msatto be affected by neighbouringMsat=0cells. This edge case was the underlying reason for issue #358 and has now been fixed.On a related note, but unrelated to PR #115: magnets with
Msat=0were affected by the demag field generated by other cells. Since this is a rather weak interaction compared to exchange, functions likerelax()were very slow if regions withMsat=0were present. Hence, from now on, magnets withMsat=0are no longer affected by demag fields.