OOMMF Tutorial Part 3: mif Files and Examples

By | May 27, 2014

Part 3 of this getting started tutorial for OOMMF introduces mif problem files and some of the example files that come with OOMMF distributions.

Part 1 covered downloading and installing OOMMF.

Part 2 covered running OOMMF.

Search for Micromagnetics on Amazon [Sponsored Link]

mif Files

Micromagnetic calculations in OOMMF are set up in a mif problem file. A mif file is written in tcl and includes components such the calculation region, mesh size, initial magnetisation configuration and magnetic anisotropy energies. Some of the elements of a mif file are required, whereas some depend on exactly what you are trying to simulate.

Rather than write your mif file from scratch, it’s often best to use an existing file as a starting point and modify it to your needs.

OOMMF comes with a number of very useful example files, but it can sometimes be difficult to know where to start. I’ve selected here some of those that I’ve found useful and picked out the relevant sections of the files.

OOMMF Help on mif files

OOMMF Examples

OOMMF comes with a 3d micromagnetic problem solver, Oxsii. Getting started with this can be a bit daunting, but thankfully it comes with a range of examples which you can use to build up the different component that you need for your simulation system.

I’ve picked out some of the examples that I’ve found useful in the past. For each one I’ve tried to pick out and highlight the most relevant sections.

You can find these and many more similar examples in oommf/app/oxs/examples

Example 1: Exchspring.mif

  •  Multiple layers
  • Setting initial magnetisation
  • Uniaxial anisotropy
  • Simulating and applied field
Exchangepring.mif: Multiple layers, initial magnetisation, uniaxial anisotropy, applied field

Exchangepring.mif: Multiple layers, initial magnetisation, uniaxial anisotropy, applied field

Example 2: Squarecubic.mif

  • cubic anisotropy

Squarecubic.mif: use of cubic anisotropy in a problem file.

Example 3: Imageatlas.mif

  • Using a bitmap to define the simulation geometry.
  • Colours define different regions within the simulation.
  • Setting anisotropy and initial magnetisation for different regions.

Imageatlas.mif: Using a bitmap to define simulation regions.

Example 4:varalpha.mif

  • Use a ‘proc’ to define a time-varying field

Varalpha.mif: using a proc to define a time-varying magnetic field.

Example 5: one of my own

  • Setting automatic output
# Create destinations

Destination my_graph mmGraph
Destination my_archive mmArchive
Destination my_display mmDisp

# Specify what should be saved

Schedule DataTable my_graph Step 1
Schedule DataTable my_archive Step 1
Schedule Oxs_TimeDriver::Magnetization my_display Stage 1
Schedule Oxs_TimeDriver::Magnetization my_display Step 1

A step is a single iteration, while a stage is for example reaching equilibrium after one value of applied field.

Going further

As you carry out your own simulations and introduce more complicated elements you’ll begin to build up a library of your own useful examples. Rather than starting from scratch each time you’ll be able to build on these.

OOMMF Tutorial

6 thoughts on “OOMMF Tutorial Part 3: mif Files and Examples

  1. Jizhai Cui

    Hi Duncan, your tutorial is extremely helpful. Thanks a lot for putting this together!

  2. Suliman Al-Risi

    How can I write the Code for mif

    To apply perpendicular magnetic field to specific region in the nanowire in perpendicular anisotropy


    1. deparkes

      I’m not sure exactly how to do this, but I think you could build it up from a few different examples.

      To set up the nanowire, I would probably start from the ImageAtlas or Exchspring examples that come with OOMMF (mentioned above).

      I think to apply a magnetic field in a local area you could try using the Oxs_ScriptZeeman which gives you a bit more control over where a field is applied. I have written a little about using this here https://deparkes.co.uk/2017/04/22/oommf-applied-field-polar-coordinates/ – here I’m talking about using it to implement polar coordinates, but there might be something you can do to limit the region the field is applied.

      Hopefully that gives you a starting point – let me know if you get stuck.

Comments are closed.