Fidimag: A Basic Simulation

TODO: - [x] imports - [x] Meshes (+ parameters) - [] Material parameters - [] simulation object - [] adding energies - [] setting magnetisation - [] saving data - [] relax simulation - [] viewing data

This notebook is a guide to the essential commands required to write and run basic Fidimag simulations.

The first step is to import Fidimag. Numpy and Matplotlib are also imported for later use, to demonstrate visualising simulations results.

In [1]:
import fidimag
from fidimag.common import CuboidMesh
import numpy as np
import matplotlib.pyplot as plt

Meshes

                       Mesh                                              Cell
                                                                    +------------+
      +-----+-----+-----+-----+-----+-----+                        /            /|
     /     /     /     /     /     /     /|                       /            / |
    +-----+-----+-----+-----+-----+-----+ |                      /            /  | dz
   /     /     /     /     /     /     /| +                     +------------+   |
  +-----+-----+-----+-----+-----+-----+ |/          ----->      |            |   |
 /     /     /     /     /     /     /| +                       |            |   +
+-----+-----+-----+-----+-----+-----+ |/                        |            |  /
|     |     |     |     |     |     | +                         |            | /  dy
|     |     |     |     |     |     |/                          |            |/
+-----+-----+-----+-----+-----+-----+                           +------------+
                                                                     dx

We need to create a mesh. Meshes are created by specifying the dimensions of the finite difference cells, (dx, dy, dz) and the number of cells in each direction, (nx, ny, nz).

The cell dimensions are defined by dimensionless units. The dimensions of the mesh/cells are integrated by the parameter, unit_length.

In the the following example, the (cuboid) mesh consists of 6x3x1 cells (nx=6, ny=3 and nz=1), with each cell comprising of the dimensions, dx=3, dy=3 and dz=4. The unit_length = 1e-9 (nm).

Thus, the total size of the mesh is 18nm x 9nm x 4nm.

In [2]:
nx, ny, nz = 6, 3, 1
dx, dy, dz = 3, 3, 4 #nm
unit_length = 1e-9 # define the unit length of the dx units to nm.

mesh = CuboidMesh(nx=nx, ny=ny, nz=nz, dx=dx, dy=dy, dz=dz, unit_length=unit_length)
In [3]:
nx
Out[3]:
6
In [ ]: