# Topological characterization of Hopfions in finite-element micromagnetics

Louis Gallard, Riccardo Hertel

<figure><img src="image_1.png" /></figure>

## To cite this version:

Louis Gallard, Riccardo Hertel. Topological characterization of Hopfions in finite-element micromagnetics. Journal of Applied Physics, 2025, 138 (4), pp.043907. 10.1063/5.0280041. hal-05228350

HAL Id: hal-05228350

https://cnrs.hal.science/hal-05228350v1

Submitted on 28 Aug 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Topological characterization of Hopfions in finite-element micromagnetics

Louis Gallard¹ and Riccardo Hertel¹, a)

Université de Strasbourg, CNRS, Institut de Physique et Chimie des Matériaux de Strasbourg, F-67000 Strasbourg, France

Topological magnetic structures, such as Hopfions, are central to three-dimensional magnetism, but their characterization in complex geometries remains challenging. We introduce a robust finite-element method for calculating the Hopf index in micromagnetic simulations of three-dimensional nanostructures. By employing the Biot-Savart form for the vector potential, our approach ensures gauge-invariant results, even in multiply connected geometries like tori. A novel variance-based correction scheme significantly reduces numerical errors in highly inhomogeneous textures, achieving accurate Hopf index values with fast mesh-dependent convergence. We validate the method using an analytically defined Hopfion structure and demonstrate its ability to detect topological transitions through a simulation of a Hopfion's field-induced destruction into a toron, marked by an abrupt change in the Hopf index. This method enables precise quantification of topological features in complex three-dimensional magnetic textures forming in finite-element micromagnetic simulations, offering a powerful tool for advancing topological magnetism studies in general geometries.

## I. INTRODUCTION

Over the past years, research in magnetism has seen remarkable progress in three-dimensional (3D) nanomagnetism¹ in terms of nanofabrication, imaging techniques², and simulation capabilities³,⁴. The intense scientific activity in this domain marks a clear departure from previous extensive studies in magnetism centered on investigating thin and ultrathin magnetic films⁵. In addition to sparking growing interest in the magnetic properties of nanostructures featuring complex 3D geometries⁶,⁷, the recently gained access to the third dimension⁸ has fueled research on characteristic 3D magnetic textures absent in thin-film geometries, like skyrmion tubes⁹, Bloch points¹⁰ (including variants thereof—such as torons¹¹ or chiral bobbers¹²), or Hopfions¹³⁻¹⁵. The latter are remarkably complex textures exhibiting knots in the magnetization vector field. Hopfions have recently received considerable attention due to their intriguing properties and their possible use in future spintronic devices¹⁶.

Micromagnetic simulations play a crucial role in developing a thorough understanding of these topological textures, which are vastly underexplored compared to skyrmions that can be considered to be their two-dimensional (2D) counterparts. Specifically, finite-element micromagnetic simulations are essential in numerical studies, since the method allows for accurate consideration of details of the 3D sample geometry, including curved and oblique surfaces, which are inherently problematic in the case of finite-difference methods¹⁷. Hopfions, like skyrmions, are topologically protected magnetization structures of nanometric size with particle-like properties. In contrast to 2D topological magnetic textures, such as vortices or skyrmions, which are easily identifiable in magnetic configurations, Hopfions are challenging to detect due to their complex 3D knotted

vector field distribution embedded within the magnetic volume. Even in micromagnetic simulations, where magnetic structure data is readily accessible and vector field visualization is straightforward, unambiguously identifying Hopfions remains difficult.

A reliable means to quantitatively detect Hopfions in micromagnetically simulated 3D textures consists in determining the Hopf index, a topological invariant¹⁸⁻²¹. Numerically calculating this invariant can entail various complications and pitfalls regarding accuracy, efficiency, and gauge invariance. In this article, we present the implementation of a flexible and robust finite-element algorithm to calculate the Hopf index. Particular attention is paid to the question of gauge invariance of the computed values. We critically discuss aspects of numerical accuracy when calculating the Hopf index and introduce an efficient method to minimize discretization errors. Finally, we present an application example of the method to monitor magnetic Hopfions in simulations.

## II. HOPF INVARIANT

The Hopf index is a topological invariant that belongs to the homotopy group $\pi_3(S^2)$. It has a non-zero integer value for Hopfions and can be calculated through Whitehead's formula¹⁸.

$$N = - \int \mathbf{J} \cdot \mathbf{A} \, dV, \qquad (1)$$

where $\mathbf{A}$ is a vector potential satisfying

$$\nabla \times \mathbf{A} = \mathbf{J}. \qquad (2)$$

The vector $\mathbf{J}$ is defined through the normalized magnetization $m = M/|M|$ according to

$$J_i = \frac{1}{8\pi} \epsilon_{ijk} m \cdot \left( \frac{\partial m}{\partial x_j} \times \frac{\partial m}{\partial x_k} \right) \qquad (3)$$

<footnote>a) Electronic mail: riccardo.hertel@ipcms.unistra.fr</footnote>
Various terminologies are used throughout the literature to refer to the vector field **J** or variants thereof, including *emergent field*<sup>22,23</sup>, *vorticity*<sup>24</sup>, or *gyrovector*<sup>14,25</sup>. In the present study, we adopt the term *topological current*<sup>20,26</sup> for **J**. Importantly, the topological current **J** is divergence-free<sup>27</sup> for any smooth magnetic texture of the unit vector field **m**<sup>24,26</sup>.

In addition to the integral definition of eq. (1), the Hopf index has a topological interpretation<sup>28</sup> as the linking number of the preimages (regions within the domain in which the field has the same orientation) of two arbitrary points of S<sup>2</sup>, i.e., the sphere representing the vector field's parameter space<sup>29</sup>. Hopfions have closed-loop preimages that are characteristically linked to each other, resulting in knotted field lines. The formalism related to the Hopf invariant is broadly applied to categorize knotted textures of vector fields in liquid crystals<sup>30</sup> and ferroic materials<sup>23,31,32</sup>. More generally, the analysis of knotted fields finds application in a remarkably large variety of disciplines<sup>33</sup>, including plasma physics<sup>34</sup>, hydrodynamics<sup>35</sup>, photonics<sup>36,37</sup>, and quantum field theory<sup>38,39</sup>.

