-
PDF
- Split View
-
Views
-
Cite
Cite
Philip Mocz, Mark Vogelsberger, Lars Hernquist, A constrained transport scheme for MHD on unstructured static and moving meshes, Monthly Notices of the Royal Astronomical Society, Volume 442, Issue 1, 21 July 2014, Pages 43–55, https://doi.org/10.1093/mnras/stu865
- Share Icon Share
Abstract
Magnetic fields play an important role in many astrophysical systems and a detailed understanding of their impact on the gas dynamics requires robust numerical simulations. Here we present a new method to evolve the ideal magnetohydrodynamic (MHD) equations on unstructured static and moving meshes that preserves the magnetic field divergence-free constraint to machine precision. The method overcomes the major problems of using a cleaning scheme on the magnetic fields instead, which is non-conservative, not fully Galilean invariant, does not eliminate divergence errors completely, and may produce incorrect jumps across shocks. Our new method is a generalization of the constrained transport (CT) algorithm used to enforce the ∇ · B = 0 condition on fixed Cartesian grids. Preserving ∇ · B = 0 at the discretized level is necessary to maintain the orthogonality between the Lorentz force and B. The possibility of performing CT on a moving mesh provides several advantages over static mesh methods due to the quasi-Lagrangian nature of the former (i.e. the mesh generating points move with the flow), such as making the simulation automatically adaptive and significantly reducing advection errors. Our method preserves magnetic fields and fluid quantities in pure advection exactly.
1 INTRODUCTION
The equations of fluid dynamics and magnetohydrodynamics (MHD) may be evolved using a variety of numerical approaches. One can choose from a number of discretizations that are formally intended to yield a solution that is accurate to some order n. However, a system of partial differential equations for physical flows also gives rise to conserved quantities due to the symmetries of the problem and these quantities are not necessarily preserved with some algorithms. Such conserved quantities for the MHD equations include mass, momentum, angular momentum, energy, and the solenoidal nature of the magnetic field. It then becomes a concern to design techniques in a clever way such that the discrete representations of these conserved quantities are in fact preserved to machine precision. Failure to do this may result in instabilities and unphysical solutions; that is, the system's quantity that should be conserved may chaotically evolve away from its initial value. One well-known example of such a phenomenon occurs when evolving an N-body system with a non-symplectic time integrator, which does not conserve the total energy and hence may lead to energy drifts and decaying orbits.
In this work, we propose a scheme for evolving the MHD equations on a moving mesh such that conservation of mass, momentum, and energy, and, importantly, the solenoidal (divergence-free) nature of the magnetic field is preserved. On static Cartesian meshes, the constrained transport (CT) algorithm achieves this goal. It uses a finite volume formalism to evolve the density, momentum, and energy, and exploits Stokes’ theorem and uses a face-averaged representation of the magnetic fields (called the ‘staggered-mesh’ approach) to enforce |$\nabla \cdot {\boldsymbol {B}}=0$| (Evans & Hawley 1988). The CT algorithm has been described in the literature as being quite difficult (if not impossible) to extend to an unstructured mesh (Duffell & MacFadyen 2011; Pakmor, Bauer & Springel 2011; Pakmor & Springel 2013) and leading to the development of alternate divergence-cleaning schemes to keep |$\nabla \cdot {\boldsymbol {B}}$| small but non-zero on moving meshes based on the Powell (Powell et al. 1999) and Dedner (Dedner et al. 2002) cleaning methods. Moving mesh methods for MHD with cleaning schemes have been described by Duffell & MacFadyen (2011), Pakmor et al. (2011), Gaburov, Johansen & Levin (2012) and Pakmor & Springel (2013). Additionally, there have been recent advances in designing robust meshless based methods for MHD (Gaburov & Nitadori 2011; Tricco & Price 2013), which still, however, require cleaning schemes. These schemes alter the MHD equations and may add source terms in an attempt to control the divergence errors, which has the unwanted side effect of making the schemes non-conservative. Additionally, such an approach loses the moving mesh's Galilean-invariant properties (e.g. solving pure advection problems is diffusive). One approach to improve these methods has been to develop a locally divergence-free formulation based on the discontinuous Galerkin method in the work presented in Mocz et al. (2014), where local divergence-free basis functions are used to represent the solution on each cell. In this paper we solve the outstanding problem of designing a globally divergence-free, conservative, finite volume based algorithm on an unstructured moving mesh.
Coupling a CT algorithm with a moving mesh technique is clearly highly desirable. The moving mesh algorithm for solving the inviscid Euler equations was developed recently by Springel (2010) and implemented in the code arepo. The moving mesh algorithm largely eliminates a number of well-known weaknesses of both static Cartesian/adaptive mesh refinement approaches and pseudo-Lagrangian smoothed particle hydrodynamics. The mesh-generating points in the algorithm can be set to move with the fluid flow, making the scheme quasi-Lagrangian. The method has automatic adaptivity, is Galilean invariant, and significantly reduces advection errors. Contact discontinuities resulting from shocks are preserved to significantly greater accuracy. In addition, conditions on the size of the timestep are less severe than on a static mesh in the cases of flows with high Mach number bulk motions, since fluxes across cells are always calculated in the rest frame of the faces. A method for solving the MHD equations on a moving mesh will automatically gain these benefits of the Lagrangian nature of the scheme and, ideally, should not suffer any significant disadvantage compared to a static mesh approach. Since methods exist to preserve the divergence-free condition on structured fixed grids, it is important to extend this to unstructured meshes so that if differences are observed in MHD simulations run on static and moving meshes, then they can be attributed to the advantages of the moving mesh approach and not as an artefact produced by divergence errors.
The CT method proposed here can also be applied to static arbitrarily unstructured grids, where CT algorithms are lacking. A number of simulations use non-Cartesian static grids, dictated by the geometry/symmetry of the problem, as a way of achieving greater accuracy and by using fewer grid cells. For example, the MHD solver in Florinski et al. (2013) was developed for a hexagonal spherical geodesic grid as a way to improve the simulation of astrophysical flows of partially ionized plasmas around a central compact object. However, such methods use cleaning schemes instead of CT to handle the magnetic field, and would benefit greatly from the CT method described in what follows.
A robust code for solving the MHD equations as accurately as possible would have many astrophysical applications because magnetic fields are ubiquitous in the Universe. For example, the magnetorotational instability in accretion discs (Balbus & Hawley 1998) generates turbulence and mediates angular momentum transfer. Discs around supermassive black holes may be levitated by magnetic pressure (Gaburov et al. 2012). Magnetic fields are key in the production of relativistic jets and outflows from compact sources (Blandford & Znajek 1977; Blandford & Payne 1982). Magnetic fields under a vertical gravitational field as in the disc of a galaxy leads to the Parker instability, which is thought to play an important role in the evolution of the interstellar medium (Parker 1966, 1967). Interstellar turbulence and star formation are linked with magnetized plasma processes (Goldreich & Sridhar 1995). Cosmic magnetic fields are likely to have a primordial origin which leads to imprints on the temperature and polarization anisotropies of the cosmic microwave background radiation (Grasso & Rubinstein 2001). These seed fields are amplified during the formation and evolution of galaxies. Radio lobes of galaxies may also play an important role in enhancing the magnetic fields in the intergalactic medium (Gopal-Krishna & Wiita 2001). Magnetic fields may be responsible for suppressing strong isotropic turbulence and conduction in clusters and make it possible for stable, 100 kpc-scale high-density arms to exist in the cluster environment (Sanders et al. 2013). The strength and topology of magnetic fields are responsible for determining the propagation of cosmic rays in galaxies (Strong & Moskalenko 1998). Magnetic fields are also present in a wide variety of stars and play a significant role in their evolution (Donati & Landstreet 2009). Many of these problems are suitable for study by a moving mesh approach and up until now a divergence-free MHD solver has been lacking. This paper lays the framework for implementing a divergence-preserving algorithm for robust evolution of the MHD equations in moving mesh codes such as arepo (Springel 2010) and tess (Duffell & MacFadyen 2011).
In Section 2 we describe the details of the numerical method. In Section 3 we show the results of numerical tests (with comparisons to fixed grid CT and the Powell cleaning scheme on a moving mesh) demonstrating that the method works well and has several advantages over the other two techniques. In Section 4 we discuss variations of our method and future directions. In Section 5 we provide concluding remarks.
2 NUMERICAL METHOD
This section is dedicated to describing the second-order numerical method in detail. Our method is implemented in 2D in matlab. The method can be generalized to 3D (see Section 2.3.2). For reference, a flow chart of our numerical algorithm is presented in Fig. 1.

