# USING AXIAL AND TRANSLATIONAL SYMMETRY

This document describes how to properly use axial symmetry and polar grids.
It is relevant when doing simulations with **typeaxial** different from 'slab' in the **methodlist** of your parameter file.
The dimensionality of your simulation is set prior to compilation with the flags

$BHAC_DIR/setup.pl -dDC

where *D* refers to the dimensions of the grid and *C* to the number of vector components. Other than in MPI-AMRVAC, in BHAC, the use of the metric implies that always three vector components are needed. Hence even for 1D and 2D, you will need three components, hence *C=3* (yielding e.g. '2.5D' simulations).

This page:
[Symmetry]
[Boundary]

## What does Axial Symmetry Mean?

In 1 and 2D simulations, there is an inherent assumption about the behavior
of quantities in the ignored direction(s). The most usual assumption is
'slab' symmetry, i.e. all the quantities are invariant to a translation in the
ignored direction.

### Cylindrical

In 2D, one may assume a rotational invariance around some axis instead, which
gives a cylindrical symmetry, thus **typeaxial='cylindrical'** should be
selected. BHAC always assumes that the radial distance from the symmetry axis
is in the first coordinate, which can therefore be referred to as **r_**,
where **r_=1** is an integer parameter set in **src/amrvacdef.t**.
When setting
*
$BHAC_DIR/setup.pl -d=23 -z=2 -phi=3
*
the second coordinate is interpreted as the one parallel to the axis,
**z_=2**, while the ignored direction is **phi_=3** in 2.5D.
The PHI components of vector variables are then
stored in the third component in 2.5D simulations.
For 2D, the grid and the symmetry depend on the settings for the -phi and -z flags. When -d=23 -z=2 -phi=3, when all three vector components are then depending on (r,z) coordinates only. The vector components then appear in the r,z,phi order.
One can use 2D on a circular grid also with translational symmetry in the third, i.e. axial, direction by the use of *$BHAC_DIR/setup.pl -d=23 -phi=2 -z=3*. The vector components then appear in the r,phi,z order.

For 3D simulations, we recommend the following vector-ordering

$BHAC_DIR/setup.pl -d=33 -z=2 -phi=3

### Spherical

Similarly in spherical symmetry, **typeaxial='spherical'**, the invariant transformation is a rotation around the origin. Again, the first coordinate is **r_=1**.
For 2.5D, *-d=23 -z=2 -phi=3* in combination with spherical sets up a poloidal plane with quantities depending on (r,theta) alone. Note that internally, the index *z_* is synonymous with the theta-direction when using spherical coordinates. You can also run spherical coordinates in a 2.5D equatorial plane with the setting *-d=23 -phi=2 -z=3*.
Again, for 3D simulations, we recommend the following vector-ordering

$BHAC_DIR/setup.pl -d=33 -z=2 -phi=3

## Boundary at the Symmetry Axis

The symmetry axis is actually a special case of periodicity.
For 3D cylindrical and spherical grid computations, the singular polar axis is trivially handled using a so-called pi-periodic boundary treatment, where periodicity across the pole comes from the grid cell diagonally across the pole, i.e. displaced over pi instead of 2 pi. These are automatically recognized from the typeaxial setting, if the radial range starts at zero. The corresponding range in angle phi must span 2 pi for cylindrical, and theta must then start at zero (to include the north pole) and/or end at pi (for the south pole) for spherical grids. The user just needs to set the typeB as if the singular axis is a symmetry boundary (using symm and asymm combinations). **There is one important restriction: the number of grid blocks must be even around the pole.**
Implementation details on the pi-periodic (staggered) boundary conditions can be found in Olivares et al. (2019).