File:Ferromagnet hysteresis.webm

Summary

Description
English: n a ferromagnet the equilibrium configuration is with all magnetic moments aligned with each other. If we want to flip them, we need to flip all of them at the same time, which requires a stronger field than if the moments were independent.
Date
Source https://twitter.com/j_bertolotti/status/1671865946632253446
Author Jacopo Bertolotti
Permission
(Reusing this file)
https://twitter.com/j_bertolotti/status/1030470604418428929

Mathematica 13.1 code

\[Gamma] = 1; \[Lambda] = 0.1; dt = 0.05; J = 0.2;
steps = 6000;
nx = 11; ny = 11; n = nx*ny;
adjacency = Normal@AdjacencyMatrix[TorusGraph[{nx, ny}] ];
M0 = (#/Norm[#] &) /@ 
   Table[{RandomReal[{-0.1, 0.1}], RandomReal[{-0.1, 0.1}], 1}, {n}];
M = M0;(* M[[Floor[nx/2]*ny+Floor[ny/2] +1]]={1,1,0};*)
Hext[j_] := 2 {0, 0, (1 - 2 j/steps)};
evo = Reap[For[j = 1, j <= steps, j++,
     M = (#/Norm[#] &) /@ M;
     
     Heff = J*adjacency . M + Threaded[Hext[j] ]; (****)
     M = 
      Table[M[[j]] + 
         dt*(-\[Gamma] Cross[M[[j]], Heff[[j]] ] - \[Lambda] Cross[
              M[[j]], Cross[M[[j]], Heff[[j]] ]]), {j, 1, 
         n}] + (RandomReal[{-0.01, 0.01}, {n, 3}]);
     M = (#/Norm[#] &) /@ M;
     Sow[M];
     ]][[2, 1]];
Hext2[j_] := 2 {0, 0, (-1 + 2 j/steps)}(*8{0,0,(1-2j/steps)}*);
evo2 = Reap[For[j = 1, j <= steps, j++,
     M = (#/Norm[#] &) /@ M;
     
     Heff = J*adjacency . M + Threaded[Hext2[j] ]; (****)
     M = 
      Table[M[[j]] + 
         dt*(-\[Gamma] Cross[M[[j]], Heff[[j]] ] - \[Lambda] Cross[
              M[[j]], Cross[M[[j]], Heff[[j]] ]]), {j, 1, 
         n}] + (RandomReal[{-0.01, 0.01}, {n, 3}]);
     M = (#/Norm[#] &) /@ M;
     Sow[M];
     ]][[2, 1]];
frames1 = Table[
   Grid[{{Graphics3D[{
        Black,
        Table[
         Sphere[{Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 0}, 
          0.08], {j, 1, n}],
        Table[
         Sphere[{Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
            0} + \[Alpha]*evo[[k, j]], 0.05], {j, 1, n}],
        Thick, 
        Flatten@Table[
          Line[{{Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
             0}, {Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
              0} + \[Alpha]*evo[[k, j]]} ], {j, 1, n}],
        Sphere[{-1.5, Sqrt[n]/2, 0}, 0.1], Arrowheads[.025], 
        Arrow[{{-1.5, Sqrt[n]/2, 0}, {-1.5, Sqrt[n]/2, 
           Hext[k][[3]]}}], 
        Text[Style["\!\(\*SubscriptBox[\(H\), \(ext\)]\)", Black, 
          Bold, FontSize -> 20], {-1.5, Sqrt[n]/2 + 1.5, 0}],
        Red,
        Table[
         Line[({Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
               0} + # &) /@ (\[Alpha]*
             evo[[Max[1, k - 50] ;; k, j]]) ], {j, 1, n}],
        Opacity[0.5], Gray, 
        Cuboid[{0, 0, 0}, {Sqrt[n] + 1, Sqrt[n] + 1, -0.1}]
        }, 
       PlotRange -> {{-2, Sqrt[n] + 1}, {-1, Sqrt[n] + 1}, {-2, 2}}, 
       ImageSize -> 500, Lighting -> "Neutral", Boxed -> False]
      ,
      ListPlot[Table[{Hext[j][[3]], Mean[evo[[j]]][[3]]}, {j, 1, k}], 
       PlotRange -> {{-2, 2}, {-1.2, 1.2}}, Joined -> True, 
       PlotStyle -> {Thick, Black}, Ticks -> None, 
       AxesLabel -> {"\!\(\*SubscriptBox[\(H\), \(ext\)]\)", 
         "\!\(\*SubscriptBox[\(M\), \(z\)]\)"}, 
       LabelStyle -> {Bold, Black}, ImageSize -> Medium]
      }}]
   , {k, 1, 6000, 10}];
frames2 = Table[
   Grid[{{Graphics3D[{
        Black,
        Table[
         Sphere[{Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 0}, 
          0.08], {j, 1, n}],
        Table[
         Sphere[{Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
            0} + \[Alpha]*evo2[[k, j]], 0.05], {j, 1, n}],
        Thick, 
        Flatten@Table[
          Line[{{Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
             0}, {Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
              0} + \[Alpha]*evo2[[k, j]]} ], {j, 1, n}],
        Sphere[{-1.5, Sqrt[n]/2, 0}, 0.1], Arrowheads[.025], 
        Arrow[{{-1.5, Sqrt[n]/2, 0}, {-1.5, Sqrt[n]/2, 
           Hext2[k][[3]]}}], 
        Text[Style["\!\(\*SubscriptBox[\(H\), \(ext\)]\)", Black, 
          Bold, FontSize -> 20], {-1.5, Sqrt[n]/2 + 1.5, 0}],
        Red,
        Table[
         Line[({Mod[j, Sqrt[n], 1], Quotient[j, Sqrt[n], 1] + 1, 
               0} + # &) /@ (\[Alpha]*
             evo2[[Max[1, k - 50] ;; k, j]]) ], {j, 1, n}],
        Opacity[0.5], Gray, 
        Cuboid[{0, 0, 0}, {Sqrt[n] + 1, Sqrt[n] + 1, -0.1}]
        }, 
       PlotRange -> {{-2, Sqrt[n] + 1}, {-1, Sqrt[n] + 1}, {-2, 2}}, 
       ImageSize -> 500, Lighting -> "Neutral", Boxed -> False]
      ,
      ListPlot[{Table[{Hext[j][[3]], Mean[evo[[j]]][[3]]}, {j, 1, 
          steps}], 
        Table[{Hext2[j][[3]], Mean[evo2[[j]]][[3]]}, {j, 1, k}]}, 
       PlotRange -> {{-2, 2}, {-1.2, 1.2}}, Joined -> True, 
       PlotStyle -> Directive[Thick, Black], Ticks -> None, 
       AxesLabel -> {"\!\(\*SubscriptBox[\(H\), \(ext\)]\)", 
         "\!\(\*SubscriptBox[\(M\), \(z\)]\)"}, 
       LabelStyle -> {Bold, Black}, ImageSize -> Medium]
      }}]
   , {k, 1, 6000, 10}];
ListAnimate[Join[frames1, frames2]]

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#Ferromagnet%20hysteresis.webm
Category:Self-published work Category:Animated GIF files Category:Ferromagnetism Category:Hysteresis Category:Images with Mathematica source code Category:Uploaded with video2commons
Category:Animated GIF files Category:CC-Zero Category:Ferromagnetism Category:Hysteresis Category:Images with Mathematica source code Category:Pages using deprecated source tags Category:Self-published work Category:Uploaded with video2commons