Magnet#

class Magnet#

Bases: ABC

A Magnet should never be initialized by the user. It contains no physics. Use Ferromagnet or Antiferromagnet instead.

abstractmethod __init__(_impl_function, world, grid, name='', geometry=None, regions=None)#
Parameters:
  • _impl_function (callable) – The appropriate world._impl method of the child magnet, for example world._impl.add_ferromagnet or world._impl.add_antiferromagnet.

  • world (World) – World in which the magnet lives.

  • grid (Grid) – The number of cells in x, y, z the magnet should be divided into.

  • geometry (None, ndarray, or callable (default=None)) –

    The geometry of the magnet can be set in three ways.

    1. If the geometry contains all cells in the grid, then use None (the default)

    2. Use an ndarray which specifies for each cell wheter or not it is in the geometry.

    3. Use a function which takes x, y, and z coordinates as arguments and returns true if this position is inside the geometry and false otherwise.

  • regions (None, ndarray, or callable (default=None)) – The regional structure of a magnet can be set in the same three ways as the geometry. This parameter indexes each grid cell to a certain region.

  • name (str (default="")) – The magnet’s identifier. If the name is empty (the default), a name for the magnet will be created.

property name: str#

Name of the magnet.

property grid: Grid#

Return the underlying grid of the magnet.

property cellsize: tuple[float]#

Dimensions of the cell.

property geometry#

Geometry of the magnet.

property regions#

Regions of the magnet.

property origin: tuple[float]#

Origin of the magnet.

Returns:

origin – xyz coordinate of the origin of the magnet.

Return type:

tuple[float] of size 3

property center: tuple[float]#

Center of the magnet.

Returns:

center – xyz coordinate of the center of the magnet.

Return type:

tuple[float] of size 3

property world#

Return the World of which the magnet is a part.

property meshgrid#

Return a numpy meshgrid with the x, y, and z coordinate of each cell.

property enable_as_stray_field_source: bool#

Enable/disable this magnet (self) as the source of stray fields felt by other magnets. This does not influence demagnetization.

Default = True.

property enable_as_stray_field_destination: bool#

Enable/disable whether this magnet (self) is influenced by the stray fields of other magnets. This does not influence demagnetization.

Default = True.

property elastic_displacement: Variable#

Elastic displacement vector (m).

The elastic displacement is uninitialized (does not exist) if the elastodynamics are disabled.

property elastic_velocity: Variable#

Elastic velocity vector (m/s).

The elastic velocity is uninitialized (does not exist) if the elastodynamics are disabled.

property enable_elastodynamics: bool#

Enable/disable elastodynamic time evolution.

If elastodynamics are disabled (default), the elastic displacement and velocity are uninitialized to save memory.

Elastodynamics can not be used together with rigid normal and shear strain, where strain is set by the user instead.

property external_body_force: Parameter#

External body force density f_ext that is added to the effective body force density (N/m³).

property C11: Parameter#

Stiffness constant C11 = C22 = C33 of the stiffness tensor (N/m²).

See also

C12, C44, stress_tensor

property C12: Parameter#

Stiffness constant C12 = C13 = C23 of the stiffness tensor (N/m²).

See also

C11, C44, stress_tensor

property C44: Parameter#

Stiffness constant C44 = C55 = C66 of the stiffness tensor (N/m²).

For isotropic materials, this is equal to the shear modulus.

See also

C11, C12, stress_tensor

property eta: Parameter#

Phenomenological elastic damping constant (kg/m³s).

property stiffness_damping: Parameter#

Rayleigh damping stiffness coefficient β (s).

Default = 0.05 / (1e12 * pi) s.

This corresponds to a damping ratio of 5% at a frequency of 1 THz. This is meant to stabilize the high frequency modes, with a typical wavelength of only a few cellsizes in length.

The viscosity tensor η is assumed to be proportional to the stiffness tensor C, with this coefficient β as the proportionality constant.

η = β * C

This parameter is completely ignored when any component of the viscosity tensor (eta11, et12 or eta44) has been set.

property eta11: Parameter#

Viscosity constant eta11 = eta22 = eta33 of the viscosity tensor (Pa s) in Voigt notation, which connects strain rate to viscous stress via σ = η : dε/dt.

When set, this parameter overrules the stiffness_damping.

property eta12: Parameter#

Viscosity constant eta12 = eta13 = eta23 of the viscosity tensor (Pa s) in Voigt notation, which connects strain rate to viscous stress via σ = η : dε/dt.

When set, this parameter overrules the stiffness_damping.

property eta44: Parameter#

Viscosity constant eta44 = eta55 = eta66 of the viscosity tensor (Pa s) in Voigt notation, which connects strain rate to viscous stress via σ = η : dε/dt.

For isotropic materials, this is equal to the shear viscosity.

When set, this parameter overrules the stiffness_damping.

See also

eta11, eta12, stiffness_damping, strain_rate, visocus_stress

property rho: Parameter#

Mass density (kg/m³).

Default = 1.0 kg/m³

property rigid_norm_strain: Parameter#

The applied normal strain (m/m).