To represent a physically meaningful quantity, the Hopf index (1) must be gauge invariant, i.e., remain unchanged under a transformation $A \rightarrow A + \nabla \chi$. Given the explicit appearance of the vector potential $A$ in the integrand of equation (1), the invariance of the Hopf index is not immediately apparent. Indeed, the topological charge density $\rho_H = J \cdot A$ is not uniquely determined due to its lack of gauge invariance<sup>21</sup>. Nevertheless, in many cases, the Hopf index according to eq. (1) is gauge invariant. The necessary conditions for this are that the domain $\Omega$ over which the integral extends is singly-connected<sup>35,40,41</sup> and that the topological current **J** is either zero or tangential to the integration region's surface $\partial\Omega$, i.e. $n \cdot J = 0$, where $n$ is the surface normal vector<sup>40</sup>.

The case of multiply connected geometries, such as a torus, has been discussed in the context of helicity in magnetohydrodynamics<sup>33,42,43</sup>. In multiply connected domains, the condition $J \cdot n = 0$ is not sufficient to enforce gauge-invariant results, due to the possible presence of nontrivial harmonic vector fields that are divergence- and curl-free but not gradient fields. It was recently shown<sup>42</sup> that additional line integrals along closed paths on the surface $\partial\Omega$ are required to render the Hopf index gauge invariant. The “Biot-Savart helicity” plays an important role in this context, where the vector potential $A$ is calculated through the Biot-Savart operator:

