llg.box

Visualisation of damped and undamped LLG dynamics

../../_images/llg.png

Just one more example. To run this example you will need the following file(s): ./llg.box, p3d.box. If the example requires more than one file, then you should put them into the same directory. You can then launch Box/Boxer with box -l g ./llg.box or boxer ./llg.box.

//!BOXER:VERSION:0:1:1

include "g"
GUI = Void
Window@GUI[]

//!BOXER:REFPOINTS:BEGIN
gui3 = Point[.x=31.1569969088, .y=-3.41706]
gui4 = Point[.x=-116.076762887, .y=63.9851772881]
gui1 = Point[.x=-20.4331940998, .y=16.9076002214]
gui2 = Point[.x=6.3165896861, .y=56.8576662595]
gui5 = Point[.x=-29.6994682274, .y=57.7401147037]
gui7 = Point[.x=-13.2660986547, .y=29.1192128462]
gui8 = Point[.x=-21.1500381166, .y=48.4351565385]
gui9 = Point[.x=-9.45128923767, .y=26.8317984615]
gui10 = Point[.x=-29.7969394619, .y=51.3879137931]
//!BOXER:REFPOINTS:END
include "p3d"
include "arrows"

Tanh = Real
Real@Tanh[ep = Exp[$], em = 1/ep, $$ = (ep - em)/(ep + em)]

//---------------------------------------------------------------
// Parameters
b = 0.05
c = 1.0
t0 = 21.0
t1 = t0
v = (-80, 0)
//---------------------------------------------------------------

theta0 = Acos[Tanh[b*c*t0]]
center = Point[P3D[Sph[.r = 50.0, .theta=theta0, .phi=-c*t0], .x=0, .z=0]]

Behind = Int
Real@Behind[
  u = c*$/const.pi
  $$ = Int[u - 0.5] % 2 == 1
]

DampTrajectory = Point
Real@DampTrajectory[
  t = $
  $$ = Point[P3D[Sph[.r = 50.0, .theta=Acos[Tanh[b*c*t]] , .phi=-c*t]]]
]

UndampTrajectory = Point
Real@UndampTrajectory[
  t = $
  $$ = Point[P3D[Sph[.r = 50.0, .theta=theta0 , .phi=-c*t]]]
]

//---------------------------------------------------------------
// Styles
color_m = Color[(1, 0.6, 0)]
color_happ = Color[(0.4, 0.9, 0)]
color_traj = color_m
color_dmdt = Color[0.4]

s1 = StrokeStyle[0.2, Dash[2]]
s2 = StrokeStyle[0.5, Dash[1], color_traj]

//---------------------------------------------------------------

p1 = UndampTrajectory[t1]

Draw = ++(Int which,)
Int@Draw[.which = $]

Draw@Window[
  face = $.which
  t = t0
  [
    Line[DampTrajectory[t], For[Behind[(t += 0.01)] == face], s2]
    [For[Behind[(t += 0.01)] != face]]
    For[t < 55.0]
  ]

  t = t0, dt = 6.3
  [
    Line[UndampTrajectory[t] + v
         For[!Behind[(t += 0.01)] != face && t < t0 + dt], s2]
    [For[Behind[(t += 0.01)] == face]]
    For[t < t0 + dt]
  ]
]

w = Window[][
  BBox[gui3, gui4]

  Draw[1] // Draw trajectory behind arrows

  Arrow3D[Point[(0, 0, 0)], Point[(0, 60, 0)]
          .width=1.5, color.white, color_happ, Color[color_happ, .Darker[0.7]]
          .perspective=0.2]
  Arrow3D[Point[(0, 0, 0)], DampTrajectory[t1]
          .width=1.5, color.white, color_m, Color[color_m, .Darker[0.7]]]

  Arrow3D[Point[(0, 0, 0)] + v, Point[(0, 60, 0)] + v
          .width=1.5, color.white, color_happ, Color[color_happ, .Darker[0.7]]
          .perspective=0.2]
  Arrow3D[Point[(0, 0, 0)] + v, UndampTrajectory[t1] + v
          .width=1.5, color.white, color_m, Color[color_m, .Darker[0.7]]]

  Line[s1, center, p1]
  Line[s1, center + v, p1 + v]
  Circles[color.black, center, 0.5; p1; center+v; p1+v]

  Texts[Font["sans", 6], color_m, "M", gui1; gui1 + v, "M"]
  Texts[Font["sans", 6], color_happ, "H", gui2; gui2 + v, "H"]
  Texts[Font["sans", 3.5], color_dmdt
        "- M x H", gui9; gui9 + v, "- M x H"; "- M x (M x H)", gui10]

  Draw[0] // Draw trajectory above arrows

  Texts[Font["sans", 4.5], color.black
        "(b)", gui5 + (60, 0); "(a)", gui5 + v]
  Lines[0.5, color_dmdt
        p1, Scale[1.0], arrow, gui7;
        p1 + v, arrow, gui7 + v;
        p1, arrow, gui8]
]

w.Save["llg.png", Window["rgb24", .Res[Dpi[100]]]]
GUI[w]


Table Of Contents



This Page



Get The figure description language: Box at SourceForge.net. Fast, secure and Free Open Source software downloads