A flow chart of the CT algorithm for a moving mesh. After initialization, the code enters the main loop. In each iteration of the loop, the system advances by a time interval Δt as long as the mesh connectivity does not change too drastically (in which case the flag remap_ok is set to 1), else the timestep Δt is halved and the system attempts to update itself according to this new timestep.
2.1 The magnetohydrodynamic equations
2.2 Finite volume approach on a moving mesh
A finite volume strategy is used to update the density, momentum, and energy of the cells (but the magnetic fields require a different approach). Our method follows that of Springel (2010) closely, except for minor modifications which we point out, which are needed to link the method with our CT scheme to update the magnetic fields.
The flux computation for the mass, momentum, and energy for the moving mesh algorithm is calculated in the rest frame of each of the faces. An important difference with the approach taken in Springel (2010) is that we first move the mesh generating points over a time interval Δt according to their velocities, reconstruct the Voronoi mesh (this is the mesh at the end of the timestep), and then extrapolate fluid quantities to the face centroid of the mesh using the geometry at the end of the timestep rather than the beginning of the timestep for the flux computations. Using the cell geometry at the end of the timestep rather than at the beginning is an equally accurate reconstruction technique, but it turns out to be easier to account for changes in mesh connectivity for the CT algorithm for divergence-free evolution of magnetic fields, described in Section 2.3.
The primitive variables are re-estimated once the mesh is moved from the conserved variables. This makes the reconstruction step fully conservative.
2.3 Constrained transport on a moving mesh
One now just needs to accurately estimate E(n + 1/2) to be able to update the magnetic flux. We do so using a flux-interpolated approach as follows. In this section we will assume that the mesh connectivity does not change between timesteps, and in Section 2.3.1 we describe the additional remapping technique that needs to be applied on magnetic fluxes through faces whenever the mesh connectivity changes between timesteps (which corresponds to the appearance and disappearance of faces).
The mesh is moved its location at the end of the timestep, and gradient information for |${\boldsymbol {B}}$| is calculated, as in Section 2.2 for the other primitive variables. The normal component of the magnetic field across each face is obtained by averaging the two predictions obtained by extrapolating to the face from the cell centre of mass at either side of the face (equation 20). The Riemann solver requires a constant magnetic field across the shock (which is a consequence of |$\nabla \cdot {\boldsymbol {B}}=0$| in 1D). Note that in the CT method the divergence of the magnetic field in a cell is not necessarily 0 when we extrapolate to estimate the flux at the middle of the timestep, but at the end of the timestep it will always evolve to a state with the discretized divergence (equation 29) kept at zero to machine precision.
An alternate approach to the above is to use a field-interpolated approach; i.e. to extrapolate the magnetic and velocity fields to each edge of each face in the rest frame of the edge. However, flux-interpolated approaches have slightly better performance and desirable properties due to the consistency of coupling the electric field estimate to the Riemann solver (Tóth 2000). Equation (31), without the last two terms that account for the change of frame, is the familiar way to estimate the electric field in flux-interpolated CT schemes on fixed grids (see, e.g. Balsara & Spicer 1999).
2.3.1 Remapping
During one timestep to the next, the moving Voronoi tessellation may change connectivity, resulting in faces appearing and disappearing. A face that appears at the end of a timestep poses no large issue for preserving |$\nabla \cdot {\boldsymbol {B}}=0$| because it can be treated as coming from a degenerate face of area and magnetic flux 0 during the previous step. The nice cancellation property of the update terms for the magnetic fluxes of the faces of a cell in the calculation of the divergence still holds. A bigger concern is the disappearance of a face. In the continuous limit, the flux through the face should go to 0 as the face disappears, since its area goes to zero. But in our discretization, a vanishing face would have some small amount of residual flux that would not be properly accounted after the face disappears in the next timestep, and this would result in a breakdown of the CT method. However, this issue can be redressed by using a remapping technique, described here.
The approach taken in this work is to remap the geometry slightly at the beginning of each timestep in the cases where mesh connectivity changes. A face that is identified to disappear is mapped to a degenerate point at the centroid of the face (i.e. one can think of shrinking the face to a degenerate point at the centroid and remapping the magnetic fluxes through the faces). The remapping is illustrated in Fig. 2. The vanishing face touches two cells. For each touching cell, the flux through the vanishing face is equally distributed to the two faces that touch this face. This technique preserves |$\nabla \cdot {\boldsymbol {B}}=0$| exactly to machine precision. The method does require that the connectivity between timesteps does not change drastically; that is, if a face disappears then its surrounding neighbouring faces are not allowed to change connectivity. This is always possible in the limit of small timesteps since the Voronoi mesh evolves continuously. After each timestep, we are required to check that the connectivity has not changed too drastically, and if it did, then the current timestep is halved until the mesh evolves in a satisfactory way. This is typically a rare occurrence in our test problems because the CFL condition does limit the size of the timestep and typically 0 or 1 faces appear/disappear in a cell. But more sophisticated techniques can be employed to improve the efficiency of the algorithm and avoid this halving of timesteps (see Section 4.2).

During one timestep (left) and the next (right), the connectivity between cells in the moving Voronoi mesh may change. In such a case, a face disappears (thick black line). The geometry at the beginning of the timestep is remapped by adding a degenerate vertex (yellow star) at the mid-point of the face that is to disappear and connecting the surrounding faces (red-dashed lines) to it. The magnetic flux through the vanishing face is redistributed to the faces shown in red-dashed lines. The connectivity of the mesh is not permitted to change too drastically from one timestep to the next: if a face disappears, there must be remaining neighbouring faces that do not change connectivity to which the flux is redistributed. Voronoi diagrams change continuously, so drastic changes can always be avoided by taking the timestep small enough.
2.3.2 Extension to 3D
The method described here is generalizable to three dimensions. In the 3D case, the boundaries of a face are a polygon rather than two points. Thus when updating the magnetic fluxes one needs to perform a loop integral over the boundary, just as in the regular CT method. The key difference is to estimate the electric fields in the rest frames of the centroid of each linear segment of the loop. An edge at the end of the timestep may not have been present at the beginning of the timestep, in which case in order to estimate its velocity it can be considered as a ‘degenerate face’ (a single point) in the previous Voronoi tessellation. In the remapping step, the magnetic flux through a face that disappears may be equally redistributed to all the faces that touch the vanishing face, and the face that disappears is shrunk down to its centroid.
In short, the key ideas necessary for extending CT to an arbitrary moving mesh are to always calculate electric fields in the moving frame of the edge and to remap the magnetic fluxes of faces that disappear to the neighbouring faces.
3 NUMERICAL TESTS
3.1 Orszag–Tang vortex
We show the results of the moving CT method at resolution 642, and compare it with a static CT approach on a hexagonal grid, and the moving Powell cleaning scheme. Plots of the density and magnetic energy density are shown in Figs 3 and 4.1 All the methods produce qualitatively similar results. Fig. 5 shows that the moving CT method converges to the solution of a high-resolution (5122) static CT technique at the same rate as the static CT method (first-order convergence is observed due to the presence of shocks, which results in gradients that are slope limited). The errors in the moving CT method are slightly less than the static CT approach, which can be attributed to the moving method's better control of advection.

A comparison of various numerical methods used to evolve the Orszag–Tang test at t = 0.2. Shown are the moving CT methods (with Rusanov and HLLD flux solvers), the static CT method (on a hexagonal grid with an HLLD solver), and the moving Powell method (with Rusanov and HLLD flux solvers). Plotted are the density, pressure, magnetic energy density, and relative divergence error of the magnetic fields (compared to fluid pressure). For the CT schemes, the divergence errors are of the order of machine precision ∼10−15, so they are much smaller than the minimum colour value indicated (10−6) by the colour bar.


The convergence rate of the moving and static mesh CT methods and the moving Powell method for the Orszag–Tang test at t = 0.2. Both show first-order convergence, as expected due to the presence of shocks which limits some of the slopes and reduces the second-order method to first order. The moving mesh approach shows slightly smaller errors.
It is worth pointing out that the moving CT scheme that uses the HLLD solver produces less smooth solutions at late times once strong shocks break out in the simulation (t = 0.5, see Fig. 4) in the density field (but not any of the other fluid variable fields) compared to the other methods. This is attributable to the moving mesh nature of the code and using an approximate Riemann solver: small errors in the density field advect with the flow and do not diffuse. More diffusive approaches, such as using a Rusanov flux solver, or a Powell cleaning scheme with HLLD, or a static CT HLLD solver, produce a smoother density field.
We verify that the average relative magnetic field divergence errors of a cell are zero to the level of machine precision in Fig. 6. The average relative divergence errors of a moving mesh approach with the Powell cleaning scheme is on the order of 10−3, and a few individual cells can have errors greater than order unity.

