llg3d.solvers.numpy

LLG3D solver using NumPy.

Classes

NumPySolver([element, N, dt, Jx, Jy, Jz, ...])

NumPy-based LLG3D solver.

class NumPySolver(element='Cobalt', N=5000, dt=1e-14, Jx=300, Jy=21, Jz=21, dx=1e-09, T=0.0, H_ext=0.0, init_type='0', result_file='run.npz', start_averaging=4000, n_mean=1, n_profile=0, solver='numpy', precision='double', blocking=False, seed=12345, device='auto', profiling=False, verbosity='INFO', np=1)[source]

Bases: BaseSolver

NumPy-based LLG3D solver.

Parameters:
  • element (Literal['Cobalt', 'Iron', 'Nickel'])

  • N (int)

  • dt (float)

  • Jx (int)

  • Jy (int)

  • Jz (int)

  • dx (float)

  • T (float)

  • H_ext (float)

  • init_type (Literal['0', 'dw'])

  • result_file (str)

  • start_averaging (int)

  • n_mean (int)

  • n_profile (int)

  • solver (Literal['opencl', 'mpi', 'numpy', 'jax'])

  • precision (Literal['single', 'double'])

  • blocking (bool)

  • seed (int)

  • device (Literal['cpu', 'gpu', 'auto'])

  • profiling (bool)

  • verbosity (Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'])

  • np (int)

solver_type: ClassVar[str] = 'numpy'

Solver type name

_laplacian_3d(m_i)[source]

Returns the laplacian of m_i in 3D with Neumann boundary conditions.

Parameters:

m_i (ndarray) – Magnetization direction (shape (nx, ny, nz))

Returns:

Laplacian of m_i (shape (nx, ny, nz))

Return type:

ndarray

_compute_laplacian(m)[source]

Compute the laplacian of m in 3D with Neumann boundary conditions.

Parameters:

m (ndarray) – Magnetization array (shape (3, nx, ny, nz))

Returns:

Laplacian of m (shape (3, nx, ny, nz))

Return type:

ndarray

_compute_slope(m_n, R_random, H_aniso)[source]

Compute the slope of the LLG equation.

Parameters:
  • m_n (ndarray) – Magnetization array at time step n (shape (3, nx, ny, nz)).

  • R_random (ndarray) – Random field array (shape (3, nx, ny, nz)).

  • H_aniso (ndarray) – Optional pre-allocated buffer for anisotropy field.

Returns:

Slope array (shape (3, nx, ny, nz))

Return type:

ndarray

_simulate()[source]

Simulates the system for N iterations.

Returns:

The time taken for the simulation

Return type:

float