OOmmf 3

In this new OOmmf post/tutorial I want to go through the on how to define problems as files instead of using the problem editor. Again it is for 2D problems. I think this is something important if you want to optimize the usage of the program and do lots of simulations (e.g. like when trying to optimize a device geometry).

oommf3

Before I start, remember to check the other 2 tutorials

OOmmf

Where I show the basics of how to set a problem and run a simulation using an image to define the geometry.

OOmmf 2

Where I describe how to save magnetization and convert the files into images to build an animation of the simulation.

So the problem for today is being able to simulate these 3 geometries which I draw using Inkscape (you can download them or draw ones yourself).

4um_2um_0nm

As you can see I’m changing where the wire joins the disk.4um_2um_250nm

The size of the images is 4 by 2 micrometers, and the material is going to be Permalloy (magnetization along the plane of the device), 20 nm thick.

 

4um_2um_500nmThe names of the files are going to be:

4um_2um_0nm.png
4um_2um_250nm.png
4um_2um_500nm.png

Now for the script to run a single program. Create a txt file named example and copy this (extracted from the documentation about how to set problems as MIF files and modified for our case). We are going to simulate the first of the geometries, applying a field along the x axis from -100 mT to 100 mT.

# MIF 1.1
#
# All units are SI.
#
####################### MATERIAL PARAMETERS ############################
Ms:  800e3                 # Saturation magnetization in A/m.
A:   13e-12                # Exchange stiffness in J/m.
K1:  0.5e3                 # Anisotropy constant in J/m^3.
Anisotropy Type: uniaxial  # One of <uniaxial|cubic>.
Anisotropy Dir1: 1 0 0     # Directional cosines wrt to coordinate axes

####################### DEMAG SPECIFICATION ############################
Demag Type: ConstMag # One of <ConstMag|3dSlab|2dSlab|3dCharge|FastPipe|None>.

########################## PART GEOMETRY ###############################
Part Width:     4.0e-6    # Nominal part width in m
Part Height:    2.0e-6     # Nominal part height in m
Part Thickness: 20e-9       # Part thickness in m.
Cell Size:      20e-9     # Cell size in m.
#Part Shape:
Part Shape: mask {I:\Oommf simulations\oommf12a5rc_20120928_85_x64\oommf-1.2a5\4um_2um_0nm.png}
###################### INITIAL MAGNETIZATION ###########################
Init Mag: Random # Initial magnetization routine and parameters

###################### EXPERIMENT PARAMETERS ###########################
Field Type: Uniform
Field Range: -.100 0. 0. .100 0. 0. 20 # Start_field Stop_field Steps
Field Range: .100 0. 0. -.100 0. 0. 20
# The above applies a uniform field stepped from (-.1, 0. ,0.) to (.1,0.,0.) (Tesla), and
# back, in approximately 0.01 T steps.

Default Control Point Spec: -torque 1e-6 # Assume equilibrium has been
# reached, and step the applied field, when the reduced torque |mxh|
# drops below 1e-6.

###################### OUTPUT SPECIFICATIONS ###########################
Base Output Filename: samplerun
Magnetization Output Format: text %g # Save magnetization states

########################## MISCELLANEOUS ###############################
Randomizer Seed: 1   # Value to seed random number generator with.
User Comment: This is an example MIF file, with lots of comments.

Save the file, close the text editor and change the file format to *.mif.

As you can see the definition of the problem in this way is very similar as using mmProbEd. You can also define the problem using mmProbEd and save it as a mif.

To run this problem start Oommf open for example  mmDisp and File>Show Console

In the console simply run

Tclsh oommf.tcl batchsolve {I:\Oommf simulations\oommf12a5rc_20120928_85_x64\oommf-1.2a5\example.mif}

This will automatically run the problem and save the output in *.omf format (magnetization).

Remember OOmmf 2 post on how to convert in images the output. We run

tclsh oommf.tcl avf2ppm *.omf -config magnetic.txt -opatsub .jpg
 -filter "tclsh oommf.tcl any2ppm -format jpeg"

and with Gimp we can construct the animation.

oommf3The cell size is very big (so the example will finish fast) but we can see that it worked because in the animation we can see how the colour changes in one of the ends.

Can we visualize this process and extract exactly when the transition happens? Yes we can.

At the same time as the magnetization was saved, a file named *.odt is created. This file can be opened in mmGraph in order to plot the different outputs from the problem.Remember that if you run again the same problem the vector files will be rewritten, but the odt file will not be deleted, new results will be appended.

In the next graph I ploted in x the magnetic field along x and in y I ploted the magnetization along x Mx respect to the magnetization at saturation. We are interested in Mx/Ms against Bx because the jumps are going to tell us when the structure reverses magnetization.

magnetization

Here is possible to see 2 effects combined, the big cell size and the few field steps. Their effect is that it is not possible to see where the transition happens.

In the next graph I have double the number of field steps to show how transitions are now more clear.

magneti

Now the different transitions are more clear. Also is possible to see that is not necessary to reach 100 mT to saturate the device. Actually, 50 mT is enough. That is going to reduce quite a lot the simulations for the next part.

Before going to the last part, let me notice that is possible to open this data file in Matlab. (Remember that I have a script for uploading the vector files into Matlab)

bg_header_mwlogo_notag

It’s not straigth forward opening the *.odt file into Matlab, but I wrote an script that is available to download in matlabfile exchange.

With this script you can extract the data from a *odt file and plot it in Matlab. (It will only work when the odt file corresponds to a single problem, several problems in the same odt file will produce an error).

Running the script will allow you to get the same graph and you can extract the data more easily.
matlab

Now for the last part.

My original idea was to try the batch processing available in Oommf to automatize the simulations, but it seems the batch processing has a bug with most of the Windows OS. It is something related to the usage of the ports by Oommf and the system… and it’s not easy to solve. It seems in Linux that problem doesn’t exists.

So let’s do the next part just running 3 problems one after the other.

First thing is to create 3 *.mif files as the one we just run just changing the name of the image used for the geometry and the name used for saving the files.

4um_2um_0nm.png -> 4um_2um_0nm.mif

4um_2um_250nm.png -> 4um_2um_250nm.mif

4um_2um_500nm.png -> 4um_2um_500nm.mif

Running each one of the problems as in the first example we will obtain 3 *.odt files that once opened in Matlab allow us to compare the devices. The result is shown in the next graph.hysteresis2Despite the simulations were made with very big cell size and few field steps, is possible to see that there is a big difference between having the joint between the nanowire and the disk in the centre or in one side.

Advertisements

One thought on “OOmmf 3”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s