This quantity has three components (εxx, εyy, εzz), which forms the diagonal of the symmetric strain tensor:

\[\begin{split}\begin{bmatrix} \varepsilon_{xx} & 0 & 0 \\ 0 & \varepsilon_{yy} & 0 \\ 0 & 0 & \varepsilon_{zz} \end{bmatrix}\end{split}\]

The rigid strain can not be used together with elastodynamics. Here the strain is set by the user as a parameter for the magnetoelastic field, instead of calculated dynamically (strain_tensor).

property rigid_shear_strain: Parameter#

The applied shear strain (m/m).

This quantity has three components (εxy, εxz, εyz), which forms the off-diagonal of the symmetric strain tensor:

\[\begin{split}\begin{bmatrix} 0 & \varepsilon_{xy} & \varepsilon_{xz} \\ \varepsilon_{xy} & 0 & \varepsilon_{yz} \\ \varepsilon_{xz} & \varepsilon_{yz} & 0 \end{bmatrix}\end{split}\]

The rigid strain can not be used together with elastodynamics. Here the strain is set by the user as a parameter for the magnetoelastic field, instead of calculated dynamically (strain_tensor).

property boundary_traction: BoundaryTraction#

Get the boundary traction of this Magnet (Pa).

property strain_tensor: FieldQuantity#

Strain tensor (m/m), calculated according to ε = 1/2 (∇u + (∇u)^T), with u the elastic displacement.

This quantity has six components (εxx, εyy, εzz, εxy, εxz, εyz), which forms the symmetric strain tensor:

\[\begin{split}\begin{bmatrix} \varepsilon_{xx} & \varepsilon_{xy} & \varepsilon_{xz} \\ \varepsilon_{xy} & \varepsilon_{yy} & \varepsilon_{yz} \\ \varepsilon_{xz} & \varepsilon_{yz} & \varepsilon_{zz} \end{bmatrix}\end{split}\]

Note that the strain corresponds to the real strain and not the engineering strain, which would be (εxx, εyy, εzz, 2*εxy, 2*εxz, 2*εyz).

If you want to set the strain as a parameter yourself, use rigid normal and shear strain.

property strain_rate#

Time derivative of the strain tensor (1/s), calculated according to dε/dt = 1/2 (∇v + (∇v)^T), with v the elastic velocity.

property elastic_stress#

Elastic stress tensor (N/m²), calculated according to Hooke’s law σ = c:ε.

property viscous_stress#

Viscous stress tensor (N/m²) due to isotropic viscous damping, calculated according to

σ = η : dε/dt

with η the viscosity tensor and dε/dt the strain rate tensor.

property stress_tensor#

Total stress tensor (N/m²), including elastic stress and viscous stress.

This quantity has six components (σxx, σyy, σzz, σxy, σxz, σyz), which forms the symmetric stress tensor:

\[\begin{split}\begin{bmatrix} \sigma_{xx} & \sigma_{xy} & \sigma_{xz} \\ \sigma_{xy} & \sigma_{yy} & \sigma_{yz} \\ \sigma_{xz} & \sigma_{yz} & \sigma_{zz} \end{bmatrix}\end{split}\]
property internal_body_force#

Internal body force density due to stress divergence (N/m³).

f = ∇·σ

The boundary conditions of this force density are determined by the applied boundary_traction (traction-free by default).

property effective_body_force: FieldQuantity#

Elastic effective body force density is the sum of elastic, magnetoelastic and external body force densities (N/m³). Elastic damping is not included.

f_eff = f_int + f_mel + f_ext

In the case of this Magnet being a host (antiferromagnet), f_mel is the sum of all magnetoelastic body forces of all sublattices.

See also

external_body_force, internal_body_force, magnetoelastic_force

property elastic_damping: FieldQuantity#

Elastic damping body force density proportional to η and velocity

-ηv (N/m³).

See also

eta, elastic_velocity

property elastic_acceleration: FieldQuantity#

Elastic acceleration includes all effects that influence the elastic velocity including elastic, magnetoelastic and external body force densities, and elastic damping (m/s²).

property kinetic_energy_density: FieldQuantity#

Kinetic energy density related to the elastic velocity (J/m³).

property kinetic_energy: ScalarQuantity#

Kinetic energy related to the elastic velocity (J/m³).

property elastic_energy_density: FieldQuantity#

Potential energy density related to elastics (J/m³). This is given by 1/2 σ:ε

property elastic_energy: ScalarQuantity#

Potential energy related to elastics (J).

property poynting_vector: FieldQuantity#

Poynting vector (W/m2). This is given by P = - σv

stray_field_from_magnet(source_magnet)#

Return the magnetic field created by the given input source_magnet, felt by this magnet (self). This raises an error if there exists no StrayField instance between these two magnets.

Parameters:

source_magnet (Magnet) – The magnet acting as the source of the requested stray field.

Returns:

stray_field – StrayField with the given source_magnet as source and the Grid of this magnet (self) as destination.

Return type:

StrayField

See also

StrayField

property demag_field: StrayField#

Demagnetization field (T).

Ferromagnetic sublattices of other host magnets don’t have a demag field.