llg3d.solvers.mpi¶
LLG3D solver using MPI.
The parallelization is done in the x direction.
Functions
Initialize MPI variables. |
Classes
|
An argument parser compatible with MPI. |
|
MPI LLG3D solver. |
- class MPISolver(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:
BaseSolverMPI 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] = 'mpi'¶
Solver type name
- _get_boundaries_x(m)[source]¶
Returns the boundaries asynchronously.
Allows overlapping communication time of boundaries with calculations if non-blocking communication is used.
- Parameters:
m (ndarray) – Magnetization array (shape (3, nx, ny, nz))
- Returns:
Start boundary in x direction - m_i_x_end: End boundary in x direction - request_start: Request for start boundary or None - request_end: Request for end boundary or None
- Return type:
m_i_x_start
- _get_boundaries_3d(m)[source]¶
Returns the boundaries for all components.
- Parameters:
m (ndarray) – Magnetization array (shape (3, nx, ny, nz))
- Returns:
Boundaries for all three components
- Return type:
tuple[tuple[ndarray, ndarray, Request | None, Request | None], tuple[ndarray, ndarray, Request | None, Request | None], tuple[ndarray, ndarray, Request | None, Request | None]]
- laplacian_3d(m_i, m_i_x_start, m_i_x_end, request_start, request_end)[source]¶
Returns the Laplacian of m_i in 3D.
We start by calculating contributions in y and z, to wait for the end of communications in x.
- Parameters:
m_i (ndarray) – i-component of the magnetization array (shape (nx, ny, nz))
m_i_x_start (ndarray) – start boundary in x direction
m_i_x_end (ndarray) – end boundary in x direction
request_start (Request | None) – request for start boundary
request_end (Request | None) – request for end boundary
- Returns:
Laplacian of m_i (shape (nx, ny, nz))
- Return type:
ndarray
- compute_laplacian(m, boundaries)[source]¶
Compute the laplacian of m in 3D.
- Parameters:
m (ndarray) – Magnetization array (shape (3, nx, ny, nz))
boundaries (tuple[tuple[ndarray, ndarray, Request | None, Request | None], tuple[ndarray, ndarray, Request | None, Request | None], tuple[ndarray, ndarray, Request | None, Request | None]]) – Boundaries for x direction
- Returns:
Laplacian of m (shape (3, nx, ny, nz))
- Return type:
ndarray
- compute_slope(m, R_random, H_aniso, boundaries)[source]¶
Compute the slope of the LLG equation.
- Parameters:
m (ndarray) – Magnetization array (shape (3, nx, ny, nz))
R_random (ndarray) – Random field array (shape (3, nx, ny, nz))
H_aniso (ndarray) – Pre-allocated buffer for anisotropy field.
boundaries (tuple[tuple[ndarray, ndarray, Request | None, Request | None], tuple[ndarray, ndarray, Request | None, Request | None], tuple[ndarray, ndarray, Request | None, Request | None]]) – Boundaries for x direction
- Returns:
Slope array (shape (3, nx, ny, nz))
- Return type:
ndarray
- _xyz_average(m)[source]¶
Returns the spatial average of m with shape (g.dims) using the midpoint method.
Performs the local sum on each process and then reduces it to process 0.
- Parameters:
m (ndarray) – Array to be integrated (shape (x, y, z))
- Returns:
Spatial average of m
- Return type:
float
- _yz_average(m_i)[source]¶
Compute the integral of m_i over y and z directions.
Gather the local profiles from all processes to form the global profile.
- Parameters:
m_i (ndarray) – Magnetization component array (shape (nx, ny, nz))
- Returns:
1D array of the integral over y and z (shape (nx,))
- Return type:
ndarray
- class ArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]¶
Bases:
ArgumentParserAn argument parser compatible with MPI.