$$A(r) = \nabla \times \frac{1}{4\pi} \int \frac{J(r')}{|r - r'|} dV' \quad (4)$$

When the Hopf index, as defined in eq. (1), is calculated using a vector potential $A$ derived in this manner, it is equivalent to the gauge-invariant form. This form eliminates the need for the additional line integrals in multiply connected geometries since the Biot-Savart integral ensures that the vector potential decays appropriately at

infinity and that no harmonic contributions remain. In this formalism, the gauge is chosen such that the potential satisfies $\nabla \cdot A = 0$ and $|A|$ vanishes at infinity. Here, the vector potential $A$ is linked to the topological current **J** in a manner analogous to a magnetic field generated by an electric current density distribution $j$, thus establishing a formal analogy between topological and electrical currents<sup>44</sup>.

### III. METHOD

We use a custom-developed finite-element method (FEM) software to numerically compute the Hopf index in 3D ferromagnetic nanostructures of arbitrary shape. The domain $\Omega$, encompassing the entire volume $V$ of the nanostructure, is discretized into tetrahedral simplex elements. The magnetization vector field is defined at the nodes and interpolated within each element to obtain a piecewise linear representation.

To calculate the Hopf index, we first compute the topological current as defined in Eq. (3). Within each element, first-order spatial derivatives of the discretized magnetization vector field are calculated using linear shape functions, yielding piecewise constant derivative values. At the nodes, the derivative is approximated by a volume-weighted average of the derivatives from all adjacent elements. This approach corresponds to a mass-lumped representation of the weak form for the first derivative.

For the calculation of the vector potential $A$, we adopt the Biot-Savart form described in Eq. (4). However, direct integration of this equation is computationally inefficient due to the twofold volume integral required across the domain $\Omega$. Instead, we solve an equivalent set of partial differential equations derived by taking the curl of Eq. (2) and enforcing the Coulomb gauge $\nabla \cdot A = 0$, yielding the Poisson equation:<sup>20</sup>

$$\Delta A = -\nabla \times J \quad (5)$$

In a component-wise representation, the three differential equations can be written as

$$\Delta A_i = \nabla \cdot (e_i \times J), \quad i = x, y, z \quad (6)$$

where $e_i$ is the Cartesian unit vector along the $i$-direction. At the domain boundary $\partial\Omega$, the following jump condition applies:

$$(n \cdot \nabla)A_{\text{in}} - (n \cdot \nabla)A_{\text{out}} = J \times n \quad (7)$$

where $n$ is the outward oriented surface normal vector and $A_{\text{in}}$, $A_{\text{out}}$ are the inward and outward limit values of the vector potential at the surface $\partial\Omega$. We further consider the condition that the potential $A$ decays at infinity:

$$\lim_{|x| \to \infty} A(x) = 0 \quad (8)$$
Equations (5), (7), and (8), combined with the Coulomb gauge $\nabla \cdot \mathbf{A} = 0$, make the problem formally analogous to the Oersted field calculation for a current-carrying conductor. We can, in fact, use precisely the methods described in Ref. 45 by replacing $\mathbf{H} \rightarrow \mathbf{A}$ and $\mathbf{j} \rightarrow \mathbf{J}$. Specifically, by applying these methods, we solve the open-boundary problem of Eq. (5) with a hybrid finite-element/boundary-element (FEM/BEM) algorithm implementing the methodology 46 described by Fredkin and Koehler 45,47. The method solves Eq. (5) in the magnetic region $\Omega$ and accounts for the boundary conditions (7) and (8). In our implementation, the boundary integral of the BEM part is numerically computed using H2-type hierarchical matrices, as described in Ref. 48. The Poisson equations (6) are solved using an algebraic multigrid method with GPU (graphical processing unit) acceleration 49. Once the vector potential $\mathbf{A}$ and the topological current $\mathbf{J}$ are computed at each discretization point, the numerical integration over the domain $\Omega$, as described on the right-hand side of Eq. (1), is straightforward.

## IV. ANALYTIC FORM OF A HOPFION TEXTURE

To validate our method and demonstrate its efficiency, we apply it to an idealized Hopfion structure, defined analytically by a set of equations and parameters. The following ansatz defines a Hopfion in an $xy$-torus of major radius $r_{maj}$ and minor radius $r_{min}$.

$$m_x = \sin \left( \pi \frac{\rho}{r_{min}} \right) \cos (v\theta - u\phi + \alpha) \quad (9)$$

$$m_y = \sin \left( \pi \frac{\rho}{r_{min}} \right) \sin (v\theta - u\phi + \alpha) \quad (10)$$

$$m_z = m_0 \cos \left( \pi \frac{\rho}{r_{min}} \right) \quad (11)$$

with

$$\rho = \sqrt{z^2 + (\sqrt{x^2 + y^2} - r_{maj})^2} \quad (12)$$

$$\theta = \arctan(y/x) \quad (13)$$

$$\phi = \arctan \left( \frac{z}{\sqrt{x^2 + y^2} - r_{maj}} \right) \quad (14)$$

Here, $m_0$ defines the magnetization at the Hopfion's core ($\rho = 0$), where $m_z(\rho = 0) = m_0$, and at the torus surface ($\rho = r_{min}$), where $m_z(\rho = r_{min}) = -m_0$. Fig. 1 provides a schematic representation of the variables used in Eqs. (9)-(11).

Notably, while the inhomogeneous region of the magnetization is confined within the volume of the torus defined by $r_{maj}$ and $r_{min}$, the torus surface does not necessarily represent the physical boundary of the magnetic nanostructure. The magnetic texture described by this ansatz

<figure><img src="image_3.png" /><figcaption>FIG. 1. Schematic representation of the parameters and variables used in the analytic Hopfion configuration, showing how the position of a point P in the torus is defined through the coordinates $\theta, \rho$, and $\phi$.</figcaption></figure>

can be embedded into a homogeneous background magnetization in the $z$ direction with $m_z = -m_0$. In this case, the topological charge has compact support, meaning the topological features and the topological current $\mathbf{J}$ are confined within the torus and vanish outside.

The analytic construction defined in Eqs. (9)-(11) generates a toroidal Hopfion configuration whose magnetization texture features closed, mutually linked preimages – a hallmark of Hopf mappings. The use of toroidal coordinates reflects the geometry of the confinement, and the angular dependence $v\theta - u\phi$, combined with a smooth radial modulation, ensures that the field lies in the same homotopy class as the standard Hopf map $\pi : S^3 \rightarrow S^2$. Similar ansatzes have been employed in field-theoretical models, such as those introduced by Faddeev and Niemi$^{50}$, and are widely used in numerical studies to capture the topological linking structure of Hopfions.

The parameters $u$ and $v$ are integer numbers determining the Hopfion's chirality and order, with their values directly affecting the degree of winding, which is correlated with the Hopf index via $N_H = uv$, consistent with results reported in Ref. 51. Their impact on the vector field topology will be discussed below, in section VI. Setting $u = v = 1$, the magnetic configuration is axially symmetric, with each poloidal cross-section (along the meridional plane) exhibiting a bimeron structure, i.e., a vortex-antivortex pair with opposite core polarizations$^{16}$. In Eqs. (9)-(11), the parameter $\alpha$ introduces an additional phase for the in-plane magnetization components, allowing variation in the bimeron's orientation across cross-sections.

The characteristic toroidal $m_z$ isosurfaces composed of linked preimages displayed in Fig. 2 visually confirm that this analytic ansatz produces a magnetic texture with the defining features of a Hopfion.

## V. NUMERICAL RESULTS

To test its correctness and accuracy, we apply the method described in section III and determine numerically the Hopf index of the analytically defined texture. With this model system, we expect to obtain a value close
<figure><img src="image_4.png" /><figcaption>FIG. 2. Magnetic texture defined by Eqs. (9)-(11) in a cylinder of height $h = 100$ and radius $r = 100$, using $\alpha = \pi/2$, $m_0 = -1$, $u = 1$, $v = 1$, $r_{maj} = 50$ and $r_{min} = 45$. (a) Magnetization distribution on a cutplane at $x = 0$. In this streamline representation, the circular structures are magnetic vortices and the intersecting regions antivortices. The color code refers to the $x$ component, i.e., to the magnetization perpendicular to the cutplane. (b) Perspective view on the toroidal-shaped nested set of $m_z$ isosurfaces, ranging from $m_z = -0.9$ to $m_z = 0.9$ by steps of 0.2, sectioned along the $xz$-plane to reveal the internal structure. (c) Two intertwined preimages, $m_y = 1$ (red) and $m_y = -1$ (blue) which both belong to the $m_z = 0$ isosurface.</figcaption></figure>

to unity in accordance with the topological characteristics of the Hopfion. Using Eqs. (9)-(11), we imprint the magnetic texture in a cylindrical geometry as illustrated in Fig. 2. The computed Hopf index is presented in Fig. 3 as a function of the number of finite elements used in the calculation.

<figure><img src="image_5.png" /><figcaption>FIG. 3. Calculated Hopf index for a cylinder and a torus geometry (see main text for details) as a function of the number of finite elements. In both cases, the expected value (dashed horizontal line) is reached asymptotically with increasing levels of discretization.</figcaption></figure>

The ideal value $N = 1.0$ is approached asymptotically as the number of elements increases. We observe this type of mesh-dependent convergence consistently across various shapes and geometries. For comparison, Fig. 3 also displays data for the analytic Hopfion defined in a torus geometry with $r_{maj} = 150$ and $r_{min} = 60$, demonstrating equivalent results for different sample shapes and confirming the method's ability to handle arbitrarily

shaped 3D geometries. In the remainder of this section, we focus exclusively on data for the cylinder geometry. While these results confirm the method's overall correctness, they also highlight non-negligible numerical errors at low discretization levels and a sensitive dependence on the discretization density. A similar behavior was reported by Liu et al.²², despite using an entirely different numerical scheme. These numerical inaccuracies can be problematic in the case of strong inhomogeneities, where they may preclude the precise quantitative identification of a texture's topological characteristics if the calculated Hopf index deviates too far from an integer value.

A primary source for the discretization errors is the numerical calculation of the topological current $J$ as defined in Eq. (3) since it involves several products of various spatial derivatives. Further numerical errors accumulate as $J$ is differentiated numerically on the right-hand side of the Poisson equation (5). In the context of the numerical analysis of the topological properties of Skyrmions, Kim et al.⁵² introduced an elegant and efficient method to numerically determine the topological current with significantly higher accuracy by employing a lattice-based approach. In a recent article, Knapman et al.⁵³ demonstrated that this lattice-based method results in highly accurate numerical results for the case of Hopfions, too. The lattice-based approach, however, requires a coplanar distribution of discretization points—a criterion fulfilled in the case of finite-difference methods but inapplicable to finite-element methods, as discussed here, which use irregular discretization cells.

To improve the numerical accuracy of our FEM approach, we employ a phenomenological a posteriori error correction scheme. This scheme is based on two observations we made consistently by studying a wide variety of situations. Firstly, the effect of the error is to systematically underestimate the absolute value of the Hopf index. Such behavior is easier to correct than stochastic fluctuations of the computed values around the exact ones. Secondly, we observe a clear correlation between the size of the error and the variance of the magnetization, as shown in Fig. 4.

Here, the variance is defined element-wise and provides a measure of the misalignment of neighboring magnetic moments. For each tetrahedral element $n$ with its four nodes $i = 1...4$, we can define the variance through

$$ \sigma_n^2 = \sum_{j=x,y,z} \langle m_j^2 \rangle - \langle m_j \rangle^2 \quad (15) $$

$$ = \sum_{j=x,y,z} \left[ \sum_{i=1}^{4} \frac{m_{i,j}^2}{4} - \left( \sum_{i=1}^{4} \frac{m_{i,j}}{4} \right)^2 \right] , \quad (16) $$

$$ = 1 - \sum_{j=x,y,z} \left[ \left( \sum_{i=1}^{4} \frac{m_{i,j}}{4} \right)^2 \right] , \quad (17) $$

where the brackets $\langle \rangle$ denote the mean of the values at the nodes of element $n$. The value of $\sigma_n^2$ ranges from
<figure><img src="image_6.png" /><figcaption>FIG. 4. Discretization dependence of the relative error of the computed Hopf index (a) and average variance of the magnetization per finite element (b). The average variance and the relative error exhibit a nearly linear dependence (c).</figcaption></figure>

zero in the case of a homogeneous state to one in the case of pairwise antiparallel alignment of the four magnetic moments. More generally, the value of the variance correlates with the angle enclosed between neighboring magnetic moments within a finite element—a quantity known to be tied to discretization errors in numerical micromagnetics⁵⁴. It is therefore plausible to identify the variance as a measure or indicator for the occurrence of discretization errors. As shown in Fig. 4c), the relative error and the mean variance obtained for different meshes display a nearly linear dependence.

