CuPyMag: GPU-Accelerated Finite-Element Micromagnetics with Magnetostriction
arXiv:2510.09812 · doi:10.1016/j.cpc.2026.110093
Abstract
We introduce CuPyMag, an open-source, Python-based framework for large-scale micromagnetic simulations with magnetostriction. CuPyMag solves micromagnetics with finite elements in a GPU-resident workflow in which key operations, such as right-hand-side assembly, spatial derivatives, and volume averages, are tensorized using CuPy's BLAS-accelerated backend. Benchmark tests show that the GPU solvers in CuPyMag achieve a speedup of up to two orders of magnitude compared to the CPU codes. Its runtime grows linearly/sublinearly with problem size, demonstrating high efficiency. Additionally, CuPyMag uses the Gauss-Seidel projection method for time integration, which not only allows stable time steps (up to 11 ps) but also solves each governing equation with only 1-3 conjugate-gradient iterations without preconditioning. CuPyMag accounts for magnetoelastic coupling and far-field effects arising from the boundary of the magnetic body, both of which play an important role in magnetization reversal in the presence of local defects. CuPyMag solves these computationally intensive multiphysics simulations with a high-resolution mesh (up to 3M nodes) in under three hours on an NVIDIA H200 GPU. This acceleration enables micromagnetic simulations with non-trivial defect geometries and resolves nanoscale magnetic structures. It expands the scope of micromagnetic simulations towards realistic, large-scale problems that can guide experiments. More broadly, CuPyMag is developed using widely adopted Python libraries, which provide cross-platform compatibility, ease of installation, and accessibility for adaptations to diverse applications.
References in corpus (16)
- The design and verification of Mumax3
- A mechanically strong and ductile soft magnet with extremely low coercivity
- An Introduction to Spin Wave Computing
- Accelerating computational materials discovery with artificial intelligence and cloud high-performance computing: from large-scale screening to experimental validation
- Magnetic domains and domain wall pinning in two-dimensional ferromagnets revealed by nanoscale imaging
- Micromagnetics of rare-earth efficient permanent magnets
- magnum.fe: A micromagnetic finite-element simulation code based on FEniCS
- Influence of defect thickness on the angular dependence of coercivity in rare-earth permanent magnets
- Numerical integration on GPUs for higher order finite elements
- Finite Element Integration on GPUs
- GPU-accelerated micromagnetic simulations using cloud computing
- Numerical micromagnetism of strong inhomogeneities
- Giant tunability of magnetoelasticity in FeN system: Platform for unveiling correlation between magnetostriction and magnetic damping
- Micromagnetic Simulations Study of Skyrmions in Magnetic FePt Nanoelements
- NeuralMag: an open-source nodal finite-difference code for inverse micromagnetics
- Distributed and heterogeneous tensor-vector contraction algorithms for high performance computing