A&A 486, 655-662 (2008)
DOI: 10.1051/0004-6361:200809800
S. Shelyag - V. Fedun - R. Erdélyi
Solar Plasma Physics Research Centre, Department of Applied Mathematics, University of Sheffield, Hicks Building, Hounsfield Rd., Sheffield, S7 3RH, UK
Received 17 March 2008 / Accepted 8 May 2008
Abstract
Aims. We describe a newly-developed magnetohydrodynamic (MHD) code with the capacity to simulate the interaction of any arbitrary perturbation (i.e., not necessarily limited to the linearised limit) with a magnetohydrostatic equilibrium background.
Methods. By rearranging the terms in the system of MHD equations and explicitly taking into account the magnetohydrostatic equilibrium condition, we define the equations governing the perturbations that describe the deviations from the background state of plasma for the density, internal energy and magnetic field. We found it was advantageous to use this modified form of the MHD equations for numerical simulations of physical processes taking place in a stable gravitationally-stratified plasma. The governing equations are implemented in a novel way in the code. Sub-grid diffusion and resistivity are applied to ensure numerical stability of the computed solution of the MHD equations. We apply a fourth-order central difference scheme to calculate the spatial derivatives, and implement an arbitrary Runge-Kutta scheme to advance the solution in time.
Results. We have built the proposed method, suitable for strongly-stratified magnetised plasma, on the base of the well-documented Versatile Advection Code (VAC) and performed a number of one- and multi-dimensional hydrodynamic and MHD tests to demonstrate the feasibility and robustness of the code for applications to astrophysical plasmas.
Key words: methods: numerical - magnetohydrodynamcs (MHD) - plasmas - Sun: general
Plasma embedded in magnetic field can often be described by the equations of compressible magnetohydrodynamics (Alfvén 1942). Due to the highly non-linear nature and intrinsic complexity of these equations, numerical simulations are often the only way to obtain an in-depth knowledge about macroscopic physical processes taking place in magnetised non-uniform turbulent plasmas (e.g., Brandenburg 2003; Nordlund 1985; Chan et al. 1982).
Various numerical schemes have been proposed for MHD simulations and are circulating in the literature. The wide range of methods is mainly down to their challenging imperfectness: on the one hand, one has to care about the numerical stability of a solution, whereas on the other hand, the solution has to be physically correct. Without pretending to construct the only perfect method to solve the MHD equations numerically, we aim to find a technique that will allow us to perform simulations of non-linear processes in a magnetised plasma with the presence of external gravitational field.
In general, the numerical schemes working on a spatial domain may be divided into several types based on the way the schemes keep up with numerical stability and resolve the physical processes within the domain. Riemann type solvers successfully exploit an analytical solution obtained locally (Roe 1981; Dai & Woodward 1994). The need to develop a new Riemann solver when additional physics is necessary (e.g., for new types of wave modes) is often called to be the main disadvantage of these numerical schemes (Nordlund & Galsgaard 1995). Total variation diminishing (TVD) schemes (Tóth 1996; Harten 1983; van Leer 1979) aim at maintaining numerical stability of the solution by preserving its monotonicity, however, these schemes are often too diffusive, which results in the computational solution being smeared over the spatial domain (Tóth et al. 1998).
The possibility of controlled diffusion acting only on small scales, introduced to assure numerical stability of a computational solution at the lowest possible spatial scales for turbulent high Reynolds number plasma, has been demonstrated and is used widely (Vögler 2003; Vögler et al. 2005; Caunt & Korpi 2001; Nordlund & Galsgaard 1995; Stein & Nordlund 1998). However, in the case of a stable, gravitationally-stratified plasma, especially in regions of strong stable stratification that occurs, for example, in the upper photosphere or at the transition region of the Sun, this approach, as well as others, such as TVD or Riemann solver based numerical schemes, introduce a small but unavoidable large scale numerical diffusion. Consequently, this diffusion often leads to the violation of the desired magnetohydrostatic equilibrium in the model and to the generation of an unphysical flux tending to smear the background model (Tóth 1996; Boris & Book 1973). Flux corrected transport (FCT) schemes with strong anti-diffusion terms have shown a better behaviour (Boris & Book 1973; Erdélyi & James 2004). However, due to the larger and multi-dimensional numerical stencil (Zalesak 1979), these schemes may be more difficult for domain decomposition for parallelisation purposes. Also, it has been reported that some spurious oscillations may occur when using such a scheme (Tóth 1996).
The inevitable diffusion may forbid the robust advancement of the simulation of a non-linear phenomenon in gravitationally-stratified plasma, causing MHD simulations of such a plasma often to be referred to as ``black art''. This is definitely not the case for linear MHD simulations, since they mainly describe small deviations from a stable background state (Khomenko & Collados 2006; Parchevsky & Kosovichev 2007). Mixing the two approaches of hyperdiffusion and linearised MHD simulations, and removing the linear limit requirement, we aim to construct a novel method that will allow us to perform simulations of both linear and non-linear processes in strongly-stratified media from fluids to magnetised plasmas.
We describe a numerical MHD tool that allows us to simulate the interaction of any arbitrary perturbation (not necessarily limited to the linearised regime) with the background plasma in magnetohydrostatic equilibrium. The MHD equations for the perturbations of density, internal energy and magnetic field strength are redefined by taking into account the magnetohydrostatic equilibrium condition. Hyperdiffusion and hyperresistivity are implemented to achieve numerical stability of the computed solution of the MHD equations. We found it advantageous to use this, apparently more complex form of the MHD equations for numerical simulations of processes in a stable gravitationally-stratified plasma and implemented the method on the base of the well-known Versatile Advection Code (VAC; Tóth 1996). A number of standard tests are performed to demonstrate the feasibility and robustness of the technique. The imminently planned scientific application of the code is to use it in studies of propagation of (magneto)acoustic waves in the solar sub-photosphere in the presence of time- and spatially-dependent background flows or sound speed perturbations (Shelyag et al. 2007,2006), and conversion of linear to non-linear waves in the stratified solar corona (Fedun & Erdélyi 2008).
The paper is organized as follows. In the next section we describe the modified MHD equations and their proposed numerical implementation. Numerical tests of the code are presented in the third section of the paper. A range of future use of the method is discussed briefly in the last section.
The governing equations of full ideal compressible MHD in their conservative form are:
Without loss of generality we split the variables ,
e, and
into their
background and perturbed components:
Also, we assume a magnetohydrostatic equilibrium of the background state of the
magnetised plasma in the computational domain with the presence of an external
gravity field :
A fourth order central difference scheme is applied for the spatial derivatives and second or fourth order Runge-Kutta time advance scheme is implemented in the code. Central difference schemes are conservative due to their symmetry, and conserve the divergence of magnetic field (Vögler et al. 2005). Also, central difference schemes applied to hyperbolic equations almost always produce a spurious oscillatory behaviour, caused by the accumulation of energy on scales smaller than the grid cell size, and thus some additional stabilisation of the numerical scheme is necessary.
Numerical diffusion and resistivity are often used to stabilise computational solutions. The method has already proven its robustness and feasibility (Vögler et al. 2005; Caunt & Korpi 2001; Stein & Nordlund 1998). Even though it is described in detail in the literature, we recall briefly the main points for completeness and rewrite the method here in the terms we use to define the system of MHD Eqs. (12)-(15).
The term D in the energy equation consists of three parts:
The hyperdiffusive terms for scalar quantities are written as follows:
The hyperviscous terms for vector quantities are more complicated, i.e.:
The derivatives in the expressions Eqs. (25)-(28) are such that if the direction of the outer derivative is the same as the direction of the inner derivative, then they are calculated using the same principle as the derivatives in Eqs. (23)-(24). If the direction of the outer derivative is different from the direction of the inner derivative, then both derivatives are evaluated using a second order central difference scheme, and the viscous coefficients are interpolated to the grid cell centres.
The viscous coefficient
for the variable u in the ith direction is
expressed as
Figure 1: Standard Riemann shock tube problem snapshot at time t=0.2. The density, velocity, thermal energy density per unit mass and pressure are shown. | |
Open with DEXTER |
The time step is limited by the standard CFL condition and by the hyperdiffusion
time scale, given by the following expression:
The above outlined approach of variable separation also allows the use of more
simple boundary conditions than it was necessary when the non-split variables have
been implemented. The ``transparent'' boundary condition for the energy perturbation
now does not contain the requirement of magnetohydrostatic equilibrium, and can be
simply written as
at the boundary. This boundary
condition, in terms of the values of the function defined on the grid, can be
expressed as follows:
Similar boundary conditions are introduced for the other variables, however, in cases when a strong gradient of the background density, thermal energy, or magnetic field is peculiar to the model, we found it reasonable to apply the boundaries written for the primitive variables rather than for the conservative ones to improve the robustness of the code. Also, it should be mentioned that it is definitely possible and may even be necessary to define some higher order boundary conditions for higher precision calculations.
We use the MPI VAC code (Tóth 1996) as the basis for the implementation of the above described procedure. This version of VAC already has the MPI domain decomposition extension which, however, needed to be expanded since the hyperdiffusion and hyperresistivity modules require one additional grid cell to be copied from each neighbouring subdomain due to a larger 7-point stencil applied there.
Figure 2: Strong shock tube problem snapshot, taken at the time t=0.12. Density, velocity, thermal energy density per unit mass and pressure are shown. | |
Open with DEXTER |
Figure 3: Snapshot of Brio & Wu problem, taken at the time t=0.11. Density, velocity, thermal pressure, and the y component of magnetic field are shown. | |
Open with DEXTER |
In order to demonstrate the ability of the approach outlined in the previous section to solve the equations of magnetohydrodynamics accurately, we have performed a number of standard one-, two- and three-dimensional hydrodynamic and magnetohydrodynamic tests and compare the output with known analytical solutions or with results obtained earlier by alternative numerical schemes.
The standard one-dimensional Riemann shock tube problem is simulated as the first stage of testing (Caunt & Korpi 2001; Sod 1978). The initial conditions contain a discontinuity located at x=0.5 in this problem. To the left of the discontinuity, pressure p1=1, density , whereas pressure and density to the right of the discontinuity are p2=0.1, and , and the compression ratio is 10. The adiabatic index is set to 1.4. Magnetic field is set to zero. Density, velocity, thermal energy density per unit mass, and pressure for time t=0.2 are shown in Fig. 1. The physical domain size is equal to unity, the resolution is 256 grid cells in the direction of the shock wave propagation.
Figure 1 shows that the shock front is resolved with 3-4 grid cells, however, some unavoidable smoothing in the contact discontinuity and the rarefaction wave is present. Despite this fact, the amplitudes and the positions of the shock tube features are correct and agree well with other tests shown in the literature (e.g. Caunt & Korpi 2001; Sod 1978). Also, some small amplitude oscillations can be seen behind the shock front. These oscillations do not grow in time since they are successfully suppressed by the hyperdiffusion.
The strong shock tube test (Fig. 2) is more difficult for the numerical scheme. This case differs from the weak Riemann shock tube test described above by setting p1=10 and , thus the compression ratio is now 100. Again, most of the shock features are represented and resolved well with the simulation. The shock front is smeared over 3-4 grid cells as in the previous case. Small scale oscillations are more pronounced, however, the hyperdiffusion still ensures the stability of the model. It should also be mentioned that this realisation of the hyperdiffusion has resolved the high-energy plateau around x=0.8 more successfully, which was the problem for some previous attempts (Caunt & Korpi 2001).
Next, a test of the formation of magnetohydrodynamic shock waves is performed. The initial condition has a discontinuity at x=0.5. Parameters to the left and right of the discontinuity are set as: p1=1, p2=0.1, , , By1=1, By2=-1, Bx=0.75. The adiabatic index is set to 2. The grid resolution is set to 800 grid cells to precisely compare our results with the original work of Brio & Wu (1988). Figure 3 shows density, velocity in the direction across the discontinuity, gas pressure and the component of magnetic field along the discontinuity taken at t=0.11. The slow compound wave at x=0.475 and the contact discontinuity at x=0.55 are resolved well. The slow shock at x=0.65 is also well resolved within 3-4 grid points, and the slow shock and the fast rarefaction wave at x=0.85 and x=0.9 are noticeable. The amplitudes of the waves in the presented simulations are in perfect agreement with the amplitudes given by Brio & Wu (1988).
Figure 4: Snapshot of the plasma density of the Ország-Tang vortex problem simulation at t=0.5. | |
Open with DEXTER |
The Ország-Tang vortex (Ország & Tang 1979) is a more complicated test often used to validate a full non-linear MHD solver in two dimensions. A complex two-dimensional interaction of various types of non-linear shock waves travelling at different speeds and transition to the MHD turbulence regime imply rigorous requirements for the resolution and stability of the numerical scheme used to perform the test.
The horizontal and vertical dimensions of the domain are set to unity, and the resolution of the simulation box is 256 256 for this test problem. The adiabatic index is set to 5/3, the density and gas pressure are constants, i.e., and , the magnetic field ; ; where (the magnetic permeability is set to unity); the initial velocity is ; . The boundaries of the domain are periodic. Also, to validate the approach of splitting the variables into their background and perturbed components, we assign the background variables to contain the density, magnetic field, and magnetic and thermal energy, leaving only the kinetic component of the total energy in the perturbed component. Figure 4 shows the density snapshot at the time t=0.5. The features in the image show precise agreement with earlier simulations by, e.g., Ryu et al. (1995), Dai & Woodward (1998) or by Londrillo & Del Zanna (2000).
Kontorovich & Shelyag (2002) have calculated analytically the shape of a shock caused by a strong
uniform off-centre explosion in a non-uniform medium with background density dependence
Figure 5: Strong shock front caused by the explosion with energy in non-uniform media. The figure shows the shape of the shock at the time . | |
Open with DEXTER |
Figure 6: Two-dimensional shape of the shock front. The explosion, which caused the shock wave, is marked by cross at the point with the coordinates in the figure. | |
Open with DEXTER |
Figure 7: Snapshot of the vertical velocity structure of the simulation of the wave propagation and conversion in the non-magnetic solar chromosphere and corona taken at . Conversion of the linear waves into non-linear ones is seen at the height above . | |
Open with DEXTER |
Since we are planning to use the code presented here mainly in applications to study the physics of the magnetically-coupled solar interior, atmosphere and corona, we performed test simulations of conversion of linear waves into non-linear ones for non-magnetic and magnetic models of the strongly-stratified solar photosphere, chromosphere, transition region and corona (Fedun & Erdélyi 2008). For these simulations, the background density is taken from the VAL IIIC model (Vernazza et al. 1981) for the lower solar atmosphere that is extended towards the solar corona using the model by McWhirter et al. (1975). Then the (magneto-) hydrostatic equilibrium condition Eq. (10) is applied to obtain the background pressure . Next, the background internal energy density is determined according to Eq. (21). The physical size of the simulation domain is in the vertical direction and in both horizontal directions. The resolution is 1024 128 128 grid points. A harmonic acoustic driver is implemented just above the temperature minimum level of the initial equilibrium. The driver acts vertically with the period . The spatial extent of the driver is a smoothed Gaussian ellipsoid with the vertical axis of and horizontal axes of each.
The structure of the vertical velocity component is shown in Fig. 7 as two orthogonal vertical cuts through the three-dimensional computational domain. The snapshot captures the propagation of linear acoustic waves generated by the driver in the lower part of the non-magnetised solar chromosphere and their conversion into non-linear waves in the upper region of the model, caused by the decrease of the density and pressure there.
The vertical component of the velocity in the computational domain taken along the intersection of the cuts in Fig. 7 is shown in Fig. 8. The non-linear character of the wave propagation is clearly observed above the transition region ( ) in the figure. Also, note a change in the linear propagation of the acoustic wave at the height that is caused by a partial reflection of the upward-propagating waves from the transition region. The qualitative comparison of earlier studies in one- (De Pontieu et al. 2004), two- (Erdélyi et al. 2007; Malins & Erdélyi 2007) and the three-dimensional (Fedun & Erdélyi 2008), non-magnetic simulations with our test results shown here are in a very good agreement.
Figure 8: Vertical velocity profile, taken at the centre of the simulation box, from the simulation of the wave conversion in the solar corona taken at . The conversion of linear waves into non-linear occurs at . | |
Open with DEXTER |
Figure 9: Snapshot from the simulation of the wave propagation and conversion in magnetic solar chromosphere and corona taken at . The magnetic field, which is sketched by a cylinder in the figure, acts as a waveguide and suppresses the energy propagation outside the magnetic flux concentration. | |
Open with DEXTER |
Figure 10: Vertical velocity profile taken at the centre of the simulation box from the simulation of the wave conversion in the solar corona taken at . The conversion of linear waves into non-linear occurs at . | |
Open with DEXTER |
Finally, for testing the code for MHD wave propagation in a vertically-stratified plasma embedded in magnetic field, we select the magnetic field configuration to be a straight vertical cylinder with radius of . The strength of the magnetic field imposed in the simulation is , which corresponds to plasma at the upper layers of domain representing the solar corona.
Figure 9 demonstrates that the magnetic field acts as an excellent waveguide for the magneto-acoustic oscillations generated by the photospheric driver in the model. In agreement with previous simulations (e.g., Fedun & Erdélyi 2008), the magnetic cylinder suppresses the propagation of the waves laterally outwards from the magnetic field region, thus causing larger amplitudes of the vertical velocity profile (Figs. 9 and 10) generated by the driver of the same amplitude as in the case of the non-magnetic simulation (Figs. 7 and 8). Even a quick qualitative comparison confirms this expectation clearly.
We have presented a number of test simulations of the fully non-linear MHD code developed on the basis of the well-known VAC platform. The code, as presented here, is able to handle all standard tests well, and the produced numerical solutions are identical either to the known analytical solutions wherever such solutions are available, or to known numerical results of other authors.
The main advantage of the proposed numerical technique is that the code allows us to simulate robustly the macroscopic processes in gravitationally stratified (non-)magnetised plasmas. Not all of the presented tests are realisable with conventional numerical schemes. Particularly, the test with the strong shock wave in non-uniform media was not possible due to the enhanced numerical diffusion of the density inhomogeneity in the domain. Because of the intrinsic robustness of the proposed re-written equations derived for the perturbed variables, it is now achievable to implement a more complicated, e.g., analytically-defined magnetic field configurations such as potential or self-similar magnetic fields (e.g. Gordovskyy & Jain 2007), or even to use real magnetic structures extrapolated from the observational data (for example, derived from MDI instrument of the SOHO satellite; Marsh & Walsh 2006).
It should be pointed out that the code has no limitations of simulation length in time imposed by complications originating from the upper boundary, as, for example, occurred in similar simulations of the solar atmosphere of Hasan & van Ballegooijen (2008), where up to the first 130 s our test computations are in excellent agreement with their results. Neither do we need to implement special procedures, as has been the case in, e.g., Khomenko & Collados (2006), to treat the upper boundaries.
Since we are planning to use the code mainly for the forward modelling of helioseismological processes and for the coupling processes in the solar interior, photosphere, and corona, we have demonstrated the ability of the code to perform simulations of linear and non-linear wave propagation in the strongly-stratified solar atmosphere with the presence of magnetic field therein. Strictly speaking, it might not be necessary to have a non-linear MHD solver for helioseismological applications due to the linear nature of the solar acoustic modes, however, the code is able to properly handle this kind of physical problem, and additional filtering (Hanasoge et al. 2007) is not expected to be necessary to produce forward simulated data with high signal to noise ratios. Of course, when a magnetic coupling of the solar interior to the corona is present, non-linearity is unavoidable.
Finally, we note that there are also foreseen encouraging ways to expand the code due to its modular structure inherited from VAC, which allows us to modify and add new physics easily. To treat localised regions with strong stratification more precisely, non-uniform and time-dependent mesh should be included by using spatially and temporarily dependent weight coefficients in the finite difference representation of the derivatives in the MHD equations. For more involved small-scale simulations of the solar interior, atmosphere and corona, where the ionisation flux is large and cannot be neglected anymore, the equation of state should be expanded to incorporate the description of ionization processes in the plasma. Also, simplified constant flux boundary conditions might be replaced with more involved ones using, for example, the method of characteristics (Hansteen 2007; Rosenthal et al. 2002).
Acknowledgements
The authors thank Rony Keppens for helpful discussions and advice. This work was supported by the Rolling Grant of Science and Technology Facilities Council (STFC, UK). R.E. acknowledges M. Kéray for patient encouragement and is also grateful to NSF, Hungary (OTKA, Ref. No. K67746).