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 Dr. Jun Chen
Procedure | Description | |
---|---|---|
qfactor.pro | Calculate 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.pro | Add delimiter to the end of directory paths | |
doppler_color.pro | Load a color table of blue --> red | |
doppler_color_mix.pro | Load a color table of blue -> red -> green -> yellow | |
rev_true_image.pro | reform a true-color image of (m x n x 3) to (3 x m x n), as required by IDL's write_png | |
sign2d.pro | Return the signs (+/-) of each element of a 2D array | |
qfactor.f90 | Fortran module to do the calculation; If compiled by ifort: ifort -o qfactor qfactor.f90 -parallel -openmp -mcmodel=large | |
trace_bline.f90 | Fortran module to do the field line tracing |
As of Jan 25, 2022, an optimized version is available below
Procedure | Description | |
---|---|---|
qfactor.pro | Similar to the previous version | |
qfactor.f90 | Fortran module to do the calculation; Can be compiled either by ifort or gfortran: ifort -o qfactor.x qfactor.f90 -fopenmp -mcmodel=large -O3 -xHost -ipo; gfortran -o qfactor.x qfactor.f90 -fopenmp -mcmodel=large -O3 | |
trace_bline.f90 | Fortran module to do the field line tracing. In stead of the classic RK4 as in the previous version, RKF45 (Fehlberg 1969) is now adopted for further optimization | |
trace_scott.f90 | Fortran module to do the field line tracing following Scott et al. 2017, ApJ, 848, 117 | |
doppler_color.pro | Load a color table of blue --> red, same as the previous version |
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}\).
\(\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.