File:Array of magnetic dipoles.gif

Summary

Description
English: The lowest energy configuration for two magnetic dipoles is to align head-to-tail. But if we put the magnetic dipoles in a square array the ground state is composed of cross-like structures known as "microvortices".
Date
Source https://twitter.com/j_bertolotti/status/1091360729914064897
Author Jacopo Bertolotti
Permission
(Reusing this file)
https://twitter.com/j_bertolotti/status/1030470604418428929

Mathematica 11.0 code

ClearAll["Global`*"]
\[Mu]0 = 1.;
dt = 0.1; (*time interval*)

B[pos_, m_] := \[Mu]0/(4 \[Pi]) (3 ( pos (m.pos))/Norm[pos]^5 - m/Norm[pos]^3);
mm = 1.; (*magnitue of the magnetic dipoles. Same for all of them*)

mI = 1; (*moment of inertia of each magnetic dipole. Same for all of them*)
ndip = 36; (*number of dipoles. As they are arranged on a square it MUST be a perfect square*)

ell = 1; (*distance between a dipole and its nearest neighbour*)

dipoles = 
  RandomReal[{0, 2 \[Pi]}, {ndip}] ;(*angle with respect to the vertical of each dipole*)
vd = Table[0, {ndip}];
positions = Flatten[Table[ell {i, j, 0}, {i, 1, Sqrt[ndip]}, {j, 1, Sqrt[ndip]}], 1];

nsteps = 3000;
evo = Reap[Do[
      torques = 
       Table[If[i == j, {0, 0, 0}, 
         Cross[mm {Cos[dipoles[[j]]], Sin[dipoles[[j]]], 0}, 
          B[positions[[j]] - positions[[i]], 
           mm {Cos[dipoles[[i]]], Sin[dipoles[[i]]], 0}] ] ], {i, 1, 
         ndip}, {j, 1, 
         ndip}]; (*torque generated by the ith dipole on the jth dipole (assuming I=1)*)
      
      ttorques = 
       Table[Sum[torques[[i, j]], {i, 1, ndip}], {j, 1, ndip}][[All, 
        3]];
      vdold = vd;
      vd = vdold + (ttorques - 0.03 vdold)/mI dt;
      dold = dipoles;
      dipoles = dipoles + vd dt;
      Sow[dipoles];
      , nsteps];][[2, 1]];

p1 = Table[Graphics[{Thick,
     Table[Disk[positions[[i]][[1 ;; 2]], 0.05], {i, 1, ndip}], 
     Table[Arrow[{positions[[i]][[1 ;; 2]] - 
         ell/3 {Cos[evo[[k, i]]], Sin[evo[[k, i]]]}, 
        positions[[i]][[1 ;; 2]] + 
         ell/3 {Cos[evo[[k, i]]], Sin[evo[[k, i]]]}}], {i, 1, ndip}]
     }, PlotRange -> {{0, ell (Sqrt[ndip] + 1)}, {0, 
       ell (Sqrt[ndip] + 1)}}, AspectRatio -> Automatic], {k, 1, 
    nsteps, 5}];
ListAnimate[p1]

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Array%20of%20magnetic%20dipoles.gif
Category:Self-published work
This file, which was originally posted to https://twitter.com/j_bertolotti/status/1030470604418428929, was reviewed on 5 February 2019 by reviewer Ronhjones, who confirmed that it was available there under the stated license on that date.
Category:Files from external sources with reviewed licenses#Array%20of%20magnetic%20dipoles.gif Category:Animations of magnetism Category:Dipoles Category:Images with Mathematica source code Category:Magnetic ordering Category:Animated GIF files Category:Animated GIF files between 50 MP and 100 MP
Category:Animated GIF files Category:Animated GIF files between 50 MP and 100 MP Category:Animations of magnetism Category:CC-Zero Category:Dipoles Category:Files from external sources with reviewed licenses Category:Images with Mathematica source code Category:Magnetic ordering Category:Self-published work