Based on these observations, i.e., the variance-dependent underestimation of the computed value, we design an error correction scheme to improve the calculated Hopf index $N_{calc}$. This is achieved through a function $f$ that yields a corrected value $N_{corr} = f(N_{calc}, \sigma^2)$. However, the mean variance depends on the number of elements used in the simulation, including those in regions without topological texture, making it unsuitable for a generally applicable correction algorithm. Instead,

we use the local variance $(\sigma^2)_i$, ascribed to each node $i$ through a volume-weighted average of the variance in the adjacent elements, to locate and quantify numerical errors. Our correction method augments the absolute value of the calculated Hopf density $\rho_i = (\mathbf{J} \cdot \mathbf{A})_i$ at each node by a factor that increases monotonically with the local variance. Despite the linear relationship between total error and mean variance illustrated in Fig. 4c), we did not achieve satisfactory results with a linear correction scheme based on the local variance. Rather than applying higher-order polynomial corrections, we improve the approximation by adopting a different functional form, where the Hopf density is increased at each node $i$ according to

$$ \rho_i \rightarrow \rho_i \cdot \exp(\alpha\sigma_i^2) \qquad (18) $$

with $\alpha = \text{const.}$ With this phenomenological approach, we obtain excellent results in a broad spectrum of situations by setting the constant's value to $\alpha = 3.2$.

Fig. 5 illustrates the impact of the correction scheme on the discretization-dependent values of the calculated Hopf index and the relative error. Near-perfect agreement with the expected analytic value is obtained already at moderate discretization levels, and we rapidly obtain a substantial reduction of the relative error. For instance, already at a moderate number of about 390 000 finite elements, the corrected Hopf index is $N_{corr} = 0.995$, very close to the expected value of $N = 1$, while the uncorrected index for the same mesh is $N_{orig} = 0.938$. In this example, the correction decreases the relative error from 6.19% to 0.46%.

Despite the remarkable accuracy obtained with this method, we emphasize that our phenomenological a posteriori correction is not suitable to sizably reduce the local error in the calculation of the gradients or the topological current. This is because the local discretization error, unlike the Hopf index, does not increase monotonically with the variance. It is subject to fluctuations in both magnitude and sign that cannot be efficiently reduced with the same approach. However, the cumulative discretization errors affecting the integral (or, in numerical terms, the sum over the elements) in Eq. (1) can be significantly reduced in this manner.

<figure><img src="image_7.png" /><figcaption>FIG. 5. Impact of variance correction on the computed Hopf index and its discretization dependence.</figcaption></figure>
We tested the method in several scenarios and geome-
tries, considering different functional forms of the cor-
rection term and carefully tuning the constants involved.
In all cases, the correction as described in Eq. (18) with
$\alpha = 3.2$ yielded excellent results, leading us to the conclu-
sion that the choice of the exponential correction function
and the value of the constant $\alpha$ are suitable for general
cases, and are not specific to the texture discussed here.
Eventually, we obtained enough confidence in this a pos-
teriori correction to integrate it as a default operation
into our algorithm to calculate the Hopf index. Here-
after, all reported Hopf index values are those corrected
according to Eq. (18).

