Skip to content

Fix bug from #372 that made B_demag==0 where Msat==0#381

Merged
JonathanMaes merged 1 commit into3.11.2from
bugfix/demagvacuum
Mar 18, 2026
Merged

Fix bug from #372 that made B_demag==0 where Msat==0#381
JonathanMaes merged 1 commit into3.11.2from
bugfix/demagvacuum

Conversation

@JonathanMaes
Copy link
Copy Markdown
Contributor

As reported by @ac2290 on GitHub and the mailing list, PR #372 (included in mumax3.11.1) set B_demag to zero outside the geometry (where Msat==0), preventing users from obtaining stray fields.

Fix

The (inverse) zero-masking by Msat applied in the previous fix was moved from SetDemagField to SetLLTorque. This...

  • ... reverts the behaviour of the B_demag variable back to its pre-3.11.1 behaviour (see validation 2), i.e., it is once again nonzero outside the geometry.
  • ... still prevents demag from affecting the m vector where Msat==0 (see validation 3). Indeed, recall from Fix #357: Msat=0 affects exchange #372 that cells with Msat==0 should not experience a torque, since this makes relax() converge incredibly slowly.

Validation

  1. As expected, this fix does not change the results of test/msatzero.mx3.

  2. The behavior of the script in the aforementioned mailing list issue returns to how it was in mumax3.11.0 and earlier. Indeed, the top-down view of B_demag000050.ovf generated by this mailing list script in different mumax versions is as follows:

    ≤3.11.0 3.11.1 After this PR
    image image image
  3. The script of the original issue (Minor) change in exchange nonmagnetic boundary behavior from mumax3.9.3 to Mumax 3.10 #357 (where the right half of the system has Msat=0) yields the following relaxed m in different mumax versions:

    3.9.1 3.10 & 3.11.0 3.11.1 After this PR
    m000000 image image image

@JonathanMaes JonathanMaes requested a review from JLeliaert March 12, 2026 12:53
@JonathanMaes JonathanMaes added this to the 3.12 milestone Mar 12, 2026
@JonathanMaes JonathanMaes merged commit f682bf2 into 3.11.2 Mar 18, 2026
@JonathanMaes JonathanMaes deleted the bugfix/demagvacuum branch March 18, 2026 14:41
@JonathanMaes JonathanMaes mentioned this pull request Mar 18, 2026
4 tasks
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