REVIEW 4 major objections 5 minor 2 cited by
NeuralMag: an open-source nodal finite-difference code for inverse micromagnetics
T0 review · 4 major / 5 minor · reviewed 2026-08-12 · deepseek-v4-flash
Pith's one-line read NeuralMag's central claim is that a nodal finite-difference scheme can handle material interfaces with finite-element accuracy while keeping finite-difference speed.
desk verdict A genuinely useful open-source micromagnetic code with a real but incremental numerical idea, whose headline accuracy claim over conventional finite difference is asserted rather than demonstrated. read the letter →
The pith
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
The reading
What carries the argument
The load-bearing object is the nodal finite-difference basis: a nodal basis $\phi_n$ of piecewise-linear hat functions on a Cartesian mesh, with support spanning the eight cells around each vertex, paired with piecewise-constant cell basis functions $\vartheta_c = \mathbb{1}_{\Omega_c}$ for material parameters. This choice makes the discretized weak form (17) local and matrix-free: each cell contributes a fixed $24 \times 24$ element matrix, and assembly is a shift-and-add over the local vertex index $i$, so every local field term costs $O(N)$. Mass lumping diagonalizes the mass matrix (each row summed onto the diagonal), avoiding a linear solve for the effective field, and the FFT demagnetization routine is kept by averaging between nodal and cell-centered values.
What would settle it
Compute switching fields for the two-phase domain-wall pinning problem on a sequence of refined grids and compare the error slopes against a high-resolution finite-element reference; if the nodal scheme's error does not decline faster than the cell-centered scheme's, the claimed interface-accuracy advantage is not realized.
Extended reading notes
Core claim
The central contribution is a discretization scheme that merges finite-element variational handling with finite-difference efficiency on a cuboid grid. The magnetization is expanded in piecewise-linear, globally continuous nodal basis functions $\phi_n$, while material parameters such as $M_s$ are piecewise-constant per cell. Local field terms are assembled from the discretized weak form with an element matrix per cell and summed over the eight cells sharing each node, giving $\delta E = \sum_i \delta E^{*i}$; the effective field is obtained by mass lumping, $H_{n,j} = -(\int_\Omega \mu_0 M_s^h \phi_n\,dx)^{-1} \delta E_{n,j}$. The demagnetization field reuses the standard cell-centered FFT convolution through an averaging pre- and post-processing step. The authors validate the scheme against a standard dynamic problem and a two-phase domain-wall pinning problem with discontinuous material parameters, reporting close agreement with reference and analytical switching fields.
Load-bearing premise
The accuracy gain depends on the assumption that the simple averaging step between node-based and cell-based grids for the demagnetization field, and the mass-lumping shortcut in the local field update, do not introduce errors as large as the interface errors the new scheme removes.
Editorial extensions
If this is right
- Material-interface problems such as two-phase domain-wall pinning can be simulated on a regular grid with finite-element-like accuracy at the same asymptotic cost as standard finite differences.
- Thin-film simulations can use 2D basis functions with full 3D integration, cutting the number of degrees of freedom by about half compared with a full 3D nodal grid.
- Time-dependent inverse problems become tractable with a single framework: gradients are computed by one backward adjoint pass whose complexity matches the forward solve.
- The form compiler converts symbolic weak forms into backend tensor operations with no loops or conditionals, so new energy terms can be added without hand-written stencils while remaining just-in-time compilable.
- The just-in-time-compiling backend keeps Python overhead low even for small systems, making the code competitive with optimized GPU implementations.
Reading between the lines
- If the interface-accuracy claim survives a careful convergence study, the same nodal approach could be applied to interfacial Dzyaloshinskii-Moriya or RKKY contributions, where cell-centered finite differences need elaborate boundary corrections.
- The paper's accuracy argument would be strengthened by an error decomposition separating the nodal discretization error from the demagnetization-averaging error; such a decomposition is not reported, but a high-resolution finite-element reference on the two-phase problem would provide it.
- A natural testable extension is to benchmark the adjoint-state gradient against finite differences of the full forward solve on a small time-dependent problem, quantifying the reduced accuracy the paper mentions for the backward reconstruction.
- Because the gradient computation is 'discretize first', the same architecture could be reused for other regular-grid variational PDEs beyond micromagnetics, where interface conditions are also delicate.
Signed reviews
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. NeuralMag is an open-source Python micromagnetic simulation library built on PyTorch and JAX. The paper proposes a nodal finite-difference discretization in which the magnetization is represented by continuous piecewise-linear nodal basis functions on a regular cuboid grid, while material parameters such as Ms are represented as piecewise-constant cell values. Local field terms are assembled from a finite-element weak form with mass lumping, while the demagnetization field is computed with the standard cell-centered FFT convolution plus an averaging pre- and post-processing step between nodal and cell-centered representations. The manuscript also describes a symbolic form compiler, dynamic state attributes, automatic differentiation and adjoint-state methods for inverse problems, two validation cases (MuMag Standard Problem #4 and a domain-wall pinning problem), and a performance benchmark against mumax3 and magnum.np. The central claims are that the nodal scheme provides improved accuracy over traditional finite-difference methods at material interfaces at the same computational complexity, and that NeuralMag is competitive with state-of-the-art micromagnetic codes while enabling convenient inverse-problem workflows.
Significance. If the accuracy claim is substantiated, NeuralMag would be a useful open-source contribution that combines finite-element-like treatment of local interfacial terms with the FFT-based demagnetization computation, and its differentiable-programming design is well suited for inverse magnonics and related optimization problems. The manuscript has clear strengths: the code is publicly available under LGPL, the repository includes CI tests for both backends, the form compiler generates backend-specific tensor code, and the paper states that scripts for the numerical problems and benchmarks are included. However, the central accuracy advantage over conventional finite-difference methods is not currently demonstrated: the demagnetization averaging step is unquantified, the validation cases do not provide a head-to-head error-versus-cell-size comparison with a standard finite-difference code, and the interface test reports only scalar depinning fields. The performance claim is plausible but under-specified, and the inverse-problem demonstration is too simple to validate the adjoint implementation.
major comments (4)
- [Section III B and Section VI.] The abstract and Section III claim improved accuracy over traditional finite-difference methods, but the validation does not establish this claim. The demagnetization field is computed with the standard cell-centered FFT convolution and a 'straightforward pre- and post-processing step' that averages between nodal and cell-centered discretizations (Section III B), and no error analysis or convergence study is provided for this step. Standard Problem #4 (Fig. 5) contains no material interfaces, and the domain-wall pinning test (Table I) compares only scalar depinning fields without a cell-size dependence or a comparison with a conventional cell-centered finite-difference code. Please provide a head-to-head error-versus-cell-size experiment on an interface problem, such as the Heistracher pinning problem, that separates the interface handling from the demagnetization averaging error.
- [Section III A, Eq. (22).] The mass-lumping formula is load-bearing for the local-field accuracy claim, but the manuscript does not quantify how lumping interacts with cell-wise discontinuous Ms at material interfaces. Replacing the consistent mass matrix by the diagonal cell-wise integral changes the effective nodal weight, and when a node support straddles an interface with a jump in Ms, the discretized interface condition depends on this choice. Please provide either an error analysis or a numerical test that isolates the lumping error from the discretization error in a two-phase system.
- [Section VI, Fig. 6.] The performance benchmark reports only the right-hand-side evaluation time for the exchange and demagnetization fields and omits hardware details, GPU model, software versions, and repetition counts. The claim that NeuralMag with the JAX backend is less than a factor of two slower than mumax3 is therefore not reproducible as reported. Please add the missing benchmark specifications and consider reporting end-to-end LLG time-stepping performance.
- [Section VII.] The time-dependent inverse-problem demonstration is a two-parameter single-domain problem and does not validate the adjoint-state gradient implementation. Since Section IV itself notes that the backwards pass reconstructs the magnetization trajectory with reduced accuracy, a gradient check against backpropagation or finite differences, together with a nontrivial example such as distributed material parameters, would substantiate the claim that NeuralMag is well suited for time-dependent inverse problems.
minor comments (5)
- [Section III and Section IX.] The word 'rigoros' appears in the introduction to the nodal finite-difference scheme and in the conclusion; it should be 'rigorous'.
- [Section IV.] The text contains 'minization problem'; this should be 'minimization problem'.
- [Section VI.] The reference to 'Tab. 1 of the original paper' should specify the table and, ideally, include the exact material parameters and field-rate values used for the NeuralMag runs, so the comparison in Table I can be reproduced.
- [Section V A and Listings 1-2.] The manuscript abbreviates the generated code with ellipses; please state explicitly that the listings are shortened excerpts and point to the repository for the complete generated kernels.
- [Section VIII.] The documentation link is given as a bare URL; a versioned citation or a software-archive DOI would make the released version more durable and citable.
Circularity Check
No significant circularity: the nodal finite-difference scheme is derived from the weak form with no fitted parameters, and validation uses external and analytical references.
full rationale
NeuralMag's central discretization is derived explicitly from the weak form (Eqs. 7-22), with basis functions defined in Eqs. 11-12 and no adjustable parameters fitted to the validation targets. The accuracy claims are checked against two references: MuMag Standard Problem #4, an external community standard, and the analytical depinning-field values of Heistracher et al. (2022). The latter is authored by overlapping researchers, but it is an analytical reference rather than a fitted value, and Table I reports errors against it rather than using it to define the method. The demagnetization-field averaging in Section III B is not derived in detail, but it is an implementation choice, not an input that predetermines the reported predictions; the paper does not fit an averaging parameter to benchmark outcomes. The only notable self-citations (mass lumping in Abert 2019, magnum.np, and the pinning standard problem) are used as standard-technique or benchmark references, not as a uniqueness argument that forces the nodal scheme. Thus no step reduces by construction to its own inputs.
Assumptions & free parameters
assumptions (5)
- domain assumption Micromagnetic dynamics follow the Landau-Lifshitz-Gilbert equation with Brown's boundary conditions and the exchange jump condition A1 dm1/dn = A2 dm2/dn.
- domain assumption Magnetization is discretized with continuous piecewise-linear nodal basis functions, while material parameters are piecewise constant per cell.
- domain assumption Mass lumping of the left-hand side of the weak form is valid and does not significantly degrade accuracy.
- domain assumption The demagnetization field can be computed with the standard FFT convolution on cell-centered values, using averaged nodal values as input and output.
- domain assumption For thin films, 2D basis functions that are constant along the thickness, combined with full 3D integration in the weak form, give accurate results.
Cite this review
Pith. "Pith review of NeuralMag: an open-source nodal finite-difference code for inverse micromagnetics." pith.science (2026). https://pith.science/paper/XKKY4WAI
@misc{pith2026241111725,
author = {Pith},
title = {Pith review of: NeuralMag: an open-source nodal finite-difference code for inverse micromagnetics},
year = {2026},
howpublished = {\url{https://pith.science/paper/XKKY4WAI}},
note = {Machine review of arXiv:2411.11725}
}
read the original abstract
We present NeuralMag, a flexible and high-performance open-source Python library for micromagnetic simulations. NeuralMag leverages modern machine learning frameworks, such as PyTorch and JAX, to perform efficient tensor operations on various parallel hardware, including CPUs, GPUs, and TPUs. The library implements a novel nodal finite-difference discretization scheme that provides improved accuracy over traditional finite-difference methods without increasing computational complexity. NeuralMag is particularly well-suited for solving inverse problems, especially those with time-dependent objectives, thanks to its automatic differentiation capabilities. Performance benchmarks show that NeuralMag is competitive with state-of-the-art simulation codes while offering enhanced flexibility through its Python interface and integration with high-level computational backends.
Figures
Figures from the paper (4 more)
Forward citations
Cited by 2 Pith papers
-
Inverse-design topology optimization of magnonic devices using level-set method
A level-set plus adjoint-state optimization framework, implemented in the NeuralMag micromagnetic solver, designs magnonic devices such as a frequency-selective YIG demultiplexer with constant memory cost.
-
Review on spin-wave RF applications
A comprehensive review of spin-wave RF components that concludes YIG-based magnonic devices show strong promise for 5G and 6G communication systems.
Reference graph
Works this paper leans on
-
[1]
author author M. J. \ Donahue \ and\ author D. G. \ Porter ,\ @noop title OOMMF user's guide, version 1.0 , \ ( year 1999 ) NoStop
work page 1999
-
[2]
Fidimag -- a finite difference atomistic and micromagnetic simulation package
author author M.-A. \ Bisotti , author D. Cort \'e s-Ortu \ n o , author R. A. \ Pepper , author W. Wang , author M. Beg , author T. Kluyver ,\ and\ author H. Fangohr ,\ title title Fidimag--a finite difference atomistic and micromagnetic simulation package , \ @noop journal journal arXiv preprint arXiv:2002.04318 \ ( year 2020 ) NoStop
work page Pith review arXiv 2002
-
[3]
author author A. Vansteenkiste , author J. Leliaert , author M. Dvornik , author M. Helsen , author F. Garcia-Sanchez ,\ and\ author B. Van Waeyenberge ,\ title title The design and verification of MuMax3 , \ https://doi.org/10.1063/1.4899186 journal journal AIP Adv. \ volume 4 ( year 2014 ),\ 10.1063/1.4899186 NoStop
-
[4]
author author F. Bruckner , author S. Koraltan , author C. Abert ,\ and\ author D. Suess ,\ title title magnum. np: a pytorch based gpu enhanced finite difference micromagnetic simulation framework for high level development and inverse design , \ @noop journal journal Scientific Reports \ volume 13 ,\ pages 12054 ( year 2023 ) NoStop
work page 2023
-
[5]
author author T. Fischbacher , author M. Franchin , author G. Bordignon ,\ and\ author H. Fangohr ,\ title title A systematic approach to multiphysics extensions of finite-element-based micromagnetic simulations: Nmag , \ @noop journal journal IEEE Transactions on Magnetics \ volume 43 ,\ pages 2896--2898 ( year 2007 ) NoStop
work page 2007
-
[6]
author author A. Kakay , author E. Westphal ,\ and\ author R. Hertel ,\ title title Speedup of fem micromagnetic simulations with graphical processing units , \ @noop journal journal IEEE transactions on magnetics \ volume 46 ,\ pages 2303--2306 ( year 2010 ) NoStop
work page 2010
-
[7]
author author R. Chang , author S. Li , author M. Lubarda , author B. Livshitz ,\ and\ author V. Lomakin ,\ title title Fastmag: Fast micromagnetic simulator for complex magnetic structures , \ @noop journal journal Journal of Applied Physics \ volume 109 ( year 2011 ) NoStop
work page 2011
-
[8]
author author M.-A. \ Bisotti , author M. Beg , author W. Wang , author M. Albert , author D. Chernyshenko , author D. Cort \'e s-Ortu \ n o , author R. A. \ Pepper , author M. Vousden , author R. Carey , author H. Fuchs , et al. ,\ title title Finmag: finite-element micromagnetic simulation tool (version 1.0) , \ @noop journal journal Zenodo \ ( year 201...
work page 2018
Show all 34 references
-
[9]
Abert , author L
author author C. Abert , author L. Exl , author F. Bruckner , author A. Drews ,\ and\ author D. Suess ,\ title title magnum. fe: A micromagnetic finite-element simulation code based on fenics , \ @noop journal journal Journal of Magnetism and Magnetic Materials \ volume 345 ,\...
2013
-
[10]
Bruckner , author C
author author F. Bruckner , author C. Abert , author G. Wautischer , author C. Huber , author C. Vogler , author M. Hinze ,\ and\ author D. Suess ,\ title title Solving large-scale inverse magnetostatic problems using the adjoint method , \ @noop journal journal Scientific rep...
2017
-
[11]
Abert , author C
author author C. Abert , author C. Huber , author F. Bruckner , author C. Vogler , author G. Wautischer ,\ and\ author D. Suess ,\ title title A fast finite-difference algorithm for topology optimization of permanent magnets , \ @noop journal journal Journal of Applied Physics...
2017
-
[12]
Huber , author C
author author C. Huber , author C. Abert , author F. Bruckner , author C. Pfaff , author J. Kriwet , author M. Groenefeld , author I. Teliban , author C. Vogler ,\ and\ author D. Suess ,\ title title Topology optimized and 3d printed polymer-bonded permanent magnets for a pred...
2017
-
[13]
Papp , author W
author author \'A . Papp , author W. Porod ,\ and\ author G. Csaba ,\ title title Nanoscale neural network using non-linear spin-wave interference , \ https://doi.org/10.1038/s41467-021-26711-z journal journal Nat Commun \ volume 12 ,\ pages 6422 ( year 2021 ) NoStop
-
[14]
Wang , author A
author author Q. Wang , author A. V. \ Chumak ,\ and\ author P. Pirro ,\ title title Inverse-design magnonic devices , \ https://doi.org/10.1038/s41467-021-22897-4 journal journal Nat Commun \ volume 12 ,\ pages 2636 ( year 2021 ) NoStop
-
[15]
Yan , author Y
author author Z. Yan , author Y. Xing ,\ and\ author X. Han ,\ title title Inverse design of magnonic filter , \ @noop journal journal Journal of Magnetism and Magnetic Materials \ volume 563 ,\ pages 169976 ( year 2022 ) NoStop
2022
-
[16]
Zenbaa , author C
author author N. Zenbaa , author C. Abert , author F. Majcen , author M. Kerber , author R. Serha , author S. Knauer , author Q. Wang , author T. Schrefl , author D. Suess ,\ and\ author A. Chumak ,\ title title Magnonic inverse-design processor , \ @noop journal journal arXiv...
2024 arXiv
-
[17]
author author W. F. \ Brown Jr ,\ title title Micromagnetics, domains, and resonance , \ @noop journal journal Journal of Applied Physics \ volume 30 ,\ pages S62--S69 ( year 1959 ) NoStop
1959
-
[18]
Abert ,\ title title Micromagnetics and spintronics: Models and numerical methods , \ https://doi.org/10.1140/epjb/e2019-90599-6 journal journal Eur
author author C. Abert ,\ title title Micromagnetics and spintronics: Models and numerical methods , \ https://doi.org/10.1140/epjb/e2019-90599-6 journal journal Eur. Phys. J. B \ volume 92 ,\ pages 1--45 ( year 2019 ) NoStop
2019 doi
-
[19]
author author J. E. \ Miltat \ and\ author M. J. \ Donahue ,\ title title Numerical micromagnetics: Finite difference methods , \ @noop journal journal Handbook of magnetism and advanced magnetic materials \ volume 2 ,\ pages 742--764 ( year 2007 ) NoStop
2007
-
[20]
Schrefl , author G
author author T. Schrefl , author G. Hrkac , author S. Bance , author D. Suess , author O. Ertl ,\ and\ author J. Fidler ,\ title title Numerical micromagnetics (finite element method) , \ @noop journal journal Handbook of magnetism and advanced magnetic materials \ volume 2 ,...
2007
-
[21]
Heistracher , author C
author author P. Heistracher , author C. Abert , author F. Bruckner , author T. Schrefl ,\ and\ author D. Suess ,\ title title Proposal for a micromagnetic standard problem: domain wall pinning at phase boundaries , \ @noop journal journal Journal of Magnetism and Magnetic Mat...
2022
-
[22]
Suess , author S
author author D. Suess , author S. Koraltan , author F. Slanovc , author F. Bruckner ,\ and\ author C. Abert ,\ title title Accurate finite-difference micromagnetics of magnets including rkky interaction: Analytical solution and comparison to standard micromagnetic codes , \ @...
2023
-
[23]
Berkov , author K
author author D. Berkov , author K. Ramst \"o cck ,\ and\ author A. Hubert ,\ title title Solving micromagnetic problems. towards an optimal numerical method , \ @noop journal journal physica status solidi (a) \ volume 137 ,\ pages 207--225 ( year 1993 ) NoStop
1993
-
[24]
Ramst \"o ck , author T
author author K. Ramst \"o ck , author T. Leibl ,\ and\ author A. Hubert ,\ title title Optimizing stray field computations in finite-element micromagnetics , \ @noop journal journal Journal of magnetism and magnetic materials \ volume 135 ,\ pages 97--110 ( year 1994 ) NoStop
1994
-
[25]
Paszke , author S
author author A. Paszke , author S. Gross , author S. Chintala , author G. Chanan , author E. Yang , author Z. DeVito , author Z. Lin , author A. Desmaison , author L. Antiga ,\ and\ author A. Lerer ,\ title title Automatic differentiation in pytorch , \ @noop \ ( year 2017 ) NoStop
2017
-
[26]
author author R. T. \ Chen , author Y. Rubanova , author J. Bettencourt ,\ and\ author D. K. \ Duvenaud ,\ title title Neural ordinary differential equations , \ @noop journal journal Advances in neural information processing systems \ volume 31 ( year 2018 ) NoStop
2018
-
[27]
Paszke , author S
author author A. Paszke , author S. Gross , author F. Massa , author A. Lerer , author J. Bradbury , author G. Chanan , author T. Killeen , author Z. Lin , author N. Gimelshein , author L. Antiga , et al. ,\ title title Pytorch: An imperative style, high-performance deep learn...
2019
-
[28]
Frostig , author M
author author R. Frostig , author M. J. \ Johnson ,\ and\ author C. Leary ,\ title title Compiling machine learning programs via high-level tracing , \ @noop journal journal Systems for Machine Learning \ volume 4 ( year 2018 ) NoStop
2018
-
[29]
Bradbury , author R
author author J. Bradbury , author R. Frostig , author P. Hawkins , author M. J. \ Johnson , author C. Leary , author D. Maclaurin , author G. Necula , author A. Paszke , author J. VanderPlas , author S. Wanderman-Milne , et al. ,\ title title Jax: Autograd and xla , \ @noop j...
2021
-
[30]
Meurer , author C
author author A. Meurer , author C. P. \ Smith , author M. Paprocki , author O. C ert \' k , author S. B. \ Kirpichev , author M. Rocklin , author A. Kumar , author S. Ivanov , author J. K. \ Moore , author S. Singh , et al. ,\ title title Sympy: symbolic computing in python ,...
2017
-
[31]
hey, that's not an ode
author author P. Kidger , author R. T. \ Chen ,\ and\ author T. J. \ Lyons ,\ title title " hey, that's not an ode": Faster ode adjoints via seminorms. \ in\ @noop booktitle ICML \ ( year 2021 )\ pp.\ pages 5443--5452 NoStop
2021
-
[32]
Kidger ,\ title O n N eural D ifferential E quations ,\ @noop Ph.D
author author P. Kidger ,\ title O n N eural D ifferential E quations ,\ @noop Ph.D. thesis ,\ school University of Oxford ( year 2021 ) NoStop
2021
-
[33]
@noop title MAG standard problem \#4 , \ howpublished https://www.ctcms.nist.gov/ rdm/std4/spec4.html ( year 2024 ) NoStop
2024
-
[34]
@noop title Neuralmag: A machine learning framework for micromagnetic simulations , \ howpublished https://gitlab.com/neuralmag/neuralmag ( year 2024 ) NoStop
2024
Reviewed August 12, 2026 · model on record in the stance chip above.
Discussion (0). Continue with ORCID to comment.