VI. HIGHER-ORDER HOPFIONS

The analytic formulation of Eqs. (9)-(11) enables the definition of higher-order Hopfion textures, e.i., with a Hopf index larger than one¹⁴, by selecting appropriate values for the parameters *u* and *v*. The parameter *u* controls the number of bimerons in meridional cross-sections, as shown in Fig. 2a) for *u* = 1, while *v* introduces a poloidal twist of the bimerons around the torus' core circle (the spine) at *ρ* = 0. Figure (6) shows preimage representations of second-, third-, and fourth-order Hopfions in a torus geometry, obtained by setting *v* = 2, 3, and 4, respectively (with *u* = 1, *m*₀ = −1, and *α* = π/2).

<figure><img src="image_8.png" /><figcaption>FIG. 6. Preimage representation of higher-order Hopfions, defined through Eqs. (9)-(11) by setting $v = 2, 3$, and 4, in a torus geometry with $r_{maj} = 150$ and $r_{min} = 145$. The torus is discretized into approximately 99 000 tetrahedral elements. The red and blue preimages refer to $m_y = 1$ and $m_y = -1$ isolines, respectively, on the $m_z = 0$ isosurfaces, represented by the semitransparent inner torus. The outer torus describing the geometric shape is cut at $x = 0$ for better visibility.</figcaption></figure>

The poloidal twist generated by the parameter *v* in-
creases the vector field’s degree of topological knotted-
ness, as evidenced by the increasingly complex linking
of preimage lines. Accordingly, our method yields the
Hopf indices 1.995, 2.998, and 3.999 for these structures,
respectively, matching these textures’ ideal values 2, 3,
and 4 very closely. These results further confirm our
method’s ability to reliably and quantitatively character-
ize the topological properties of complex magnetization
vector fields in arbitrary geometries. The highly accu-
rate values obtained for higher-order Hopfions validate
the robustness of the correction scheme for general cases,
despite having calibrated the method only for *N*<sub>H</sub> = 1.

Specifically, these results demonstrate that the correc-
tion scheme remains does not introduce any systematic
overestimation.

VII. MICROMAGNETIC SIMULATION

Having established the method's reliability and accu-
racy using an idealized, analytically defined Hopfion tex-
ture, we now demonstrate an application example in a
full-scale micromagnetic simulation. We consider a Hop-
fion bound in a cylindrical FeGe sample with height
$h = 100$ nm and radius $r = 100$ nm. The material pa-
rameters are $A = 8.78 \text{ pJ m}^{-1}$, $M_s = 384 \text{ kA m}^{-1}$, and
$D = 1.58 \text{ mJ m}^{-2}$, where $A$ is the ferromagnetic exchange
constant, $M_s = |M|$ is the saturation magnetization,
and $D$ is the bulk-type Dzyaloshinsky-Moria constant.
To stabilize the Hopfion at zero field²², we apply a Néel-
type surface anisotropy ($K_s = 10 \text{ mJ m}^{-2}$) on the top and
bottom surfaces of the cylinder, which pins the magneti-
zation along the $z$ axis at the caps.⁵⁵ We perform simu-
lations using our custom-developed GPU-accelerated mi-
cromagnetic finite-element software tetmag³. To demon-
strate the capacity of our method to reveal topological
transitions, we investigate the quasistatic destruction of
a Hopfion under an external magnetic field of increasing
strength, monitoring field-induced changes in vector field
topology through our method of calculating the Hopf in-
dex.

The simulation is initialized with a Hopfion inside the
cylinder, defined by the ansatz of Eqs. (9)-(11) with $\alpha =
\pi/2$, $m_0 = -1$, $u = 1$, $r_{maj} = 50$ nm and $r_{min} = 45$ nm,
embedded into a homogeneous background magnetiza-
tion $m_z = -m_0$. The numerical model employs a mesh
with about 2 million irregularly shaped tetrahedral ele-
ments.

We perform quasi-static relaxation simulations with an
external field applied along the positive z-direction, vary-
ing from zero to 600 mT in steps of 5 mT. For each con-
verged state, we calculate the Hopf index. The results are
displayed in Fig. 7, where three different regions are ap-
parent, which are separated by two discontinuous changes
in the Hopf index—the first at 240 mT and the second at
560 mT.

Between 0 mT and 235 mT, the Hopf index remains
close to 1, consistent with the expected value given the
presence of a Hopfion. At very low fields, the Hopf index
exceeds this ideal value by up to about 4% due to spu-
rious effects related to weakly developed textures near
the cylinder's outer boundary, which are marginally con-
connected to the Hopfion. The peripheral magnetization
aligns more strongly with the applied field as the field in-
creases beyond about 35 mT (see Fig 8, a), causing these
lateral textures to detach from the Hopfion, which be-
comes fully embedded into a homogeneous background
magnetization $m_z = -m_0$. From 35 mT to 235 mT, the
Hopf index stays nearly constant, with deviations below
1%. Despite significant field-induced changes, in partic-
This is the author's peer reviewed, accepted manuscript. However, the online version of record will be different from this version once it has been copyedited and typeset.
PLEASE CITE THIS ARTICLE AS DOI: 10.1063/5.0280041

<figure><img src="image_9.png" /><figcaption>FIG. 7. Calculated Hopf index as the magnetic structure changes under increasing field strength. Sudden changes of the Hopf index at specific field strengths indicate topological transitions. The insets are representative examples of the $m_z = 0$ isosurfaces in the Hopfion and the toron configuration. The thin dashed line at 1.0 represents the expected ideal value for a Hopfion.</figcaption></figure>

ular a reduction in the Hopfion’s size (Fig. 8), our correction method prevents any decrease in the Hopf index, even as local magnetic inhomogeneity increases. In this field range, where changes of the magnetization are reversible, the consistent Hopf index accurately reflects the topological equivalence of the textures, regardless of their field-induced deformation.

