llg3d.solvers.base¶
Define the base solver class.
Classes
|
Abstract data base class for LLG3D solvers. |
- class BaseSolver(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:
ABC,RunParametersAbstract data base class for LLG3D solvers.
- 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)
- metrics¶
Dictionary to store performance metrics of the simulation.
- observables¶
Dictionary to store physical observables computed during the simulation.
- records¶
Dictionary to store time series data recorded during the simulation, such as x profiles and time averages.
- np¶
Number of processes (for MPI simulations).
- Type:
int
- np_float¶
Numpy dtype for floating point calculations (float32 or float64).
- grid¶
Grid object representing the simulation domain and discretization.
- elem¶
Element object containing the physical parameters and methods for the LLG equation.
- rng¶
Random number generator for temperature fluctuations.
- profiling_stats¶
Profiling stats for kernels and functions, filled during the simulation if profiling is enabled.
- solver_type: ClassVar[str] = 'base'¶
Solver type name
- theta_init_dw(t)[source]¶
Initialization of theta with a domain wall profile.
- Parameters:
t (float)
- Return type:
ndarray
- _init_rng()[source]¶
Initialize a random number generator for temperature fluctuations.
- Returns:
A numpy random number generator
- Return type:
Generator
- _get_R_random()[source]¶
Generate the random field for temperature fluctuations.
- Returns:
Random field array (shape (3, nx, ny, nz))
- Return type:
ndarray
- _normalize(m_n)[source]¶
Normalize the magnetization array (in place).
\[\mathbf{m}_n = \frac{\mathbf{m}_n}{|\mathbf{m}_n|}\]- Parameters:
m_n (ndarray) – Magnetization array at time step n (shape (3, nx, ny, nz)).
- Return type:
None
- _xyz_average(m)[source]¶
Returns the spatial average of m with shape (g.dims) using the midpoint method.
- Parameters:
m (ndarray) – Array to be integrated
- Returns:
Spatial average of m
- Return type:
float
- _record_xyz_average(m_n, t, n)[source]¶
Update the time average of m1.
- Parameters:
m_n (ndarray)
t (float)
n (int)
- Return type:
None
- _finalize()[source]¶
Normalize m1_mean by the actual number of samples accumulated.
- Return type:
None
- _yz_average(m_i)[source]¶
Returns the spatial average of m using the midpoint method along y and z.
- Parameters:
m_i (ndarray) – Array to be integrated
- Returns:
Spatial average of m in y and z of shape (g.dims[0],)
- Return type:
ndarray
- _update_x_profiles(m_n, t)[source]¶
Update x profiles of the averaged m_i in y and z.
- Parameters:
m_n (ndarray)
t (float)
- Return type:
None
- _record(m_n, t, n)[source]¶
Record simulation data.
- Parameters:
m_n (Any)
t (float)
n (int)
- Return type:
None