next up previous contents index
Next: 2.3 A collection of Up: 2 Equations Previous: 2.1 Basic Equations   Contents   Index


2.2 Magnetohydrodynamics (W. Schaffenberger)

The current MHD module is a reduced version of the original MHD module. The aim was to create a stable and easy to use module (see [Schaffenberger et al. (2005)]).

The module has the following features:

The original test version has the additional features:

Originally, the module included also an explicit electric conductivity and an additional energy diffusion. These were removed due to a modification of the constrained transport routine. These features may be supported again in a future version of the module.

The magnetic field is located at the cell boundaries rather than in the cell centers. Therefore, the format of the magnetic field arrays is slightly different from that of the other hydrodynamic variables.

Staggered grid representation of the magnetic field in 2 dimensions:

    +---^---+---^---+---^---+---^---+---^---+---^---+
    |       |       |       |       |       |       |
    >   *   >   *   >   *   >   *   >   *   >   *   >
    |       |       |       |       |       |       |
    +---^---+---^---+---^---+---^---+---^---+---^---+
    |       |       |       |       |       |       |
    >   *   >   *   >   *   >   *   >   *   >   *   >
    |       |       |       |       |       |       |
    +---^---+---^---+---^---+---^---+---^---+---^---+
    |       |       |       |       |       |       |
    >   *   >   *   >   *   >   *   >   *   >   *   >
    |       |       |       |       |       |       |
    +---^---+---^---+---^---+---^---+---^---+---^---+
    |       |       |       |       |       |       |
    >   *   >   *   >   *   >   *   >   *   >   *   >
    |       |       |       |       |       |       |
    +---^---+---^---+---^---+---^---+---^---+---^---+
    |       |       |       |       |       |       |
    >   *   >   *   >   *   >   *   >   *   >   *   >
    |       |       |       |       |       |       |
    +---^---+---^---+---^---+---^---+---^---+---^---+
    
* hydrodynamic variables
> x component of the magnetic field
^ y component of the magnetic field

The extension to 3 dimensions should be clear. Variables at the left or the bottom boundary have the same indices as the cell.

For a box with 120$\times$120$\times$120 cells, the headers for the magnetic field arrays in the start model may look like

real bb1 d=(1:121,1:120,1:120) f=E13.6 p=4 b=4 &
         n='cell boundary magnetic field 1' u=G*sqrt(4pi)
real bb2 d=(1:120,1:121,1:120) f=E13.6 p=4 b=4 &
         n='cell boundary magnetic field 2' u=G*sqrt(4pi)
real bb3 d=(1:120,1:120,1:121) f=E13.6 p=4 b=4 &
         n='cell boundary magnetic field 3' u=G*sqrt(4pi)

For simplicity, the MHD module uses units such that the 4 pi factors do not appear in the MHD equations.

THEREFORE YOU HAVE TO MULTIPLY YOUR ORIGINAL MAGNETIC FIELDS IN GAUSS WITH THE FACTOR 1 / SQRT(4 PI) TO GET THE CORRECT MAGNETIC FIELD STRENGTH FOR CO5BOLD!!!

AFTER THE COMPUTATION, YOU HAVE TO MULTIPLY THE MAGNETIC FIELDS FROM THE CO5BOLD OUTPUT WITH THE FACTOR SQRT(4 PI) TO GET THE MAGNETIC FIELD STRENGTH IN GAUSS!!!

The CO5BOLD analysis tool CAT does this automatically during the reading of model data, so you can use the CO5BOLD output directly with CAT.

Positivity of pressure and density:
A special problem of MHD simulations is that pressure or density can become negative in some situations. This problem is also present in pure hydrodynamic simulations but gets worse for MHD. The original hydrodynamic version of CO5BOLD tries to fix this problem by reducing the time step. In hydrodynamics, this works in most cases. In MHD, however, reduction of the time step often does not help and other methods are necessary to avoid this problem. Therefore, the MHD module uses a HLL solver instead of a Roe solver like the hydrodynamic module. It was shown numerically by Janhunen, that using a HLL solver together with additional source terms in the induction equation keeps pressure and density positive under all circumstances. Because the constrained transport step, which is performed after the 1D sweeps with the MHD solver, changes the magnetic field, a correction of the internal energy in each cell is necessary to keep the total energy conserved. Because this correction can lead to negative pressure, it is omitted if the internal energy would become too small. Therefore, the total energy is not exactly conserved but this affects only a few cells in the simulation box.

Concluding remarks:
The methods described above result in a very robust scheme which guarantees positivity of pressure and density under almost all conditions. However, this does not mean, that these values are accurate! The pressure and temperature distribution may be very inaccurate in regions with strong magnetic fields. This may be relevant, if one includes special chromospheric physics such as dynamic hydrogen ionization and CO formation in the simulation. A possibility to get more accurate pressure and temperature would be the use of the entropy equation instead of the energy equation for the computation of the internal energy in regions with strong magnetic field. This was included in the original test version of the MHD module. An other possibility is the use of the equation for the thermal energy itself. This is the dual energy approach, used in many MHD codes.

Due to the Courant condition, the time step can become considerably smaller than in the hydrodynamic case. This happens because the time step is also limited by the Alfvén speed which is large in regions with strong magnetic field and low density.

This module has been extensively tested. It should be able to handle many MHD flows of astrophysical interest. Bugs and problems can be reported to werner.schaffenberger@gmx.at.


next up previous contents index
Next: 2.3 A collection of Up: 2 Equations Previous: 2.1 Basic Equations   Contents   Index