<figure><img src="image_10.png" /><figcaption>FIG. 8. Isosurface (top row) and preimage (bottom row) representation of the magnetic structure in the FeGe cylinder at different field strengths. The cylinder is cut at the $x = 0$ plane to display the inner structure. The Hopfion texture of panel (a), taken at $\mu_0H_{ext} = 35$ mT and yielding a Hopf index $N = 1.012$, shows the typical toroidal shape of the $m_z$ isosurfaces and linked, intertwined preimages in the isoline representation. b) Shortly before the destruction of the Hopfion, at $\mu_0H_z = 235$ mT, the index slightly drops to $N = 0.998$ while the shapes of the isosurfaces and the preimages are preserved, albeit more compressed compared to the low-field state. c) At $\mu_0H_z = 560$ mT, the Hopfion has transformed into a toron, with Bloch points (represented as small spheres) on the top and bottom of the structure. In this configuration, the topological index evaluates to $N = 0.12$.</figcaption></figure>

In the field range between 240 mT and 560 mT, the Hopf index remains almost constant at approximately 0.1; a significant decrease from its value in the first region. This abrupt reduction of the Hopf index at 240 mT marks

the irreversible destruction of the Hopfion, which transforms into a toron as Bloch points form on the top and bottom end of an encapsulated core region in which the magnetization is oriented along the negative $z$ axis, oppositely oriented to the surrounding background (Fig 8c). In the toron configuration, sometimes referred to as a coupled monopole-antimonopole pair$^{22}$, the $m_z$ isosurfaces become homeomorphic to a sphere rather than a torus, and the previously closed, intertwined isolines in the preimage representation are now connected by two Bloch points. The change in vector field topology between the Hopfion and the toron configuration represents a topological transition that is characterized by an abrupt change in the Hopf index from 1 to 0.1. Like the first region, the Hopf index calculated in the toron regime remains constant over a wide range of field strengths, despite considerable field-induced modifications of the toron structure.

We emphasize that, while the change in the Hopf index indicates a topological change, the low value of 0.1 of the Hopf index does not allow definitive conclusions about the resulting magnetic structure beyond confirming the absence of a Hopfion. As discussed in section II, the Hopf index calculation relies on a smooth magnetization vector field and a divergence-free topological current. These conditions are not met in the vicinity of Bloch points, which represent sources and sinks of the topological current$^{22}$, invalidating the fundamental assumption $\nabla \cdot \mathbf{J} = 0$ required to introduce the vector potential $\mathbf{A}$ according to Eq. (2). Consequently, the Helmholtz decomposition of the topological current becomes $\mathbf{J} = \nabla \times \mathbf{A} + \nabla \times \mathbf{\Psi}$, where $\mathbf{\Psi}$ is a scalar potential accounting for the irrotational components. The vector potential $\mathbf{A}$ captures only the solenoidal part of $\mathbf{J}$, which is insufficient for a full description of the Bloch point topology. The stable Hopf index of approximately 0.1 in the toron regime across a wide field range suggests that the divergence-free part of $\mathbf{J}$ remains constant, potentially indicating a characteristic toron property. However, given the particular situation of a discontinuous magnetization vector field, we cannot rule out that spurious effects arising from the Bloch points may also contribute to the nonzero topological index. In any case, the fractional Hopf index calculated in this case cannot be interpreted topologically as a linking number.

In the third region, from 565 mT to 600 mT, except for a slight rotation on the lateral surface, the magnetization is overall homogeneous along the field direction, resulting in a vanishing Hopf index.

VIII. CONCLUSION

We have developed a robust and accurate method for calculating the Hopf index in finite-element micromagnetic simulations. By employing the Biot-Savart form for the vector potential, our approach ensures gauge-invariant results even in multiply connected geometries.
Applying our variance-based correction scheme to an analytically defined ideal Hopfion structure, we demonstrated its ability to significantly reduce numerical errors, which could otherwise be substantial in strongly inhomogeneous textures or exhibit slow mesh-size dependent convergence.

Through a micromagnetic simulation example involving a Hopfion's field-induced destruction, we confirmed the method's capacity to detect Hopfions and their absence, revealing topological transitions through abrupt changes in the Hopf index. Combined with the finite-element method's flexibility in modeling magnetic textures in arbitrarily shaped 3D nanostructures, this approach enables precise identification and quantification of topological features in complex 3D magnetic configurations. Our method provides a powerful tool for advancing the study of topological magnetism in micromagnetic simulations. While we have only demonstrated its effectiveness in micromagnetism, we are confident that the method can also be applied successfully in other scientific domains, particularly in other ferroic material systems.

## ACKNOWLEDGEMENTS

This work was supported by the French National Research Agency (ANR) under Contract No. ANR-22-CE92-0032 through the TOROID project co-funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) Project No. 505561633 and by the France 2030 government investment plan managed by the French National Research Agency ANR under grant reference PEPR SPIN – [SPINTHEORY] ANR-22-EXSP-0009. The authors acknowledge the High Performance Computing Center of the University of Strasbourg for supporting this work by providing access to computing resources.

## Data availability statement

The data that support the findings of this study are available from the corresponding author upon reasonable request.

<footnote n="1">¹A. Fernández-Pacheco, R. Streubel, O. Fruchart, R. Hertel, P. Fischer, and R. P. Cowburn, Nature Communications 8, ncomms15756 (2017).</footnote>

<footnote n="2">²C. Donnelly, M. Guizar-Sicairos, V. Scagnoli, S. Gliga, M. Holler, J. Raabe, and L. J. Heyderman, Nature 547, 328 (2017), number: 7663 Publisher: Nature Publishing Group.</footnote>

<footnote n="3">³R. Hertel, “tetmag,” https://github.com/R-Hertel/tetmag (2023).</footnote>

