llg3d.parameters

Parameters for the simulation.

Module Attributes

DRP

Alias for default parameters

arg_parameters

simulation CLI parameters

Functions

lit_to_list(lit)

Convert a Literal type to a list of its possible values.

Classes

ArgParameter

Metadata for a simulation parameter.

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

Store simulation parameters.

class RunParameters(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: object

Store simulation parameters.

Example

>>> params = RunParameters(element="Cobalt", N=1000)
>>> print(params)
element         : Cobalt
N               = 1000
dt              = 1e-14
Jx              = 300
Jy              = 21
Jz              = 21
dx              = 1e-09
T               = 1100
H_ext           = 0.0
init_type       : 0
result_file     : run.npz
start_averaging = 2000
n_mean          = 1
n_profile       = 0
solver          : numpy
precision       : double
blocking        = False
seed            = 12345
device          : auto
profiling       = False
verbosity       : INFO
np              = 1
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)

element: Literal['Cobalt', 'Iron', 'Nickel'] = 'Cobalt'

Chemical element of the sample

N: int = 5000

Number of iterations

dt: float = 1e-14

Time step

Jx: int = 300

Number of points in x

Jy: int = 21

Number of points in y

Jz: int = 21

Number of points in z

dx: float = 1e-09

Step in x

T: float = 0.0

Temperature (K)

H_ext: float = 0.0

External field (A/m)

init_type: Literal['0', 'dw'] = '0'

Initialization type

result_file: str = 'run.npz'

Result file name

start_averaging: int = 4000

Start index of time average

n_mean: int = 1

Spatial average frequency (number of iterations)

n_profile: int = 0

x-profile save frequency (number of iterations)

solver: Literal['opencl', 'mpi', 'numpy', 'jax'] = 'numpy'

Solver to use

precision: Literal['single', 'double'] = 'double'

Precision of the simulation

blocking: bool = False

Use blocking communications

seed: int = 12345

Random seed for temperature fluctuations

profiling: bool = False

Enable profiling output

verbosity: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] = 'INFO'

Logging verbosity level

np: int = 1

Number of processes (for MPI solver)

as_dict()[source]

Convert RunParameters to a dictionary.

Returns:

Dictionary representation of the parameters

Return type:

dict[str, Any]

DRP = RunParameters(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)

Alias for default parameters

class ArgParameter[source]

Bases: TypedDict

Metadata for a simulation parameter.

lit_to_list(lit)[source]

Convert a Literal type to a list of its possible values.

Parameters:

lit (Any) – Literal type

Returns:

List of possible values

Return type:

list[Any]

arg_parameters: dict[str, ArgParameter] = {'H_ext': {'default': 0.0, 'help': 'External field (A/m)'}, 'Jx': {'default': 300, 'help': 'Number of points in x'}, 'Jy': {'default': 21, 'help': 'Number of points in y'}, 'Jz': {'default': 21, 'help': 'Number of points in z'}, 'N': {'default': 5000, 'help': 'Number of time iterations'}, 'T': {'default': 0.0, 'help': 'Temperature (K)'}, 'blocking': {'action': 'store_true', 'default': False, 'help': 'Use blocking communications (MPI solver only)'}, 'device': {'choices': ['cpu', 'gpu', 'auto'], 'default': 'auto', 'help': 'Device to use by the OpenCL solver'}, 'dt': {'default': 1e-14, 'help': 'Time step'}, 'dx': {'default': 1e-09, 'help': 'Step in x'}, 'element': {'choices': ['Cobalt', 'Iron', 'Nickel'], 'default': 'Cobalt', 'help': 'Chemical element of the sample'}, 'init_type': {'choices': ['0', 'dw'], 'default': '0', 'help': "Type of initialization ('0' for uniform, 'dw' for domain wall)"}, 'n_mean': {'default': 1, 'help': 'Spatial average frequency (number of iterations)'}, 'n_profile': {'default': 0, 'help': 'x-profile save frequency (number of iterations)'}, 'precision': {'choices': ['single', 'double'], 'default': 'double', 'help': 'Precision of the floating point (single or double)'}, 'profiling': {'action': 'store_true', 'default': False, 'help': 'Enable profiling output (internal profiler)'}, 'result_file': {'default': 'run.npz', 'help': 'Name of the npz result file'}, 'seed': {'default': 12345, 'help': 'Random seed for temperature fluctuations', 'type': <class 'int'>}, 'solver': {'choices': ['opencl', 'mpi', 'numpy', 'jax'], 'default': 'numpy', 'help': 'Solver to use for the simulation'}, 'start_averaging': {'default': 4000, 'help': 'Start index of time average'}, 'verbosity': {'choices': ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], 'default': 'INFO', 'help': 'Logging verbosity level'}}

simulation CLI parameters