llg3d.llg3d

Solver for the stochastic Landau-Lifshitz-Gilbert equation in 3D

Functions

calculate_laplacian(e, g, m, m_start_x, ...)

Returns the Laplacian of m (* coeff_1) in 3D.

calculate_si(e, g, m1, m2, m3, R_alea, ...)

Returns the s_i = a_i + b_i

get_boundaries_x(g, m[, blocking])

Returns the boundaries asynchronously: allows overlapping communication time of boundaries with calculations

get_element_class(element_name)

Returns the chemical element class from its name

integral(g, m)

Returns the spatial average of m of shape (g.dims) using the midpoint method on each process

integral_yz(m)

Returns the spatial average of shape (g.dims[0],) in y and z of m of shape (g.dims) using the midpoint method

main([args_main])

Evaluates the command line and runs the simulation

parameter_list(d)

Returns parameter values as a string

parse_args(args)

Argument parser for llg3d

phi_init(t, g, e)

Initialization of phi

profile(m, m_xprof)

Retrieves the x profile of the average of m in y and z

progress_bar(rank, it[, prefix, size, out])

Displays a progress bar (Source: https://stackoverflow.com/a/34482761/16593179)

simulate(N, Jx, Jy, Jz, dx, T, H_ext, dt, ...)

Simulates the system for N iterations Returns the computation time, output filename and the temporal average

simulate_temperature(params)

Runs a simulation for a given parameter set.

temperature_variation(params)

Sweeps an array of temperature

theta_init(t, g)

Initialization of theta

write_json(run)

Writes the run dictionary to a JSON file

Classes

ArgumentParser([prog, usage, description, ...])

An argument parser compatible with MPI

Cobalt(T, H_ext, g, dt)

Element(T, H_ext, g, dt)

Abstract class for chemical elements

Grid(Jx, Jy, Jz, dx)

Stores grid data

Iron(T, H_ext, g, dt)

Nickel(T, H_ext, g, dt)

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: ArgumentParser

An argument parser compatible with MPI

class Cobalt(T: float, H_ext: float, g: Grid, dt: float)[source]

Bases: Element

class Element(T: float, H_ext: float, g: Grid, dt: float)[source]

Bases: object

Abstract class for chemical elements

__init__(T: float, H_ext: float, g: Grid, dt: float) None[source]
class Grid(Jx: int, Jy: int, Jz: int, dx: float)[source]

Bases: object

Stores grid data

__init__(Jx: int, Jy: int, Jz: int, dx: float) None
get_filename(T: float, name: str = 'm1_integral_space', extension='txt') str[source]

Returns the output file name for a given temperature

>>> g = Grid(Jx=300, Jy=21, Jz=21, dx=1.e-9)
>>> g.get_filename(1100)
'm1_integral_space_T1100_300x21x21_np<MPI_size>.txt'
get_mesh(loc: bool = True) list[source]

Returns a list of 3D arrays with the coordinates of the grid points

Parameters:

loc – if True, returns the local coordinates, otherwise the global coordinates

class Iron(T: float, H_ext: float, g: Grid, dt: float)[source]

Bases: Element

class Nickel(T: float, H_ext: float, g: Grid, dt: float)[source]

Bases: Element

calculate_laplacian(e: Element, g: Grid, m: ndarray, m_start_x: ndarray, m_end_x: ndarray, request_end: Request, request_start: Request) ndarray[source]

Returns the Laplacian of m (* coeff_1) in 3D. We start by calculating contributions in y and z, to wait for the end of communications in x.

calculate_si(e: Element, g: Grid, m1: ndarray, m2: ndarray, m3: ndarray, R_alea: ndarray, boundaries) tuple[ndarray, ndarray, ndarray][source]

Returns the s_i = a_i + b_i

get_boundaries_x(g: Grid, m, blocking: bool = False) tuple[ndarray, ndarray, Request, Request][source]

Returns the boundaries asynchronously: allows overlapping communication time of boundaries with calculations

get_element_class(element_name: str)[source]

Returns the chemical element class from its name

integral(g, m: ndarray) float[source]

Returns the spatial average of m of shape (g.dims) using the midpoint method on each process

integral_yz(m: ndarray) ndarray[source]

Returns the spatial average of shape (g.dims[0],) in y and z of m of shape (g.dims) using the midpoint method

main(args_main=None)[source]

Evaluates the command line and runs the simulation

parameter_list(d: dict) str[source]

Returns parameter values as a string

parse_args(args) Namespace[source]

Argument parser for llg3d

phi_init(t: float, g: Grid, e: Element) ndarray[source]

Initialization of phi

profile(m: ndarray, m_xprof: ndarray)[source]

Retrieves the x profile of the average of m in y and z

progress_bar(rank: int, it, prefix='', size=60, out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Displays a progress bar (Source: https://stackoverflow.com/a/34482761/16593179)

simulate(N: int, Jx: int, Jy: int, Jz: int, dx: float, T: float, H_ext: float, dt: float, n_average: int, n_integral: int, n_profile: int, element: ~llg3d.llg3d.Element = <class 'llg3d.llg3d.Cobalt'>, blocking: bool = False)[source]

Simulates the system for N iterations Returns the computation time, output filename and the temporal average

simulate_temperature(params: dict) dict[source]

Runs a simulation for a given parameter set. Returns a dictionary of the run.

temperature_variation(params: dict)[source]

Sweeps an array of temperature

theta_init(t: float, g: Grid) ndarray[source]

Initialization of theta

write_json(run: dict)[source]

Writes the run dictionary to a JSON file