World#
- class World#
Bases:
object
Construct a world with a given cell size.
- __init__(cellsize, pbc_repetitions=(0, 0, 0), mastergrid=Grid(size=(0, 0, 0), origin=(0, 0, 0)))#
- Parameters:
cellsize (tuple[float] of size 3) – A tuple of three floating pointing numbers which represent the dimensions of the cells in the x, y, and z direction.
pbc_repetitions (tuple[int] of size 3, default=(0,0,0)) – The number of repetitions for everything inside mastergrid in the x, y and z directions to create periodic boundary conditions. The number of repetitions determines the cutoff range for the demagnetization.
mastergrid (Grid, default=Grid((0,0,0))) – Mastergrid defines a periodic simulation box. If it has zero size in a direction, then it is considered to be infinitely large (no periodicity) in that direction. A 0 in mastergrid should correspond to a 0 in pbc_repetitions. All subsequently added magnets need to fit inside this mastergrid.
Note
pbc_repetitions
andmastergrid
can be changed later usingset_pbc()
.See also
- property timesolver: TimeSolver#
TimeSolver
for this world.
- get_ferromagnet(name)#
Get a
Ferromagnet
by its name.Raises KeyError if there is no magnet with the given name.
- Return type:
- get_antiferromagnet(name)#
Get an
Antiferromagnet
by its name.Raises KeyError if there is no magnet with the given name.
- Return type:
- get_ncafm(name)#
Get a non-collinear antiferromagnet by its name. Raises KeyError if there is no magnet with the given name.
- property ferromagnets: dict[str, Ferromagnet]#
Get a dictionairy of
Ferromagnet
names.
- property antiferromagnets: dict[str, Antiferromagnet]#
Get a dictionairy of
Antiferromagnet
names.
- property ncafms#
Get a dictionairy of non-collinear antiferromagnets by name.
- minimize(tol=1e-06, nsamples=10)#
Minimize the total energy.
Fast energy minimization of the world as a whole, but less robust than relax when starting from a high energy state.
- Parameters:
tol (int / float (default=1e-6)) – The maximum allowed difference between consecutive magnetization evaluations when advancing toward an energy minimum.
nsamples (int (default=10)) – The number of consecutive magnetization evaluations that must not differ by more than the tolerance “tol”.
See also
- relax(tol=1e-09)#
Relax the state to an energy minimum.
The system evolves in time without precession (pure damping) until the total energy (i.e. the sum of all magnets in this world) hits the noise floor. Hereafter, relaxation keeps on going until the maximum torque is minimized.
- Parameters:
tol (float, default=1e-9) – The lowest maximum error of the timesolver.
See also
- property RelaxTorqueThreshold: float#
Threshold torque used for relaxing the system (default = -1).
If set to a negative value (default behaviour), the system relaxes until the total torque (i.e. the sum of all magnets in this world) is steady or increasing.
If set to a positive value, the system relaxes until the total torque is smaller than or equal to this threshold.
See also
- property cellsize: tuple[float]#
Return the cell size of the world.
- Returns:
A tuple of three floating pointing numbers which represent the dimensions of the cells in the x, y, and z direction.
- Return type:
tuple[float] of size 3
- property bias_magnetic_field: tuple[float]#
Return a uniform magnetic field which extends over the whole world.
- property mastergrid: Grid#
The master grid of the world.
Mastergrid defines a periodic simulation box. If it has zero size in a direction, then it is considered to be infinitely large (no periodicity) in that direction.
It is advised to set
mastergrid
usingset_pbc()
.See also
- property pbc_repetitions: tuple[int]#
The number of repetitions for everything inside mastergrid in the x, y and z directions to create periodic boundary conditions. The number of repetitions determines the cutoff range for the demagnetization.
For example (2,0,1) means that, for the strayFieldKernel computation, all magnets are essentially copied twice to the right, twice to the left, but not in the y direction. That row is then copied once up and once down, creating a 5x1x3 grid.
It is advised to set
pbc_repetitions
usingset_pbc()
.See also
- property bounding_grid: Grid#
Returns
Grid
which is the minimum bounding box of all magnets currently in the world.
- set_pbc(pbc_repetitions, mastergrid=None)#
Set the periodic boundary conditions.
This will recalculate all strayfield kernels of all magnets in the world.
- Parameters:
pbc_repetitions (tuple[int] of size 3) – The number of repetitions for everything inside mastergrid in the x, y and z directions to create periodic boundary conditions. The number of repetitions determines the cutoff range for the demagnetization.
mastergrid (Grid, default=None) –
Mastergrid defines a periodic simulation box. If it has zero size in a direction, then it is considered to be infinitely large (no periodicity) in that direction. A 0 in mastergrid should correspond to a 0 in pbc_repetitions.
If set to None (default), the mastergrid will be set to the minimum bounding box of the magnets currently inside the world, but infinitely large (size 0, no periodicity) for any direction set to 0 in pbc_repetitions. This reflects the behavior of the mumax³ SetPBC function. This will throw an error if there are no magnets in the world.
See also