Micromagnetic standard problem 4

Author: Marijan Beg

Date: 11 May 2016

Problem specification

The simulated sample is a thin film cuboid with dimensions:

  • length $L_{x} = 500 \,\text{nm}$,
  • width $L_{y} = 125 \,\text{nm}$, and
  • thickness $t = 3 \,\text{nm}$.

The material parameters (similar to permalloy) are:

  • exchange energy constant $A = 1.3 \times 10^{-11} \,\text{J/m}$,
  • magnetisation saturation $M_\text{s} = 8 \times 10^{5} \,\text{A/m}$.

Magnetisation dynamics is governed by the Landau-Lifshitz-Gilbert equation

$$\frac{d\mathbf{m}}{dt} = -\gamma_{0}(\mathbf{m} \times \mathbf{H}_\text{eff}) + \alpha\left(\mathbf{m} \times \frac{d\mathbf{m}}{dt}\right)$$

where $\gamma_{0} = 2.211 \times 10^{5} \,\text{m}\,\text{A}^{-1}\,\text{s}^{-1}$ is the gyromagnetic ratio and $\alpha=0.02$ is the Gilbert damping.

In the standard problem 4, the system is firstly relaxed at zero external magnetic field and then, stating from the obtained equlibrium configuration, the magnetisation dynamics is simulated for the external magnetic field $\mathbf{H} = (-24.6, 4.3, 0.0) \,\text{mT}$.

The micromagnetic standard problem 4 specification can be also found in Ref. 1.

Simulation


In [1]:
!rm -rf standard_problem4/

We set all the necessary simulation parameters.


In [2]:
import numpy as np

mu0 = 4*np.pi*1e-7  # magnetic constant (H/m)

# Sample parameters.
Lx = 500e-9  # x dimension of the sample(m)
Ly = 125e-9  # y dimension of the sample (m)
thickness = 3e-9  # sample thickness (m)
dx = dy = 5e-9  # discretisation in x and y directions (m)
dz = 3e-9  # discretisation in the z direction (m)
cmin = (0, 0, 0)  # Minimum sample coordinate.
cmax = (Lx, Ly, thickness)  # Maximum sample coordinate.
d = (dx, dy, dz)  # Discretisation.

# Material (permalloy) parameters.
Ms = 8e5  # saturation magnetisation (A/m)
A = 1.3e-11  # exchange energy constant (J/m)

First stage

In the first stage, we relax the system at zero external magnetic field.

Required modules are imported:


In [3]:
import sys

sys.path.append('../')

from sim import Sim
from atlases import BoxAtlas
from meshes import RectangularMesh
from energies.exchange import UniformExchange
from energies.demag import Demag
from energies.zeeman import FixedZeeman

Now, atlas, mesh, and simulation objects are created.


In [4]:
atlas = BoxAtlas(cmin, cmax)  # Create an atlas object.
mesh = RectangularMesh(atlas, d)  # Create a mesh object.
sim = Sim(mesh, Ms, name='standard_problem4')  # Create a simulation object.

Energy terms (exchange and demagnetisation) are added to the system's Hamiltonian.


In [5]:
sim.add(UniformExchange(A))  # Add exchange energy.
sim.add(Demag())  # Add demagnetisation energy.

System is initialised so that the magnetisation at all mesh cells is $(1, 0.25, 0.1)$.


In [6]:
sim.set_m((1, 0.25, 0.1))  # initialise the magnetisation

At this point, system can be relaxed. We relax the system by simulating the magnetisation time evolution for $5 \,\text{ns}$ with default value of Gilbert damping $\alpha = 1$.


In [7]:
sim.run_until(5e-9)  # run time evolution for 5 ns with default value of Gilbert damping (alpha=1)

Using the magnetisation field object, we can compute the magnetisation average, sample the magnetisation at the point, or plot the magnetisation slice of the sample.


In [8]:
# Compute the average magnetisation.
print 'The average magnetisation is', sim.m_average()

# Sample the magnetisation at the point.
c = (50e-9, 75e-9, 1e-9)
print 'The magnetisation at point {} is {}'.format(c, sim.m(c))

# Plot the slice.
%matplotlib inline
sim.m.plot_slice('z', 1e-9)


The average magnetisation is [0.96720772655468756, 0.12482104905589424, -4.0987290203772194e-11]
The magnetisation at point (5e-08, 7.5e-08, 1e-09) is [  9.63258330e-01   2.68576598e-01  -1.05054151e-10]

More extensive list of the obtained of the system's parameters can be obtained using:


In [9]:
print sim.data


Totalenergy                6.306704e-19
Energycalccount            1.107700e+04
Maxdm/dt                   1.466731e-06
dE/dt                     -7.942028e-26
DeltaE                    -7.573857e-36
ExchangeEnergy             8.807949e-20
ExchangeMaxSpinAng         4.249824e+00
ExchangeStageMaxSpinAng    4.251619e+00
ExchangeRunMaxSpinAng      4.251619e+00
DemagEnergy                5.425909e-19
Iteration                  1.691000e+03
Stageiteration             1.691000e+03
Stage                      0.000000e+00
mx                         9.672077e-01
my                         1.248210e-01
mz                        -4.098729e-11
Lasttimestep               3.042871e-12
Simulationtime             5.000000e-09
Name: 0, dtype: float64

