$\nabla\cdot{B}=0$ versus the Universe
Ulrich P. Steinwandel, Daniel J. Price
TL;DR
The paper addresses the challenge of maintaining $\nabla\cdot\mathbf{B}=0$ in cosmological MHD simulations by implementing the constrained divergence-cleaning method of Tricco et al. into the OpenGadget3 code. It combines energy-conserving, comoving discretization with a variable cleaning speed and demonstrates substantial reductions in divergence errors, while revealing enhanced magnetic-field amplification in cluster outskirts and smoother field geometries. The authors validate the approach against standard MHD tests and apply it to a massive galaxy cluster, comparing to a Powell 8-wave scheme to show improved physical fidelity. The work provides a practical, efficient tool for more reliable cosmological MHD simulations and highlights the importance of divergence control for accurately modeling magnetic-field amplification in low-density regions.
Abstract
We implement the constrained divergence cleaning algorithm of \citet{Tricco2016} into the cosmological smoothed particle magnetohydrodynamics (SPMHD) code OpenGadget3. Our implementation modifies the governing equations of SPMHD to allow the constrained hyperbolic/parabolic cleaning scheme to be applied consistently in an expanding cosmological framework. This ensures that divergence errors in the magnetic field are actively propagated away and damped, rather than merely being advected with the flow or partially controlled by source terms. To validate our implementation, we perform a series of standard test problems, including the advection of divergence errors, the Orszag-Tang vortex, the Brio-Wu shock tube, and magnetised Zeldovich pancakes. These tests confirm that our scheme successfully reduces divergence errors while preserving the correct physical evolution of the system. We then apply the method to a fully cosmological simulation of a massive galaxy cluster, comparing the results to those obtained using the previously employed Powell eight-wave divergence preserving scheme. We find that the overall density structure of the cluster is largely unaffected by the choice of divergence cleaning method, and the magnetic field geometry and strengths in the cluster core remain similar. However, in the cluster outskirts ($r \approx$~1-3~$h^{-1}$~Mpc), the magnetic field is amplified by a factor of $\sim$ 5 compared to the Powell-only approach. Moreover, the constrained divergence cleaning algorithm reduces the divergence error by 2-3 orders of magnitude throughout the cluster volume, demonstrating its effectiveness in maintaining the solenoidal condition of the magnetic field in large-scale cosmological simulations. Our results suggest that accurate divergence control is essential for modeling magnetic field amplification in low-density regions of galaxy clusters.
