4.2 Algorithms for time integration
4.2.6 Summary
In this section we gave a quick review of some of the numerical methods which were used in the computational studies presented in this thesis. We briefly introduced some of the ideas at the base of the finite element method and gave a quick overview on some time-integration techniques which are often used for micromagnetics. We focused mainly on the Euler method, which was implemented initially while working on the project for this thesis. At present, however, our simulation software, Nmag, uses the CVODE package for carrying out the time integration of the LLG equation [47].
Chapter 5
Nmag, a flexible micromagnetic
simulation software
All the numerical results presented in this thesis have been obtained using Nmag, the FEM-based micromagnetic simulation package which has been developed by our group in Southampton and has been released as open source [51]. At present, Nmag has been used in our own works to study effects such as the anisotropic magnetoresistance in nano-rings [52], the demagnetising field of quasi-periodic nanostructures [53], exchange springs systems [54] spin transfer torque effects [55, 56] and has been recently employed by other independent groups for their own studies [57, 58].
For the preparation of this thesis we have not just used Nmag, but we have also devoted considerable time in developing and improving it. In this chapter we explain the reason why we embarked on the development of a new software for micromagnetic simulations, rather than using an already existing system such as OOMMF [37] or Magpar [59]. We discuss the main goals and characteristics of Nmag and explain how we contributed to it.
5.1
Introduction
In recent times researchers are showing an increasing interest in the coupling between magnetism and other phenomena, such as spin transport, heat generation and conduc- tion, electromagnetic wave generation and absorption, etc. This trend is generating a considerable demand for flexible simulation tools, which have multiphysics capabili- ties, meaning that they can take into account different types of physics. While there are a number of commercial and free software packages for micromagnetic modelling
[37, 59, 60], practically all of them are frameworks highly specialised in micromagnetics, which need ad-hoc extensions in order to introduce new fields or modify the equation of motion. These tools typically rely on a rigid scheme for performing micromagnetic simulations, which is depicted in Fig. 5.1-a. When using such tools, the user has to
Figure 5.1: Different approaches to micromagnetic simulations. (a) traditional approach, where
input parameters (a set of numbers) are provided in one or more files. (b) alternative approach, where the simulation capabilities are collected in a library for a modern and powerful scripting language and the simulation is carried out just by using the library.
provide one or more files, containing a set of input parameters. These input parameters are essentially a bunch of numbers describing the material (saturation magnetisation
Msat, exchange coupling constant A, etc.), the initial magnetisation configuration, the
range for the applied magnetic field (in the case of hysteresis loop). When launched, the simulation tool reads the parameters and runs the simulation, writing the results in a set of output files. It does all this following a rigid predetermined order of execution and may thus remind how a vending machine works: select the drink, the amount of sugar, press the button, get the coffee. This approach is simple and often effective enough. In many other situations, however, it is desirable to have more flexibility, in particular when studying new magnetic nanostructures and multiphysics scenarios.
With Nmag we propose an alternative approach (see Fig. 5.1-b), where micro- magnetism is just one applications of a generalised framework and extensions to the software (such as adding a new field or modifying the equation of motion) can be made without recompiling it. The central idea is to embed the simulation capabilities inside
a library for a scripting language. To run a simulation, then, the user has to write a
small script1, rather than providing a list of input parameters. This approach has a
number of advantages in terms of flexibility:
• it is the user who decides what to do and when: the order of execution is de- termined by how the user writes the script. He can do a time integration with the method advance time, perform an hysteresis loop with hysteresis, save the data with save data. The user decides what to do by calling the appropriate function in the desired order;
• the micromagnetic simulation library can be used together with other libraries. For example, if a micromagnetic simulation is carried out in order to determine the amplitude A of the magnetisation response to a given stimulus s, then an
optimisation library may be used in order to find which stimulus smax maximises
the amplitude A.
• new capabilities can be added easily from within the scripting language;
• there is also an advantage in terms of clarity. A small script is generally clearer that a file containing just a list of input parameters.
The popular software OOMMF uses an approach which may appear to be very similar to the one we have just described: it requires the user to provide a Tcl script [61] in order to carry out a micromagnetic simulation. At present, however, OOMMF uses Tcl just to collect the input parameters and does not give to the user control over the order of execution. It thus sticks to the traditional approach of Fig. 5.1-a, with some additional advantages, such as offering the possibility of setting an arbitrary initial magnetisation. OOMMF does not allow the user to run more than one simulation per script [62].