Second stage

In the second stage, the relaxed state from the first stage is used as an initial state. Now, the external magnetic field is applied $\mathbf{H}_{1} = (-24.6, 4.3, 0.0) \,\text{mT}$.


In [10]:
# Add Zeeman energy.
H = np.array([-24.6, 4.3, 0.0])*1e-3 / mu0  # external magnetic field in the first stage
sim.add(FixedZeeman(H))

In this stage, we use a smaller value of Gilbert damping in comparison to the first stage, where default value (alpha=1) was used.


In [11]:
sim.alpha = 0.02

Now, we can run the simulation for $1 \,\text{ns}$ and save the magnetisation field at 500 time steps.


In [12]:
T = 1e-9
stages = 200

sim.run_until(T, stages)

Postprocessing

A detailed table of all computed parameters from the multiple stage simulation can be shown from the pandas dataframe.


In [13]:
sim.odt_file.df.head(10)


Out[13]:
Totalenergy Energycalccount Maxdm/dt dE/dt DeltaE ExchangeEnergy ExchangeMaxSpinAng ExchangeStageMaxSpinAng ExchangeRunMaxSpinAng DemagEnergy Energy Iteration Stageiteration Stage mx my mz Lasttimestep Simulationtime
0 4.139122e-18 49.0 1870.526070 -6.120800e-10 -4.382363e-22 1.099667e-19 5.816559 8.384421 8.384421 5.452350e-19 3.483920e-18 8.0 8.0 0.0 0.966269 0.126529 -0.006281 7.185709e-13 5.000000e-12
1 4.136188e-18 74.0 1756.957508 -6.047019e-10 -4.767949e-22 1.113536e-19 7.714556 7.714556 8.384421 5.528261e-19 3.472009e-18 13.0 4.0 1.0 0.964260 0.133508 -0.012435 7.875706e-13 1.000000e-11
2 4.133169e-18 99.0 1631.268298 -6.484069e-10 -4.227024e-22 1.173236e-19 6.800677 7.714556 8.384421 5.639071e-19 3.451938e-18 18.0 4.0 2.0 0.960813 0.144901 -0.018425 6.567925e-13 1.500000e-11
3 4.129779e-18 124.0 1682.558665 -7.472736e-10 -4.406139e-22 1.183998e-19 6.891461 7.592615 8.384421 5.882417e-19 3.423138e-18 23.0 4.0 3.0 0.955744 0.160555 -0.024235 5.952894e-13 2.000000e-11
4 4.125809e-18 149.0 1699.501563 -8.808666e-10 -4.305683e-22 1.215956e-19 6.894851 7.383178 8.384421 6.190924e-19 3.385121e-18 28.0 4.0 4.0 0.948865 0.180138 -0.029845 4.925815e-13 2.500000e-11
5 4.121075e-18 174.0 1632.911776 -1.043837e-09 -7.057032e-22 1.296786e-19 6.915037 6.972219 8.384421 6.540830e-19 3.337314e-18 33.0 4.0 5.0 0.939954 0.203283 -0.035212 6.839690e-13 3.000000e-11
6 4.115451e-18 199.0 1593.662822 -1.234103e-09 -7.413024e-22 1.398774e-19 5.889764 6.915037 8.384421 6.965110e-19 3.279063e-18 38.0 4.0 6.0 0.928772 0.229621 -0.040288 6.068398e-13 3.500000e-11
7 4.108836e-18 224.0 1569.583329 -1.438151e-09 -7.279880e-22 1.509419e-19 5.936902 6.120889 8.384421 7.480553e-19 3.209839e-18 43.0 4.0 7.0 0.915101 0.258732 -0.045036 5.098388e-13 4.000000e-11
8 4.101182e-18 249.0 1509.875694 -1.647644e-09 -7.167565e-22 1.633088e-19 5.841606 5.936902 8.384421 8.085559e-19 3.129317e-18 48.0 4.0 8.0 0.898772 0.290158 -0.049426 4.374676e-13 4.500000e-11
9 4.092489e-18 268.0 1668.009804 -1.859864e-09 -3.059858e-21 1.761482e-19 5.378792 5.979401 8.384421 8.789937e-19 3.037347e-18 52.0 3.0 9.0 0.879663 0.323428 -0.053444 1.691847e-12 5.000000e-11

A single computed parameter (average my and simulation time in this case) can be extracted as an array using:


In [14]:
my_average = sim.odt_file.df['my'].as_matrix()
t_array = sim.odt_file.df['Simulationtime'].as_matrix()

After we obtained the averae magnetisation, we can plot it and compare to the already reported results in Ref. 1.


In [15]:
import matplotlib.pyplot as plt

# Plot the <my> time evolution.
plt.plot(t_array/1e-9, my_average)
plt.xlabel('t (ns)')
plt.ylabel('<my>')
plt.grid()