The average relative magnetic field divergence errors in the moving CT approach are kept to 0 at the level of machine precision, while the Powell cleaning scheme shows an average error of 10−3 for the Orszag–Tang test. The Powell cleaning scheme may even demonstrate relative errors of the order of unity in a few individual cells at a given time (Fig. 4).
3.1.1 Galilean invariance
We demonstrate that our method is less susceptible to being dominated by truncation errors under a Galilean boost than static mesh approaches. Our technique also requires less strict timestep criteria, due to the Lagrangian nature of our method (fluxes are always solved in the rest frames of faces/edges). We boost the x-direction velocities in the initial conditions of the Orszag–Tang test by a velocity of 10 (corresponding to a Mach number of 10), and compare the moving and static CT approaches at t = 0.5. The results are shown in Fig. 7. The moving mesh approach maintains symmetry to a greater degree and has less diffusion (in the static CT approach, the overdense regions near at x = 0.5, y = 0.1, 0.9 are diffused when the Galilean boost is applied). Such unwanted numerical artefacts could lead to potential inaccuracies in, for example, the study of density distribution functions to understand supersonic turbulence and the collapse of high-density material in the formation of stars. We note that the errors in the fixed grid CT approach can be reduced with sufficiently high resolution, however, this may not always be attainable with limitations on computational performance. We also show the results of the moving Powell scheme, whose solution is also largely unaffected by the velocity boost, due to its Lagrangian nature (although, as we show in Section 3.2, the Powell scheme loses some of its Galilean-invariant properties due to its source terms).