<footnote n="4">⁴A. Vansteenkiste, J. Leliaert, M. Dvornik, M. Helsen, F. Garcia-Sanchez, and B. Van Waeyenberge, AIP Advances 4, 107133 (2014).</footnote>

<footnote n="5">⁵J. Bland and B. Heinrich, eds., *Ultrathin Magnetic Structures I*, Vol. 1 (Springer-Verlag GmbH, Berlin, Heidelberg, New York, 1995) oCLC: 1081343538.</footnote>

<footnote n="6">⁶R. Cheenikundil and R. Hertel, Applied Physics Letters 118, 212403 (2021), publisher: American Institute of Physics.</footnote>

<footnote n="7">⁷M. Golębiewski, R. Hertel, M. d’Aquino, V. Vasyuchka, M. Weiler, P. Pirro, M. Krawczyk, S. Fukami, H. Ohno, and J. Llando, ACS Applied Materials & Interfaces 16, 22177 (2024), publisher: American Chemical Society.</footnote>

<footnote n="8">⁸P. Fischer, D. Sanz-Hernández, R. Streubel, and A. Fernández-Pacheco, APL Materials 8, 010701 (2020), number: 1 Publisher: American Institute of Physics.</footnote>

<footnote n="9">⁹M. T. Birch, D. Cortés-Ortuño, L. A. Turnbull, M. N. Wilson, F. Groß, N. Träger, A. Laurenson, N. Bukin, S. H. Moody, M. Weigand, G. Schütz, H. Popescu, R. Fan, P. Steadman, J. A. T. Verezhak, G. Balakrishnan, J. C. Loudon, A. C. Twitchett-Harrison, O. Hovorka, H. Fangohr, F. Y. Ogrin, J. Gräfe, and P. D. Hatton, Nature Communications 11, 1726 (2020), number: 1 Publisher: Nature Publishing Group.</footnote>

<footnote n="10">¹⁰P. Milde, D. Köhler, J. Seidel, L. M. Eng, A. Bauer, A. Chacon, J. Kindervater, S. Mühlbauer, C. Pfleiderer, S. Buhrandt, C. Schütte, and A. Rosch, Science 340, 1076 (2013), number: 6136.</footnote>

<footnote n="11">¹¹A. O. Leonov and K. Inoue, Physical Review B 98, 054404 (2018), publisher: American Physical Society.</footnote>

<footnote n="12">¹²F. Zheng, F. N. Rybakov, A. B. Borisov, D. Song, S. Wang, Z.-A. Li, H. Du, N. S. Kiselev, J. Caron, A. Kovács, M. Tian, Y. Zhang, S. Blügel, and R. E. Dunin-Borkowski, Nature Nanotechnology 13, 451 (2018), number: 6 Publisher: Nature Publishing Group.</footnote>

<footnote n="13">¹³N. Kent, N. Reynolds, D. Raftrey, I. T. G. Campbell, S. Virasawmy, S. Dhuey, R. V. Chopdekar, A. Hierro-Rodriguez, A. Sorrentino, E. Pereiro, S. Ferrer, F. Hellman, P. Sutcliffe, and P. Fischer, Nature Communications 12, 1562 (2021), number: 1 Publisher: Nature Publishing Group.</footnote>

<footnote n="14">¹⁴F. N. Rybakov, N. S. Kiselev, A. B. Borisov, L. Döring, C. Melcher, and S. Blügel, APL Materials 10, 111113 (2022), publisher: American Institute of Physics.</footnote>

<footnote n="15">¹⁵F. Zheng, N. S. Kiselev, F. N. Rybakov, L. Yang, W. Shi, S. Blügel, and R. E. Dunin-Borkowski, Nature 623, 718 (2023), publisher: Nature Publishing Group.</footnote>

<footnote n="16">¹⁶B. Göbel, C. A. Akosa, G. Tatara, and I. Mertig, Physical Review Research 2, 013315 (2020), publisher: American Physical Society.</footnote>

<footnote n="17">¹⁷C. J. García-Cervera, Z. Gimbutas, and W. E. Journal of Computational Physics 184, 37 (2003), number: 1.</footnote>

<footnote n="18">¹⁸J. H. C. Whitehead, Proceedings of the National Academy of Sciences 33, 117 (1947).</footnote>

<footnote n="19">¹⁹L. Faddeev and A. J. Niemi, Nature 387, 58 (1997), publisher: Nature Publishing Group.</footnote>

<footnote n="20">²⁰F. Wilczek and A. Zee, Physical Review Letters 51, 2250 (1983), number: 25 Publisher: American Physical Society.</footnote>

<footnote n="21">²¹D. A. Nicole, Journal of Physics G: Nuclear Physics 4, 1363 (1978).</footnote>

<footnote n="22">²²Y. Liu, R. K. Lake, and J. Zang, Physical Review B 98, 174437 (2018), number: 17 Publisher: American Physical Society.</footnote>

<footnote n="23">²³J.-S. B. Tai and I. I. Smalyukh, Physical Review Letters 121, 187201 (2018), publisher: American Physical Society.</footnote>

<footnote n="24">²⁴S. Komineas and N. Papanicolaou, Physica D: Nonlinear Phenomena 99, 81 (1996).</footnote>

<footnote n="25">²⁵A. A. Thiele, Physical Review Letters 30, 230 (1973), number: 6.</footnote>

<footnote n="26">²⁶J. H. Han, *Skyrmions in Condensed Matter*, Springer Tracts in Modern Physics, Vol. 278 (Springer International Publishing, Cham, 2017).</footnote>

<footnote n="27">²⁷The property $\nabla \cdot \mathbf{J} = 0$ is central to this formalism, as it allows to introduce a vector potential according to eq. (2). This condition of a solenoidal field $\mathbf{J}$ is not fulfilled in the case of Bloch points, where the magnetization's spatial gradients are undefined.</footnote>

