llg3d.solvers

Define various types of solvers.

Example

To initialize one of the solver classes:

>>> from llg3d.parameters import RunParameters
>>> from llg3d.solvers.numpy import NumPySolver
>>> solver = NumPySolver(**RunParameters(solver="numpy").as_dict())

Functions

get_rank()

Return the rank of the current MPI process.

get_size()

Return the number of parallel MPI processes.

get_solver_class(solver_name)

Get the solver class based on the solver name.

get_size()[source]

Return the number of parallel MPI processes.

Use environment variables to avoid initializing MPI unnecessarily.

Returns:

Number of MPI processes if in an MPI environment, else 1.

Return type:

int

get_rank()[source]

Return the rank of the current MPI process.

Use environment variables to avoid initializing MPI unnecessarily.

Returns:

Rank of the current MPI process if in an MPI environment, else 0.

Return type:

int

get_solver_class(solver_name)[source]

Get the solver class based on the solver name.

Parameters:

solver_name (str) – Name of the solver (“mpi”, “numpy”, “opencl”, “jax”)

Returns:

The solver class

Raises:

ValueError – If the selected solver is not compatible with MPI or if the solver name is unknown

Return type:

type[BaseSolver]

Example

>>> Solver = get_solver_class("numpy")
>>> Solver.__name__
"NumPySolver"

Modules

base

Define the base solver class.

experimental

Experimental solvers live here.

math_utils

Mathematical utility functions for solvers.

mpi

LLG3D solver using MPI.

numpy

LLG3D solver using NumPy.

opencl

LLG3D solver using OpenCL.

profiling

Profiling utilities for solvers.