The density field of the Orszag–Tang test at t = 0.5 with initial conditions boosted by a Mach number of 10 solved using the moving CT approach (left), the fixed grid CT approach (second from left), and the moving Powell cleaning scheme (third from left), compared to the solution obtained with a fixed grid CT solver and no boost in the initial conditions (right). The moving mesh approach shows less diffusion and more symmetry with the boost applied than the fixed grid approach, due to its Lagrangian nature.
3.2 Advection of a magnetic loop
We compare the moving CT method to a fixed grid flux-interpolated CT method and the moving Powell method. For the moving mesh, we use a hexagonal grid of resolution 642 and for the fixed grid we use a Cartesian grid with resolution of 642. A plot of the evolution of the average magnetic energy density |$\frac{1}{2}{\boldsymbol {B}}^2$| is shown in Fig. 8, along with the magnetic energy density at time t = 2.2. The moving mesh CT approach does incredibly well. It preserves the advection of the solution to machine precision, due to its Lagrangian properties. The magnetic energy density does not decay at all with time but rather stays constant. This is independent of the resolution used to simulate the advecting loop. In comparison, the fixed grid approach shows diffusivity and unphysical structures and asymmetries develop in the energy density. The magnetic energy density decays with time. These errors can be lessened by increasing the resolution of the run, but never fully eliminated in the fixed grid approach. The moving Powell cleaning scheme also shows diffusivity since it is not fully Galilean invariant due to the addition of source terms. It does, however, maintain symmetry since the problem is solved in the rest frame of the motion of the loop.

Plots of the magnetic energy density in the advection of a field loop test at the initial condition t = 0 (top left) and the advected solution at t = 2.2 for a moving CT approach (top right), a static CT approach (bottom left) and a moving Powell approach (bottom right). The moving CT approach advects the initial conditions to machine precision. The fixed grid CT approach on the other hand shows diffusion and develops asymmetries and unphysical structures. The moving Powell scheme also shows diffusivity due to the presence of source terms. The average magnetic energy density stays constant in the moving CT approach (agreeing with the exact solution) while it decays with the static CT and moving Powell approaches (bottom).
3.3 Strong Shock
We simulate a 1D strong MHD shock on a 2D domain. The initial left state is |$(\rho , v_{||}, v_\perp , p, B_{||}, B_\perp ) = (1,10,0,20,5/\sqrt{4\pi },5/\sqrt{4\pi })$| and the initial right state is |$(\rho , v_{||}, v_\perp , p, B_{||}, B_\perp ) = (1,-10,0,1,5/\sqrt{4\pi },5/\sqrt{4\pi })$| for this Riemann problem, with adiabatic index γ = 5/3, and is found in Tóth (2000). The shock is set up to travel at an angle 30° with respect to a line of symmetry of the mesh. This Riemann problem has the exact solution where B|| stays constant throughout the different shock regions during the evolution of the shock.
The shock is simulated with the moving CT, static CT, and moving Powell approaches, and the results of the evolved parallel component of the magnetic field are shown in Fig. 9, for resolutions of 64 and 256 cells along the direction of the shock in a domain of length 1. The results show that the non-conservative Powell approach performs the worst, producing incorrect jump conditions across discontinuities due to the cleaning source terms. The depth of the deviations from the exact solution does not disappear with increased resolution. The CT schemes do much better. They also have errors across discontinuities, but they are smaller and oscillate around the exact solution, and therefore can be more reliably used to simulate strong shocks.

The parallel component of the magnetic field across the shock for our moving CT, static CT, and moving Powell schemes at t = 0.01. Thick solid and thin dashed lines correspond to resolutions of 256 and 64, respectively. Both CT approaches recover the exact solution with some spiked error at the discontinuity, as well as some oscillating errors in the rest of the domain which can be reduced with increased resolution. The moving Powell approach, however, produces incorrect jump conditions due to its non-conservative formulation, which expand with the shock and do not disappear with increased resolution.
4 DISCUSSION
4.1 Importance of ∇ · B = 0
A divergence-free (solenoidal) magnetic field means that there are no field lines that meet at monopolar singularities. By Stokes’ theorem, there is no net magnetic flux out of any enclosed surface. The use of Stokes’ theorem to rewrite the |$\nabla \cdot {\boldsymbol {B}}=0$| condition is the key to CT. Numerical methods which do not ensure the divergence of B is kept small violate these properties which can lead to errors in the flow or even severe numerical instabilities in the solution. A plain finite volume scheme for the MHD equation can be unstable. Cleaning schemes do keep the divergence small enough so that the methods remain stable (at the cost of conserving the fluid variables, which may lead to convergence to the wrong answer). CT schemes offer a better discretization than finite volume approaches that maintains |$\nabla \cdot {\boldsymbol {B}}=0$| without any modification to the MHD equations or loss of conservation.
Large divergences in the magnetic fields make a simple MHD solver unstable, which is why CT or cleaning schemes need to be applied. Tóth (2000) carries out an extensive comparison of CT and divergence cleaning schemes on fixed grids. The largest problem identified with the Powell cleaning scheme is that the method is non-conservative, which may cause incorrect jump conditions occasionally. CT schemes on the other hand are conservative, divergence free, robust, and more accurate.
4.2 Variations and extensions of the method
There are several ways to modify the CT scheme described above, which we sketch here. For example, the halving of the timestep in the cases where two or more neighbouring faces disappear in the same timestep may be avoided if one remaps all the edges of the connected disappearing faces to a single degenerate point and redistributes the fluxes of the vanishing faces to the neighbouring faces that do not disappear (this requires implementing a more involved remapping scheme). Alternatively, one could also invent a scheme where only faces that maintain connectivity throughout a timestep and share no edge with a face that disappears are updated at the end of the timestep, and a reconstruction scheme is used at the end of the timestep to create second-order estimates of the magnetic flux through faces that have appeared.
There are different ways one could obtain the estimate of the electric field at the edges of the cells. One could easily use a field-interpolated approach instead of the flux interpolated approach taken here.
The estimation of the cell-average magnetic fields from the face average fluxes is also free to be modified, and perhaps more accurate ones can be developed (our choice of mapping works well for regularized meshes). The gradient estimation of the magnetic fields in the reconstruction step may also be improved. For example, one may use some sort of local projection scheme on to a divergence-free basis.
Additionally, one could use a second-order accurate estimate for the velocity of the edges in the mesh that appear at the end of the timestep rather than calculating it exactly, which would mean that the geometrical information of the mesh at the beginning and end of the timestep would not have to be kept in memory at the same time.
We have highlighted some of the various modifications possible to the basic framework which can be explored in future work to optimize the moving mesh CT strategy. The goal of our current paper is to lay out the basic theoretical framework for the method. The basic strategy for maintaining |$\nabla \cdot {\boldsymbol {B}}=0$| is straightforward: update magnetic fluxes across face cells using any second-order accurate of the electric field in the rest frames of the edges, and remap faces that disappear across a timestep by shrinking them to a degenerate point.
4.2.1 Adaptive timestepping
Extending the moving CT method presented above to have adaptive timestepping through an efficient, local method is a goal for future research. We have not yet implemented such a scheme, but describe here general approaches and also additional challenges not found in the case of static meshes. An effective adaptive timestepping method for a moving mesh would likely use a power-of-two hierarchical time-binning procedure (Springel 2010), which accounts for Voronoi cells changing their volume throughout the simulation and maintains the stability and conservation laws of the fluid solver. The basic idea is simple: place the cells in a nested hierarchy of cells with partial synchronization. Active cells in a timestep use their current fluid quantities in the interpolation step and inactive ones are simply advected and use their most recently calculated fluid quantities in the interpolation step so that the Riemann problem may be solved across the cells. The flux is always added to both cells to maintain the conserved quantities. So an inactive cell i has flux added to it across faces shared with neighbouring cells in smaller timestep bins. Advecting inactive cells maintains self-consistency of the connectivity of the Voronoi diagram as it is reconstructed at various timestep hierarchy levels.
The idea can be extended to the moving CT approach. The electric fields at an edge need to be estimated at the smallest timestep that any of the faces that join the edge fall into. The change in magnetic flux: Δt E (with the appropriate sign due to orientation) then needs to be applied to all the faces (including inactive ones) that join the electric field in order to maintain the divergence free condition. This idea works straightforwardly in the cases that no changes in mesh connectivity take place across timesteps, and even in the cases where all the cells which experience a change in connectivity fall into in the same timestep bin. However, special care has to be taken to resolve a change in connectivity that occurs between cells that fall into different timestep bins, since faces that are surrounded by inactive cells may appear and their magnetic flux through the face has to be accurately calculated and stored with the inactive cells, and additionally inactive cells may lose a face and thus a remap involving inactive cells is required. Thus each timestep bin would have to be adaptive to accommodate inactive cells that change the number of faces. Our current choice of using rare timestep halving in cases where the connectivity changes too much also complicates the issue, and thus a more involved remapper (Section 4.2) is preferred. The development of the details of an adaptive timestepping scheme is left for future work.
5 CONCLUDING REMARKS
We have presented a new, stable, accurate, and robust CT scheme for solving the MHD equations on a moving unstructured mesh which is conservative and preserves the divergence of the magnetic field to zero at the level of machine precision. Such a CT scheme for a moving mesh has been claimed to be difficult to construct, maybe even impossible, by other authors (Duffell & MacFadyen 2011; Pakmor et al. 2011; Pakmor & Springel 2013), but we have demonstrated that the scheme can be achieved. The CT method significantly improves the other current methods used to evolve the MHD equations on unstructured meshes and moving meshes, which are not necessarily conservative and can show large divergence errors and incorrect shock jump conditions. The new numerical method also has significant advantages over CT approaches on a fixed grid. Namely, our method is a quasi-Lagrangian scheme and greatly reduces advection errors. In pure advection flows, it preserves the solution at the level of machine precision, which is a uniquely powerful feature of the method. Due to the moving mesh formulation, the method is also automatically adaptive in its resolution. Additionally, Galilean boosts/large velocities in the flow affect the truncation errors to a significantly smaller extent than in fixed grid codes due to the Galilean-invariant properties of the moving mesh code. It is vital to construct a moving mesh code that preserves |$\nabla \cdot {\boldsymbol {B}}=0$| to machine precision, otherwise if differences between moving and fixed grid MHD codes are observed it becomes difficult to tell whether it is due to the advantages of moving mesh codes (such as better treatment of advection) or to the non-zero divergence errors that exist in the solution.
The new method offers new exciting possibilities of simulating MHD flows more accurately than before. One particular application it is well suited for is the study of supersonic MHD turbulence. Here the flow has high Mach number velocities so fixed grid codes experience very restrictive timestep criteria, which can be lessened on a moving mesh. Additionally, advection errors would be reduced to a significant degree in moving mesh CT simulations. An analytic theory for supersonic MHD turbulence is virtually non-existent and numerical simulations are considered the best framework for studying this problem, necessitating numerical methods that minimize any unphysical effects of numerical errors on the solution. The moving mesh CT approach is a very viable candidate for this task.
The moving mesh CT method is also well suited for studying astrophysical problems where advection is important. Most simulations, from accretion disc simulations to cosmological simulations, have regions that are only marginally resolved due to limitations in computational resources. As we see from our low-resolution simulations of advection, the solution in static CT methods and moving mesh methods with divergence cleaning schemes can have large diffusion errors which can be reduced only with higher resolution simulations. The moving CT approach, however, is able to accurately advect the solution to machine precision, which is one of the main benefits of the method.
This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under grant no. DGE-1144152. LH acknowledges support from NASA grant NNX12AC67G and NSF award AST-1312095. PM would like to thank Paul Duffell for insightful discussions on the manuscript.
Animations of the simulations are available at https://www.cfa.harvard.edu/pmocz/research.html