The Magnetic Scalar Potential for a Rectangular Prism

Berian James, Stefan Pollok, Jes Frellsen, Rasmus BjørkIEEE Transactions on Magnetics 2025 · DOI · arXiv

Abstract: We analytically solve Poisson’s equation for the magnetic scalar potential generated by a uniformly magnetized rectangular prism and determine a closed-form solution for the magnetic scalar potential given only in terms of arctan and natural logarithmic functions. We show that the magnetic scalar potential can be written as a demagnetization vector, containing all the geometric information, multiplied with the magnetization, analogous to demagnetization tensors. We validate the derived analytical expression for the magnetic scalar potential by comparing with a finite element simulation and show that these agree perfectly. We finally extend the concept of the demagnetization vector and tensor, which contains the geometric information for the source generating the potential, to gravitational objects.

Introduction

Calculating the magnetic field generated by a rectangular prism is a fundamental task in electromagnetics, essential for designing electric vehicle motors, magnetic sensors, and micromagnetic simulations. While expressions for the magnetic field (the gradient of the potential) and interaction energy have existed for decades, a simple, closed-form analytical solution for the magnetic scalar potential ($\phi_M$) itself has remained elusive.

Deriving this potential directly offers significant advantages. From a computational perspective, working with a scalar field is inherently more efficient than managing a 3D vector field. Furthermore, in the context of physics-informed machine learning (PINNs), training a neural network to learn a single scalar potential is far more robust and efficient than balancing multiple loss functions for individual vector components. This work fills this gap by providing an exact, computationally efficient tool for magnetic field modeling.

Methodology and Analytical Derivation

The researchers solved Poisson’s equation for a uniformly magnetized body. Under the assumption of uniform magnetization ($\mathbf{M}$), the internal magnetic volume charge density is zero, meaning the potential is generated entirely by the magnetic surface charges on the prism's six faces.

By integrating these surface charge densities, the authors derived a solution composed entirely of standard $\arctan$ and natural logarithmic ($\ln$) functions. The solution is structured using a helper function, $F(i, j, k)$, which facilitates the calculation of the potential through simple permutations of the prism's dimensions and the evaluation point's coordinates. To ensure the robustness of the formula, the authors verified that the analytical limits at geometric boundaries (such as corners and edges) are well-behaved and resolve to zero, preventing numerical instabilities in software implementations.

The Demagnetization Vector and Gravitational Analogy

A key conceptual contribution of this research is the introduction of the demagnetization vector ($\mathbf{N}_\phi$). In magnetostatics, the magnetic field is typically related to magnetization via a $3 \times 3$ demagnetization tensor. The authors demonstrate that the scalar potential can be expressed similarly as the dot product of this new geometric vector and the magnetization vector:

$$\phi_M(\mathbf{r}) = \mathbf{N}_\phi(\mathbf{r}) \cdot \mathbf{M}$$

This formulation encapsulates all geometric information into a single vector. Interestingly, because both magnetism and Newtonian gravity obey Poisson-like equations, this logic extends to gravitational systems. The authors propose "degravitation" vectors and tensors to calculate the gravitational potential and pull of uniform-density objects, highlighting a deep mathematical symmetry between the two fields.

Results and Validation

The analytical solution was validated against high-precision Finite Element Method (FEM) simulations using COMSOL Multiphysics. The benchmark case involved a rectangular prism with dimensions $2 \times 4 \times 6$ meters and a magnetization vector $\mathbf{M} = [2, 3, -4]$ A/m.

Figure 1: The magnetic scalar potential ($\phi_M$) and field lines in the xy-plane. The red arrow indicates the magnetization direction.

As shown in Figure 1, the analytical potential distribution and the resulting field lines perfectly capture the expected physical behavior of the magnetized prism. Quantitatively, the agreement is nearly flawless.

Figure 2: Comparison between the analytical solution (Eq. 13) and FEM results. The error (dashed line) remains extremely low across the evaluation range.

Figure 2 illustrates that the difference between the analytical formula and the FEM simulation is negligible. The minor error observed at extreme distances (less than 3%) is attributed to the inherent numerical precision limits of the FEM model rather than any inaccuracy in the derived analytical expression.

Conclusion

This work provides the first closed-form analytical solution for the magnetic scalar potential of a rectangular prism. By introducing the demagnetization vector, the authors offer a streamlined approach to magnetic and gravitational modeling. These expressions have been integrated into the open-source MagTense framework for immediate use by the scientific community. Future research will focus on applying these potentials to accelerate the training of Physics-Informed Neural Networks and extending the demagnetization vector approach to other complex geometries like cylinders and tetrahedrons.

Summary updated

Abstract

We analytically solve Poisson’s equation for the magnetic scalar potential generated by a uniformly magnetized rectangular prism and determine a closed-form solution for the magnetic scalar potential given only in terms of arctan and natural logarithmic functions. We show that the magnetic scalar potential can be written as a demagnetization vector, containing all the geometric information, multiplied with the magnetization, analogous to demagnetization tensors. We validate the derived analytical expression for the magnetic scalar potential by comparing with a finite element simulation and show that these agree perfectly. We finally extend the concept of the demagnetization vector and tensor, which contains the geometric information for the source generating the potential, to gravitational objects.
BibTeX
@article{james2025magnetic,
  author = {Berian James and Stefan Pollok and Jes Frellsen and Rasmus Bjørk},
  title = {{The Magnetic Scalar Potential for a Rectangular Prism}},
  journal = {IEEE Transactions on Magnetics},
  year = {2025},
  doi = {10.1109/tmag.2025.3632626},
}
Figure