Skip to content

API for developers

DataTypes

MicroMagnetic.NumberOrArrayOrFunction Type
julia
NumberOrArrayOrFunction

In Micromagnetics, typical parameters such as saturation magnetization Ms and exchange stiffness constant A are constant. However, there are many cases that a spatial Ms is needed. For instance, if the simulated system is a circular disk the Ms in the corners should be set to zero. If the simulated system contains mutiple materials, the exchange constant A should be spatial as well. The Union NumberOrArrayOrFunction is designed to deal with such situations. As indicated from its name, it means that the input parameter could be a number or an array or a function:

  • Number: should be Real.

  • Array: the length of the array should be N where N is the total spin number of the system.

  • Function: the parameter of the function should be (i,j,k,dx,dy,dz) where i,j,k is the cell index and dx,dy,dz is the cellsize. The return value of the function should be a real number. For example,

    julia
    function circular_Ms(i,j,k,dx,dy,dz)
        if (i-50.5)^2 + (j-50.5)^2 <= 50^2
            return 8.6e5
        end
        return 0.0
    end
source
MicroMagnetic.NumberOrTupleOrArrayOrFunction Type
julia
NumberOrTupleOrArrayOrFunction

In micromagnetics, there are also cases where the input parameters can be either scalars or vectors and vary with space. For example, the parameters for the DMI could be a const for bulk DMI or interfacial DMI. In some materials, the DMI const may differ in different directions and thus a tuple with three numbers is required. In MicroMagnetic, the union NumberOrTupleOrArrayOrFunction is designed to deal with such situations. Similar to NumberOrArrayOrFunction, NumberOrTupleOrArrayOrFunction means that the input parameter could be a number, a tuple, an array or a function:

  • Number: should be Real.

  • Tuple: should be Real with length 3. For example, (1,2e-5,0).

  • Array: the length of the array should be N or 3N where N is the total spin number of the system.

  • Function: the parameter of the function should be (i,j,k,dx,dy,dz) and the return value should be a tuple with length 3. For example,

    julia
    function uniform_m0(i,j,k,dx,dy,dz)
        return (0,0,1)
    end
source
MicroMagnetic.NumberOrArray Type
julia
NumberOrArray

Similar to Union NumberOrArrayOrFunction, the Union NumberOrArray is designed to deal with cases that a number or an array is needed.

source
MicroMagnetic.TupleOrArrayOrFunction Type
julia
TupleOrArrayOrFunction

Similar to NumberOrArrayOrFunction, TupleOrArrayOrFunction means that the input parameter could be a tuple or an array or a function:

  • Tuple: should be Real with length 3. For example, (0,0,1e5).

  • Array: the length of the array should be 3N where N is the total spin number of the system.

  • Function: the parameter of the function should be (i,j,k,dx,dy,dz) and the return value should be a tuple with length 3. For example,

    julia
    function uniform_m0(i,j,k,dx,dy,dz)
        return (0,0,1)
    end
source

Kernels

MicroMagnetic.atomistic_exchange_kernel! Function

compute the exchange interaction h_ex, which is defined as

Hex,i=1μsi,jJi,jmj.

Jij is represented by Js, which is an array with its length equals to n_ngbs

Note that the return value is h * alpha + h_ex

source
MicroMagnetic.atomistic_dmi_kernel! Function

compute the dmi interaction h_dmi, which is defined as

Hdmi=i,jDij(mi×mj)

Jij is a 2d array with size (3, n_ngbs)

source