mammos_mumag.hysteresis#

Functions for evaluating and processin the hysteresis loop.

Functions

run(Ms, A, K1, mesh_filepath, hstart, hfinal)

Run hysteresis loop.

Classes

Result(H, M[, energy_density, ...])

Hysteresis loop Result.

class mammos_mumag.hysteresis.Result(H, M, energy_density=None, configuration_type=None, configurations=None)[source]#

Hysteresis loop Result.

Parameters:
H: Entity#

Array of external field strengths.

M: Entity#

Array of spontaneous magnetization values for the field strengths.

configuration_type: ndarray | None = None#

Array of indices of representative configurations for the field strengths.

configurations: dict[int, Path] | None = None#

Mapping of configuration indices to file paths.

property dataframe: DataFrame#

Dataframe containing the result data of the hysteresis loop.

energy_density: Entity | None = None#

Array of energy densities for the field strengths.

plot(duplicate=True, duplicate_change_color=True, configuration_marks=False, ax=None, label=None, **kwargs)[source]#

Plot hysteresis loop.

Parameters:
  • duplicate (bool) – Also plot loop with -M and -H to simulate full hysteresis.

  • configuration_marks (bool) – Show markers where a configuration has been saved.

  • ax (matplotlib.axes.Axes | None) – Matplotlib axes object to which the plot is added. A new one is create if not passed.

  • kwargs – Additional keyword arguments passed to ax.plot when plotting the hysteresis lines.

  • duplicate_change_color (bool)

  • label (str | None)

Returns:

The matplotlib.axes.Axes object which was used to plot the hysteresis loop

Return type:

matplotlib.axes.Axes

plot_configuration(idx, jupyter_backend='trame', plotter=None)[source]#

Plot configuration with index idx.

This method does only directly show the plot if no plotter is passed in. Otherwise, the caller must call plotter.show() separately. This behavior is based on the assumption that the user will want to further modify the plot before displaying/saving it when passing a plotter.

Parameters:
  • idx (int) – Index of the configuration.

  • jupyter_backend (str) – Plotting backend.

  • plotter (pyvista.Plotter | None) – Pyvista plotter to which glyphs will be added. A new plotter is created if no plotter is passed.

Return type:

None

mammos_mumag.hysteresis.run(Ms, A, K1, mesh_filepath, hstart, hfinal, hstep=None, hnsteps=20, outdir='hystloop')[source]#

Run hysteresis loop.

Parameters:
  • Ms (float | Quantity | Entity) – Spontaneous magnetisation in \(\mathrm{A}/\mathrm{m}\).

  • A (float | Quantity | Entity) – Exchange stiffness constant in \(\mathrm{J}/\mathrm{m}\).

  • K1 (float | Quantity | Entity) – First magnetocrystalline anisotropy constant in \(\mathrm{J}/\mathrm{m}^3\).

  • mesh_filepath (Path) – TODO

  • hstart (float | Quantity) – Initial strength of the external field.

  • hfinal (float | Quantity) – Final strength of the external field.

  • hstep (float | Quantity | None) – Step size.

  • hnsteps (int) – Number of steps in the field sweep.

  • outdir (str | Path) – Directory where simulation results are written to.

Returns:

Result object.

Return type:

Result