<footnote n="28">²⁸V. I. Arnold and B. A. Khesin, *Topological Methods in Hydrodynamics*, Applied Mathematical Sciences, Vol. 125 (Springer International Publishing, Cham, 2021).</footnote>

<footnote n="29">²⁹P. J. Ackerman and I. I. Smalyukh, Physical Review X 7, 011006 (2017), publisher: American Physical Society.</footnote>

<footnote n="30">³⁰I. I. Smalyukh, Reports on Progress in Physics 83, 106601 (2020), number: 10 Publisher: IOP Publishing.</footnote>
This is the author's peer reviewed, accepted manuscript. However, the online version of record will be different from this version once it has been copyedited and typeset.
PLEASE CITE THIS ARTICLE AS DOI: 10.1063/5.0280041

<footnote n="31">³¹P. Sutcliffe, Physical Review Letters **118**, 247203 (2017), publisher: American Physical Society.</footnote>

<footnote n="32">³²I. Luk'yanchuk, Y. Tikhonov, A. Razumnaya, and V. M. Vinkur, Nature Communications **11**, 2433 (2020).</footnote>

<footnote n="33">³³R. L. Ricca and X. Liu, eds., *Knotted Fields*, Lecture Notes in Mathematics, Vol. 2344 (Springer Nature Switzerland, Cham, 2024).</footnote>

<footnote n="34">³⁴H. K. Moffatt, Journal of Fluid Mechanics **35**, 117 (1969).</footnote>

<footnote n="35">³⁵J.-J. Moreau, Comptes rendus hebdomadaires des séances de l'Académie des sciences **252**, 2810 (1961).</footnote>

<footnote n="36">³⁶M. R. Dennis, R. P. King, B. Jack, K. O'Holleran, and M. J. Padgett, Nature Physics **6** (2010), 10.1038/nphys1504, publisher: Nature Publishing Group.</footnote>

<footnote n="37">³⁷S. M. Barnett, F. C. Speirls, and J. B. Götte, Europhysics Letters **143**, 35002 (2023), publisher: EDP Sciences, IOP Publishing and Società Italiana di Fisica.</footnote>

<footnote n="38">³⁸R. Rajaraman, *Solitons and Instantons: An Introduction to Solitons and Instantons in Quantum Field Theory* (Amsterdam: North-Holland, 1982).</footnote>

<footnote n="39">³⁹J. Arafune, P. G. O. Freund, and C. J. Goebel, Journal of Mathematical Physics **16**, 433 (1975).</footnote>

<footnote n="40">⁴⁰M. A. Berger and G. B. Field, Journal of Fluid Mechanics **147**, 133 (1984).</footnote>

<footnote n="41">⁴¹L. Woltjer, Proceedings of the National Academy of Sciences **44**, 489 (1958), publisher: Proceedings of the National Academy of Sciences.</footnote>

<footnote n="42">⁴²D. MacTaggart and A. Valli, Journal of Plasma Physics **85**, 775850501 (2019).</footnote>

<footnote n="43">⁴³M. Bevir and J. W. Gray, Proceedings of the Reversed-Field Pinch Theory Workshop LA-8944-C, 176 (1980).</footnote>

<footnote n="44">⁴⁴In the calculation of the vector potential **A**, the topological current **J** is utilized as a static, divergence-free vector field. This setup is analogous to the calculation of the magnetic field generated by a current density **j** using the Biot-Savart law; however, this analogy applies only to a stationary current density and does not extend to dynamic currents that arise in time-dependent systems.</footnote>

<footnote n="45">⁴⁵R. Hertel and A. Kákay, Journal of Magnetism and Magnetic Materials **369**, 189 (2014).</footnote>

<footnote n="46">⁴⁶The Fredkin–Koehler method is used in micromagnetic finite-element modeling to couple the magnetic sample to its surrounding space via a hybrid finite-element/boundary-element approach. It enables efficient and accurate computation of the magnetostatic field under open boundary conditions by solving a Poisson equation within the sample and matching it to a boundary-element solution in the surrounding vacuum. In our work, we apply the same methodology to compute the vector potential **A**, rather than the magnetostatic scalar potential used in the original formulation.</footnote>

<footnote n="47">⁴⁷D. R. Fredkin and T. R. Koehler, IEEE Transactions on Magnetics **26**, 415 (1990), number: 2.</footnote>

<footnote n="48">⁴⁸R. Hertel, S. Christophersen, and S. Börm, Journal of Magnetism and Magnetic Materials **477**, 118 (2019).</footnote>

<footnote n="49">⁴⁹D. Demidov, Lobachevskii Journal of Mathematics **40**, 535 (2019), number: 5.</footnote>

<footnote n="50">⁵⁰L. Faddeev and A. J. Niemi, “Toroidal Configurations As Stable Solitons,” (1997), arXiv:hep-th/9705176.</footnote>

<footnote n="51">⁵¹K. Y. Guslienko, Chaos, Solitons & Fractals **174**, 113840 (2023).</footnote>

<footnote n="52">⁵²J.-V. Kim and J. Mulkers, IOP SciNotes **1**, 025211 (2020), number: 2 Publisher: IOP Publishing.</footnote>

<footnote n="53">⁵³R. Knapman, M. Azhar, A. Pignedoli, L. Gallard, R. Hertel, J. Leliaert, and K. Everschor-Sitte, Physical Review B **111**, 134408 (2025), publisher: American Physical Society.</footnote>

<footnote n="54">⁵⁴M. J. Donahue, Journal of Applied Physics **83**, 6491 (1998), number: 11.</footnote>

<footnote n="55">⁵⁵The value of $K_s$ used here is not intended to represent a realistic surface anisotropy for FeGe, but rather to enforce a quasi-uniform out-of-plane magnetization at the cylinder ends. This numerical technique mimics fixed boundary conditions, similar to the approach taken by Sutcliffe², who notes: “For simplicity, it is assumed that **K** is large enough that the approximation $m = e_3$ is reasonable at the ends of the cylinder.”</footnote>