LLG Solver#

class neuralmag.LLGSolver(state, scale_t=1e-09, parameters=None, **kwargs)#

Factory method that returns a backend specific time-integrator object for the LLG (either LLGSolverTorch or LLGSolverJAX).

Parameters:
  • state (State) – The state used for the simulation.

  • scale_t (float, optional) – Internal scaling of time to improve numerical behavior.

  • parameters (list) – List of attribute names for the adjoint gradient computation. Only required for optimization problems.

  • **kwargs – Additional backend specific solver options.

Required state attributes

  • state.t – the time in s (scalar)

  • state.h – the effective field in A/m (nodal vector field)

  • state.m – the magnetization (nodal vector field)

Examples

# create state with time and magnetization
state = nm.State(nm.Mesh((10, 10, 10), (1e-9, 1e-9, 1e-9)))
state.t = 0.0
state.m = nm.VectorFunction(state).fill((1, 0, 0))

# register constant Zeeman field as state.h
nm.ExternalField(torch.Tensor((0, 0, 8e5))).register(state, "")

# initialize LLGSolver
llg = LLGSolver(state)

# perform integration step
llg.step(1e-12)