StrayField#

class StrayField#

Bases: FieldQuantity

Represent a stray field of a magnet in a specific grid.

__init__(magnet, grid)#
Parameters:
  • magnet (Magnet) – Magnet instance which is the field source.

  • grid (Grid) – Grid instance on which the stray field will be computed.

set_method(method)#

Set the computation method for the stray field.

Parameters:

method ({"brute", "fft"}, optional) – The default value is “fft”.

property order#

Set the maximum order of 1/R, where R is the distance between cells, in the asymptotic expansion of the demag kernel.

This value should be an integer and 3 <= order <= 12. Choosing an even order gives the same result as that order minus 1.

The default value is 11.

property epsilon#

Set epsilon to calculate the analytical error. The error is defined as epsilon * R³ / V.

The default value is 5e-10.

See also

order, switch_radius

property switch_radius#

Set the radius R, in meters, from which point the asymptotic expantion should be used. Default is -1, then the OOMMF error estimations are used:

Assume the following errors on the analytical and asymptotic result

E_analytic = eps R³/V

E_asymptotic = V R²/(5(R²-dmax²)) dmax^(n-3)/R^(n)

Here V is dx*dy*dz, dmax = max(dx,dy,dz), n is the order of asymptote and eps is a constant. Use the analytical model when

E_analytic / E_asymptotic < 1

See also

set_order, set_epsilon