CubicAnisotropy#

class micromagneticmodel.CubicAnisotropy(**kwargs)#

Cubic anisotropy energy term.

\[w = -K [(\mathbf{m} \cdot \mathbf{u}_{1})^{2} (\mathbf{m} \cdot \mathbf{u}_{2})^{2} + (\mathbf{m} \cdot \mathbf{u}_{2})^{2} (\mathbf{m} \cdot \mathbf{u}_{3})^{2} + (\mathbf{m} \cdot \mathbf{u}_{3})^{2} (\mathbf{m} \cdot \mathbf{u}_{1})^{2}]\]
Parameters:
  • K (numbers.Real, dict, discretisedfield.Field) – If a single value numbers.Real is passed, a spatially constant parameter is defined. For a spatially varying parameter, either a dictionary, e.g. K={'region1': 1e6, 'region2': 5e5} (if the parameter is defined “per region”) or discretisedfield.Field is passed.

  • u1 ((3,) array_like, dict, discretisedfield.Field) – If a single length-3 array_like (tuple, list, numpy.ndarray) is passed, which consists of numbers.Real, a spatially constant parameter is defined. For a spatially varying parameter, either a dictionary, e.g. u1={'region1': (0, 0, 1), 'region2': (1, 0, 0)} (if the parameter is defined “per region”) or discretisedfield.Field is passed.

  • u2 ((3,) array_like, dict, discretisedfield.Field) – If a single length-3 array_like (tuple, list, numpy.ndarray) is passed, which consists of numbers.Real, a spatially constant parameter is defined. For a spatially varying parameter, either a dictionary, e.g. u1={'region1': (0, 0, 1), 'region2': (1, 0, 0)} (if the parameter is defined “per region”) or discretisedfield.Field is passed.

Examples

  1. Defining the cubic anisotropy energy term using single values.

>>> import micromagneticmodel as mm
...
>>> ca = mm.CubicAnisotropy(K=1e4, u1=(0, 0, 1), u2=(0, 1, 0))
  1. Defining the cubic anisotropy energy term using dictionary.

>>> K = {'region1': 1e5, 'region2': 4e5}
>>> u1 = {'region1': (0, 1, 1), 'region2': (0, 0, 1)}
>>> u2 = {'region1': (0, -1, 1), 'region2': (0, 1, 0)}
>>> ca = mm.CubicAnisotropy(K=K, u1=u1, u2=u2)

3. Defining the cubic anisotropy energy term using discretisedfield.Field.

>>> import discretisedfield as df
...
>>> region = df.Region(p1=(0, 0, 0), p2=(5e-9, 5e-9, 5e-9))
>>> mesh = df.Mesh(region=region, n=(5, 5, 5))
>>> K = df.Field(mesh, nvdim=1, value=1e5)
>>> u1 = df.Field(mesh, nvdim=3, value=(0, 1, 0))
>>> u2 = df.Field(mesh, nvdim=3, value=(0, 0, 1))
>>> ca = mm.CubicAnisotropy(K=K, u1=u1, u2=u2)

4. An attempt to define the cubic anisotropy energy term using a wrong value.

>>> # length-4 vector for u1
>>> ca = mm.CubicAnisotropy(K=1e5, u1=(0, 0, 1, 0), u2=(1, 0, 0))
Traceback (most recent call last):
...
ValueError: ...

Methods

__add__

Binary + operator.

__dir__

Default dir() implementation.

__eq__

Relational operator ==.

__iter__

Iterator.

__repr__

Representation string.

density

effective_field

energy

Properties

K

Descriptor allowing setting attributes with a value described as descriptor or a dictionary.

name

Name.

u1

Descriptor allowing setting attributes with a value described as descriptor or a dictionary.

u2

Descriptor allowing setting attributes with a value described as descriptor or a dictionary.