Exchange


In [1]:
import random
import oommfc as oc
import discretisedfield as df
%matplotlib inline

In [2]:
random.seed(9999)

p1 = (0, 0, 0)
p2 = (100e-9, 10e-9, 10e-9)
cell = (10e-9, 10e-9, 10e-9)

mesh = oc.Mesh(p1=p1, p2=p2, cell=cell)

def random_m(pos):
    mx = 2*random.random() - 1
    my = 2*random.random() - 1
    mz = 2*random.random() - 1
    return mx, my, mz

Ms = 8e6  # magnetisation saturation (A/m)
random_field = df.Field(mesh, value=random_m, norm=Ms)
random_field.plot_slice("y", 0);



In [3]:
A = 8e-10  # exchange energy constant (J/m)

exchange = oc.Exchange(A=A)

exchange


Out[3]:
$A [(\nabla m_{x})^{2} + (\nabla m_{y})^{2} + (\nabla m_{z})^{2}]$

In [4]:
system = oc.System(name="exchange_tutorial")

gamma = 2.211e5  # gyrotropic ration
alpha = 0.5  # Gilbert damping

system.dynamics = oc.Precession(gamma=gamma) + oc.Damping(alpha=alpha)
system.hamiltonian = exchange
system.m = random_field

In [5]:
td = oc.TimeDriver()

td.drive(system, t=0.5e-9, n=100)

system.m.plot_slice("y", 0);


2017/3/19 1:1: Calling OOMMF (exchange_tutorial/exchange_tutorial.mif) ... [1.4s]

In [6]:
system.dt.plot('t', ['mx', 'my', 'mz'])


Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x11a85d518>

In [ ]: