The Stagger Code for Accurate and Efficient, Radiation-Coupled MHD Simulations

Robert F. Stein,Åke Nordlund,Remo Collet,Regner Trampedach
2024-05-04
Abstract:We describe the Stagger Code for simulations of magneto-hydrodynamic (MHD) systems. This is a modular code with a variety of physics modules that will let the user run simulations of deep stellar atmospheres, sunspot formation, stellar chromospheres and coronae, proto-stellar disks, star formation from giant molecular clouds and even galaxy formation. The Stagger Code is efficiently and highly parallelizable, enabling such simulations with large ranges of both spatial and temporal scales. We, describe the methodology of the code, and present the most important of the physics modules, as well as its input and output variables. We show results of a number of standard MHD tests to enable comparison with other, similar codes. In addition, we provide an overview of tests that have been carried out against solar observations, ranging from spectral line shapes, spectral flux distribution, limb darkening, intensity and velocity distributions of granulation, to seismic power-spectra and the excitation of p modes. The Stagger Code has proven to be a high fidelity code with a large range of uses.
Instrumentation and Methods for Astrophysics
What problem does this paper attempt to address?
The problem that this paper attempts to solve is to develop and validate an efficient and accurate simulation platform for handling complex astrophysical phenomena involving magnetohydrodynamic (MHD) systems. Specifically, the Stagger Code aims to simulate a wide range of astrophysical scenarios, including but not limited to stellar atmospheres, sunspot formation, stellar chromospheres and coronas, protostellar disks, star formation, and galaxy formation. ### Main problems 1. **Accurately simulate complex astrophysical systems**: Traditional analytical methods are often powerless when dealing with these complex systems, so numerical simulations are required to analyze and interpret observational data. 2. **Efficient parallel computing capabilities**: In order to be able to perform simulations on large - scale time and space scales, the code needs to have efficient parallelization capabilities to adapt to various computing platforms from personal computers to supercomputers. 3. **Integration of multi - physics modules**: In order to simulate different astrophysical phenomena, the code needs to integrate multiple physics modules, such as radiation transfer, heat conduction, viscous effects, etc., and ensure that the interactions between these modules can be accurately described. ### Solutions - **Modular design**: The Stagger Code adopts a modular design, which can flexibly add or remove different physics modules to meet different research needs. - **Efficient parallelization**: By using MPI (Message Passing Interface), the code can efficiently allocate tasks among multiple processors, thereby greatly improving computational efficiency. - **Multi - scale simulation**: The code can handle physical processes from the micro - scale to the macro - scale and is suitable for different levels of astrophysical phenomena. - **Verification and testing**: By comparing with standard MHD tests and solar observational data, the high - fidelity and reliability of the code are verified. ### Key formulas 1. **Mass conservation equation**: \[ \frac{\partial \rho}{\partial t}=-\nabla\cdot(\rho\mathbf{u}) \] where \(\rho\) is the density and \(\mathbf{u}\) is the velocity. 2. **Momentum conservation equation**: \[ \frac{\partial(\rho\mathbf{u})}{\partial t}=-\nabla\cdot(\rho\mathbf{u}\mathbf{u})-\nabla P-\rho\mathbf{g}+\mathbf{J}\times\mathbf{B}-2\rho\mathbf{\Omega}\times\mathbf{u}-\nabla\cdot\tau_{\text{visc}} \] where \(P\) is the pressure, \(\mathbf{g}\) is the acceleration due to gravity, \(\mathbf{B}\) is the magnetic field, \(\mathbf{J}=\nabla\times\mathbf{B}/\mu\) is the current density, \(\mu\) is the magnetic permeability, \(\mathbf{\Omega}\) is the angular velocity, and \(\tau_{\text{visc}}\) is the viscous stress tensor. 3. **Internal energy change equation**: \[ \frac{\partial(\rho e)}{\partial t}=-\nabla\cdot(\rho e\mathbf{u})-P(\nabla\cdot\mathbf{u})+Q+Q_{\text{visc}}+\eta J^{2} \] where \(e\) is the internal energy per unit mass, \(Q\) is the heating or cooling term, \(Q_{\text{visc}}\) is the viscous dissipation term, and \(\eta\) is the resistivity. 4. **Induction equation**: \[ \frac{\partial\mathbf{B}}{\partial t}=-\nabla\cdot \]