Author: Marijan Beg
Date: 11 May 2016
The simulated sample is a thin film cuboid with dimensions:
The material parameters (similar to permalloy) are:
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.
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)
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)
More extensive list of the obtained of the system's parameters can be obtained using:
In [9]:
print sim.data
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)
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]:
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()