OOMMF Tutorial Part 5: OOMMF Tips

By | October 16, 2014

An assortment of OOMMF tips that will hopefully make your OOMMF life easier.

Simulation cell size

One of the easiest ways to speed up your simulation is to increase the cell size. Unfortunately this is also one of the easiest ways to get spurious results.

Check out this explanation of discretization, exchange length and getting your cell size right.

Periodic Mesh

I’ve mentioned this before, but it is handy to know, so I’ve included it here. Using a periodic mesh can be useful for shortening computation times and get around end-effect issues such as stray fields.

Variable substitution

Variable subsitution allows you to set variables at the start of your mif file and have the script use or modify them later on.

It’s such a basic thing, and I know it’s in the user manual, but I remember it taking a little while for me to figure out at first. You can enable variable substitution in a specify block using ‘subst’ and a pair of additional brackets, as in this example

# Divide image file into mesh, periodic in x direction
Specify Oxs_PeriodicRectangularMesh:mesh [ subst {
cellsize {$xcell $ycell $zcell}
atlas :atlas
periodic x
} ]

without these extra terms OOMMF won’t know what to do with $var1 $var2 etc in the Specify block.


Do yourself a favour and use a sensible text editor like notepad-2mod which can do syntax highlighting on the OOMMF mif files.

Trying to find that rogue brace or missing space is made much more difficult than it needs to be when you’re just using vanilla notepad.

Parallel Processing

Another way of speeding up OOMMF, which won’t damage the physics.

Current versions of OOMMF come with parallelisation enabled (You’ll have to make sure you’ve installed the correct versions of Tcl/Tk for it to activate).

Parallel processing can give a dramatic improvement in performance [pdf]. In my own tests I’ve seen as much as a 5x improvemetn in simulation times for 8 cores:

OOMMF Tips - Parallelization

You can get dramatic performance increases by enabling parallelization in OOMMF.

Part 6 of this OOMMF Tutorial: Scripting with python

OOMMF Tutorial

7 thoughts on “OOMMF Tutorial Part 5: OOMMF Tips

  1. Jia Liu

    How could I parallel processing my OOMMF and Where is the setting. I would be thankful if u can give me more details about it.

        1. deparkes

          OK – this version is parallelisation capable, as long as your TCL is parallel compatible (see this link –

          It could be that your OOMMF is already setup for using
          multiple threads. If you’re not sure, then you can check it by loading oxsi, and going to Help -> About. On here there should be a line “Number of Threads”. This number is usually the number of processing cores on your system.

          You can also find out more information about threads/parallelisation here:

          1. Jia L

            Wow,Thank you very much!It is useful.Thanks for your reply.
            Best wishs! 🙂

          2. Jia L

            Sorry to disturb you,again.Recently,I wrote a TCL Script. It is simple. However ,it can only run for the first line. The Script as follows;

            exec ~/oommf/oommf.tcl oxsii -pause 0 cgtest.mif

            exec ~/oommf/oommf.tcl oxsii -pause 0 cgtest1.mif

            The cgtest.mif ,it can be run. But there is no reaction with the second .mif file.
            Thanks !

Comments are closed.