A couple of days ago there was a question posted in my OOmmf tutorial post.

My answer is that I don’t know a way of doing it inside OOmmf (although, there might be one, but my knowledge is limited). So, I’m going to show how I will do it outside OOmmf with Matlab and using my script for importing the magnetization into Matlab. (If you want to see other OOmmf examples, I recommend reading my other OOmmf posts).

So, first, let’s create a problem with a Py disk where the magnetic field is going to rotate around the disk moving the vortex core.

These are the options for the mmProbEd. I start by choosing Py from the materials list.

For the part geometry, I’m guessing, but one of my colleagues has done some experiments with Nickel disks, and I think about 2 micron in diameter will be enough to have a vortex. (Since this is just a test, I’m using 10 nm cell size, but a proper simulation on Py should be at least 5 nm).

I choose to start with random magnetization, and after the initial evolution from the random state into stable state, I’m applying 5 field steps that are going to produce a circular movement of the vortex’s core (the magnitude has been chosen after a few trial and error).

The next step is very important in order to be able to import the data into Matlab as I did in (OOmmf 2), we need to specify text %g as output format.

The problem is now ready. Without closing the mmProbEd window, we open one mmDisp to visualize the magnetization evolution, one mmArchive to store the data, and the mmSolve2D to run the simulation.

So, lets run the simulation. I choose to visualize the magnetization every 50 iteration steps and to save the data every control point (I put 10 steps per applied field). This is how the simulation looks like at different stages.

Now, by using the method I explained in my OOmmf 2 tutorial, you can turn the data files into images and using a photo editing program, you can create an animation like this where we can see the movement of the vortex core in response of the applied field.

Now to extract the position of the core. To do that, I use my Matlab script to import the magnetization vector files we saved.

For instance:

>> data=oommf2matlab('disk.field0010-pass20294.omf'); >> quiver(data.positionx(1:10:end,1:10:end),data.positiony(1:10:end,1:10:end),data.datax(1:10:end,1:10:end),data.datay(1:10:end,1:10:end),0.5)

Will produce a graph like this (I’m plotting one every 10 data points).

An easy way of detecting the position of the vortex is looking for a vector with z component of the magnetization (the centre of the vortex will be pointing up). The next code will draw a circular marker at the position of the core.

>> hold on [a,b]=size(data.datax); for k=1:a for j=1:b if data.dataz(k,j)>0.2e-5 plot(data.positionx(k,j),data.positiony(k,j),'ro') end end end

It will look like this

Or by putting together all the positions:

Unfortunately, this is far from perfect. A better way of doing it will be using divergence. But it is a quick fix that will work… (suggestion, play a little bit with the threshold in Matlab).

By the way, data.positionx(k,j) and data.positiony(k,j) are the data needed to answer the question shown at the beginning of the post.

My final though. If you want to combine this to some kind of automatic testing, visit my OOmmf 3 tutorial and find a way of generating the mif scripts automatically.

Thanks for the post! I didn’t expect a full article but thanks a lot! I figured out how to do this calculation yesterday. I did something very similar. i.e., I ran the mmSolve2D program (for me, I ran the simulation as a calculation of the hysteresis loop), and then imported all of the files to matlab using your conversion function with an extra calculation to include the simulation time. Then I ran another function to loop over all of the files, and to calculate the position of the maximum value of magnetization in the z direction. That gave me the coordinates of the vortex core for every step and time in the simulation, and I created vectors of this which I plotted. Again, thanks so much for your reply, and especially for your conversion function, which made this 1000 times easier.

You are welcome. It’s always a pleasure to help. If you keep working on it, maybe you find a solution to why in Matlab the function “divergence” seems not to work properly on the data imported by my script. (My idea was to use the divergence instead of looking for z component, but it seems it doesn’t work properly with the data imported with my script).

I can definitely look into that while I continue my work. By the way, have you noticed any errors in OOMMF when simulating elliptical particles? I’m currently running a simulation for a 1.5x.75 micrometer permalloy ellipse that is 20nm thick, which should be magnetically soft. However, after saturation along the easy axis and then relaxing to 0 applied field, the remanence is about 98%, which contradicts several published articles. I’m currently trying to emulate a paper that used the LLG simulator with the same experiment parameters, and they got the remanence to be 0 after saturation along both the easy and hard axes. Please let me know if you’ve had a similar experience.

Unfortunately I don’t have that much experience. I’m more into experiments than simulation. I recommend joining the mailing list and asking there the same question, they might come across similar issues.

Alright, I’ll definitely do that. Thanks again, and I’ll let you know if I figure out the divergence problem.