API for developers
DataTypes
MicroMagnetic.NumberOrArrayOrFunction
— TypeNumberOrArrayOrFunction
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
whereN
is the total spin number of the system.Function: the parameter of the function should be
(i,j,k,dx,dy,dz)
wherei,j,k
is the cell index anddx,dy,dz
is the cellsize. The return value of the function should be a real number. For example,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
MicroMagnetic.NumberOrTupleOrArrayOrFunction
— TypeNumberOrTupleOrArrayOrFunction
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
or3N
whereN
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,
function uniform_m0(i,j,k,dx,dy,dz) return (0,0,1) end
MicroMagnetic.NumberOrArray
— TypeNumberOrArray
Similar to Union NumberOrArrayOrFunction
, the Union NumberOrArray
is designed to deal with cases that a number or an array is needed.
MicroMagnetic.TupleOrArrayOrFunction
— TypeTupleOrArrayOrFunction
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
whereN
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,function uniform_m0(i,j,k,dx,dy,dz) return (0,0,1) end
Kernels
MicroMagnetic.atomistic_exchange_kernel!
— Functioncompute the exchange interaction h_ex, which is defined as
\[\mathbf{H}_\mathrm{ex, i} = \frac{1}{\mu_s} \sum_{\langle i, j\rangle} J_{i,j} \mathbf{m}_{j}.\]
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
MicroMagnetic.atomistic_dmi_kernel!
— Functioncompute the dmi interaction h_dmi, which is defined as
\[\mathcal{H}_\mathrm{dmi} = \sum_{\langle i, j\rangle} \mathbf{D}_{i j} \cdot\left(\mathbf{m}_{i} \times \mathbf{m}_{j}\right)\]
Jij is a 2d array with size (3, n_ngbs)