UniaxialAnisotropy#

class micromagneticmodel.UniaxialAnisotropy(**kwargs)#

Uniaxial anisotropy energy term.

\[w = -K/K_{1} (\mathbf{m} \cdot \mathbf{u})^{2} - K_{2} (\mathbf{m} \cdot \mathbf{u})^{4}\]
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.

  • K1 (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.

  • K2 (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.

  • u ((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. u={'region1': (0, 0, 1), 'region2': (1, 0, 0)} (if the parameter is defined “per region”) or discretisedfield.Field is passed.

Examples

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

>>> import micromagneticmodel as mm
...
>>> ua = mm.UniaxialAnisotropy(K=1e5, u=(0, 0, 1))
  1. Defining the uniaxial anisotropy energy term using dictionary.

>>> K = {'region1': 1e6, 'region2': 1e5}
>>> u = {'region1': (0, 0, 1), 'region2': (1, 0, 0)}
>>> ua = mm.UniaxialAnisotropy(K=K, u=u)

3. Defining the uniaxial 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=1e6)
>>> u = df.Field(mesh, nvdim=3, value=(0, 1, 0))
>>> ua = mm.UniaxialAnisotropy(K=K, u=u)
  1. Defining higher-order uniaxial anisotropy

>>> ua = mm.UniaxialAnisotropy(K1=1e5, K2=2e3, u=(0, 0, 1))

5. An attempt to define the uniaxial anisotropy energy term using a wrong value.

>>> ua = mm.UniaxialAnisotropy(K=1e5, u=(0, 0, 1, 0))  # length-4 vector
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.

K1

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

K2

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

name

Name.

u

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