Use shared step sizes for all ferromagnets in minimzer (and clean-up) - #174
Use shared step sizes for all ferromagnets in minimzer (and clean-up)#174ilateur wants to merge 7 commits into
Conversation
|
Wow, that's pretty neat. I would've naively expected separate stepsizes to work better, so 'stiffer' magnets could advance separately. But I guess this better forces it as a global minimization problem? It looks like you're just summing the dmdm/dmdt terms for each magnet, as |
|
Hi @jplauzie!
I would also have expected that evolving each magnet separately would allow each magnet to minimize as quickly as possible, but it seems not to be the case for "tightly linked" systems such as altermagnets. I have only timed it and have not looked into the minimization path, so this is purely speculative, but perhaps evolving each sublattice with a different step can create oscillating states. Each sublattice could adjust mainly due to the strong coupling to the other, then take a different individual step and end up needing to adjust strongly again to the differently evolved sublattice. This could cause the system to ping-pong around the global minimum for a while (again, this is speculation). Of course, if two systems are completely uncoupled, their global minimum should be found fastest by minimizing each separately. Here, the ferromagnets coupled only via stray fields seem weakly coupled enough that evolving them individually is still faster. There must be some point in between where this switches.
I am indeed summing the numerator and denominator separately before calculating the step. This seemed like the natural expansion of That said, this minimum operation may be useful in light of #171 to merge magnetic and elastic step sizes, since the addition |
This PR has multiple small changes in the same couple of files. The biggest change is the shared step size. Most of my time was spent testing.
Shared step size
The original paper of Exl et al. uses one "uniform" scalar step size for all magnetizations in a ferromagnet. I wondered if it would be better to share the step size between different linked ferromagnetic instances as well. There are two possibilities:
For the first case, I tested the MFM example, which has 2 ferromagnets in a plane. The minimization time went from 7.224 s to 8.294 s or about 15% slower for the same final state.
I also tested the multilayer example, which has 4 ferromagnets in a plane. It now takes 4.098 s instead of 3.520 s, or about 20% slower, but the final state has a lower energy. (Any comment I made about instability before was a bug in my benchmarking script.)
Without shared step:


With shared step:
So in this particular case a shared step is better (even though it is slower).
For the sublattices I first tested the altermagnetic Bloch wall example. The final state is the same, but the minimization time went from 1.813 s to 0.2836 s or 85% less! I also tested an altermagnetic skyrmion, which went from 12.97 s to 2.62 s or 80% less time for the same final state.
This felt like enough evidence in favor of this change.
I also changed all default
nsamplesto 10 everywhere, but changed the convergence check as well. So instead of checking 2 sublattices a total of 20 times, it checks everything together 10 times.Clean-up and speed-up
I also fixed some typos and clarified some mysteries with comments. Most importantly, I borrowed some tricks from mumax3 to speed up the code slightly. All previous "before-times" were with this speed-up already in place.
m0andt0asdmanddt. This eliminates 2 field creations.add(dm, ...)instead ofdm = add(...). This eliminates 1 field creation.m1once.I tested these with standard problem 2, which minimizes a variety of system sizes. Unchanged is blue, the first 2 changes are orange and all changes together are green. I did not test the 'shared step' version here, but it should not perform meaningfully different here.
These changes make it up to 10% faster for small systems and about 1% faster for large systems. They do not alter the final state.