Calculate Squashing Factor and Twist Number

Rui Liu and Jun Chen

We have developed a computationally fast code to calculate the squashing factor \(Q\) and the twist number \(\mathcal{T}_w\), introduced in Liu et al. 2016, ApJ, 818, 148 (arXiv: 1512.02338).

Please address comments and suggestions to Prof. Rui Liu or Mr. Jun Chen

Note: IDL procedures included in SolarSoft Ware are not specified here.
qfactor.proCalculate the squashing factor Q and twist number Tw at the photosphere or at a cross section or in a box volume, given a 3D magnetic field with uniform grids in Cartesian coordinates, calling the Fortran module qfactor.f90 (version 2016.06.22)
check_slash.proAdd delimiter to the end of directory paths
doppler_color.proLoad a color table of blue --> red
doppler_color_mix.proLoad a color table of blue -> red -> green -> yellow
rev_true_image.proreform a true-color image of (m x n x 3) to (3 x m x n), as required by IDL's write_png
sign2d.proReturn the signs (+/-) of each element of a 2D array
qfactor.f90Fortran module to do the calculation; If compiled by ifort: ifort -o qfactor qfactor.f90 -parallel -openmp -mcmodel=large
trace_bline.f90Fortran module to do the field line tracing

Definition of \(Q\)

For a mapping defined by the two footpoints of a field line $$\Pi_{12}: \mathbf{r}_1(x_1,\ y_1)\mapsto \mathbf{r}_2(x_2,\ y_2),$$ the Jacobian matrix associated with the mapping is \[ D_{12}=\left[\frac{\partial \mathbf{r}_2}{\partial \mathbf{r}_1}\right]= \begin{pmatrix} \partial x_2/\partial x_1 &\partial x_2/\partial y_1 \\ \partial y_2/\partial x_1 & \partial y_2/\partial y_1 \end{pmatrix} \equiv \begin{pmatrix} a & b \\ c & d \end{pmatrix}, \] and then the squashing factor associated with the field line is defined as (see Titov et al. 2002) \[ Q\equiv \frac{a^2+b^2+c^2+d^2}{|B_{n,1}(x_1,y_1)/B_{n,2}(x_2,y_2)|}, \] where \(B_{n,1}(x_1,y_1)\) and \(B_{n,2}(x_2,y_2)\) are the components normal to the plane of the footpoints, in our case, the photosphere, and their ratio is equivalent to the determinant of \(D_{12}\).

Definition of \(\mathcal{T}_w\)

\(\mathcal{T}_w\) can be used to measure how many turns two infinitesimally close field lines wind about each other (see Eq. (16) in Berger and Prior 2006) \[ \begin{eqnarray} \mathcal{T}_w&=&\int_L\frac{\mu_0J_\parallel}{4\pi |B|}\,dl = \int_L\frac{\nabla\times\mathbf{B}\cdot\mathbf{B}}{4\pi B^2}\,dl \label{eq:Tw} \\ &=&\frac{1}{4\pi}\int_L \alpha\,dl, \quad \text{if } \nabla\times\mathbf{B}=\alpha \mathbf{B}, \label{eq:Tw_alpha} \end{eqnarray} \] where \(\alpha\) is the force-free parameter, and \(\nabla\times\mathbf{B}\cdot\mathbf{B}/4\pi B^2\) can be regarded as a local density of twist along the field line.