SPEC 3.20
Stepped Pressure Equilibrium Code
Build matrices

More...

Functions/Subroutines

subroutine matrix (lvol, mn, lrad)
 Constructs energy and helicity matrices that represent the Beltrami linear system.gauge conditions More...
 
subroutine mtrxhs (lvol, mn, lrad, resultA, resultD, idx)
 Constructs matrices that represent the Beltrami linear system, matrix-free. More...
 
subroutine spsmat (lvol, mn, lrad)
 Constructs matrices for the precondtioner. More...
 

Detailed Description

Function/Subroutine Documentation

◆ matrix()

subroutine matrix ( integer, intent(in)  lvol,
integer, intent(in)  mn,
integer, intent(in)  lrad 
)

Constructs energy and helicity matrices that represent the Beltrami linear system.gauge conditions

  • In the \(v\)-th annulus, bounded by the \((v-1)\)-th and \(v\)-th interfaces, a general covariant representation of the magnetic vector-potential is written

    \begin{eqnarray} {\bf \bar A}=\bar A_{s} \nabla s + \bar A_{\theta} \nabla \theta + \bar A_{\zeta} \nabla \zeta. \end{eqnarray}

  • To this add \(\nabla g(s,\theta,\zeta)\), where \(g\) satisfies

    \begin{eqnarray} \begin{array}{cccccccccccccccccccccccccccccccccccccc} \partial_s g( s,\theta,\zeta) & = & - & \bar A_{s }( s,\theta,\zeta) \\ \partial_\theta g(-1,\theta,\zeta) & = & - & \bar A_{\theta}(-1,\theta,\zeta) \\ \partial_\zeta g(-1, 0,\zeta) & = & - & \bar A_{\zeta }(-1, 0,\zeta). \end{array} \end{eqnarray}

  • Then \({\bf A}={\bf \bar A}+\nabla g\) is given by \({\bf A}=A_{\theta}\nabla\theta+A_{\zeta}\nabla\zeta\) with

    \begin{eqnarray} A_{\theta}(-1,\theta,\zeta) &=& 0 \label{eq:At_matrixgauge_matrix} \\ A_{\zeta }(-1, 0,\zeta) &=& 0 \label{eq:Az_matrixgauge_matrix} \end{eqnarray}

  • This specifies the gauge: to see this, notice that no gauge term can be added without violating the conditions in Eqn. \((\ref{eq:At_matrixgauge_matrix})\) or Eqn. \((\ref{eq:Az_matrixgauge_matrix})\).
  • Note that the gauge employed in each volume is distinct.

boundary conditions

  • The magnetic field is \(\sqrt g \, {\bf B} = (\partial_\theta A_\zeta - \partial_\zeta A_\theta)\;{\bf e}_s - \partial_s A_\zeta \;{\bf e}_\theta + \partial_s A_\theta \;{\bf e}_\zeta\).
  • In the annular volumes, the condition that the field is tangential to the inner interface, \(\sqrt g {\bf B}\cdot\nabla s=0\) at \(s=-1\), gives \(\partial_\theta A_\zeta - \partial_\zeta A_\theta = 0\). With the above condition on \(A_\theta\) given in Eqn. \((\ref{eq:At_matrixgauge_matrix})\), this gives \(\partial_\theta A_\zeta=0\), which with Eqn. \((\ref{eq:Az_matrixgauge_matrix})\) gives

    \begin{eqnarray} A_\zeta(-1,\theta,\zeta)=0. \end{eqnarray}

  • The condition at the outer interface, \(s=+1\), is that the field is \(\sqrt g \, {\bf B}\cdot\nabla s = \partial_\theta A_\zeta - \partial_\zeta A_\theta = b\), where \(b\) is supplied by the user. For each of the plasma regions, \(b=0\). For the vacuum region, generally \(b\ne0\).

enclosed fluxes

  • In the plasma regions, the enclosed fluxes must be constrained.
  • The toroidal and poloidal fluxes enclosed in each volume are determined using

    \begin{eqnarray} \int_S {\bf B}\cdot{\bf ds}=\int_{\partial S}{\bf A}\cdot {\bf dl}. \end{eqnarray}

Fourier-Chebyshev representation

  • The components of the vector potential, \({\bf A}=A_\theta \nabla + A_\zeta \nabla \zeta \), are

    \begin{eqnarray} A_\theta(s,\theta,\zeta) &=& \sum_{i,l} {\color{red} A_{\theta,e,i,l}} \; {\overline T}_{l,i}(s) \cos\alpha_i + \sum_{i,l} {\color{Orange} A_{\theta,o,i,l}} \; {\overline T}_{l,i}(s) \sin\alpha_i, \label{eq:At_matrix} \\ A_\zeta( s,\theta,\zeta) &=& \sum_{i,l} {\color{blue}A_{\zeta, e,i,l}} \; {\overline T}_{l,i}(s) \cos\alpha_i + \sum_{i,l} {\color{Cerulean}A_{\zeta ,o,i,l}} \; {\overline T}_{l,i}(s) \sin\alpha_i, \label{eq:Az_matrix} \end{eqnarray}

    where \({\overline T}_{l,i}(s) \) is the recombined Chebyshev polynomial in a volume without an axis, or modified Zernike polynomial in a volume with an axis (i.e. only in the innermost volume, and only in cylindrical and toroidal geometry.) , and \(\alpha_j \equiv m_j\theta-n_j\zeta\).
  • The magnetic field, \(\sqrt g \, {\bf B} = \sqrt g B^s {\bf e}_s + \sqrt g B^\theta {\bf e}_\theta + \sqrt g B^\zeta {\bf e}_\zeta\), is

    \begin{eqnarray} \begin{array}{ccccrcrcrcrcccccccccccccccccccccccccccccccccccccccccccccccccccc} \sqrt g \, {\bf B} & = & {\bf e}_s & \sum_{i,l} [ ( & - m_i {\color{blue}A_{\zeta, e,i,l}} & - & n_i {\color{red} A_{\theta,e,i,l}} & ) {\overline T}_{l,i} \sin\alpha_i + ( & + m_i {\color{Cerulean}A_{\zeta ,o,i,l}} & + & n_i {\color{Orange} A_{\theta,o,i,l}} & ) {\overline T}_{l,i} \cos\alpha_i ] \\ & + & {\bf e}_\theta & \sum_{i,l} [ ( & & - & {\color{blue}A_{\zeta, e,i,l}} & ) {\overline T}_{l,i}^\prime \cos\alpha_i + ( & & - & {\color{Cerulean}A_{\zeta ,o,i,l}} & ) {\overline T}_{l,i}^\prime \sin\alpha_i ] \\ & + & {\bf e}_\zeta & \sum_{i,l} [ ( & {\color{red} A_{\theta,e,i,l}} & & & ) {\overline T}_{l,i}^\prime \cos\alpha_i + ( & {\color{Orange} A_{\theta,o,i,l}} & & & ) {\overline T}_{l,i}^\prime \sin\alpha_i ] \end{array} \end{eqnarray}

  • The components of the velocity, \({\bf v} \equiv v_s \nabla s + v_\theta \nabla \theta + v_\zeta \nabla \zeta eta\), are

    \begin{eqnarray} v_s (s,\theta,\zeta) &=& \sum_{i,l} {\color{red} v_{ s,e,i,l}} \; {\overline T}_{l,i}(s) \cos\alpha_i + \sum_{i,l} {\color{Orange} v_{ s,o,i,l}} \; {\overline T}_{l,i}(s) \sin\alpha_i, \\ v_\theta(s,\theta,\zeta) &=& \sum_{i,l} {\color{red} v_{\theta,e,i,l}} \; {\overline T}_{l,i}(s) \cos\alpha_i + \sum_{i,l} {\color{Orange} v_{\theta,o,i,l}} \; {\overline T}_{l,i}(s) \sin\alpha_i, \\ v_\zeta (s,\theta,\zeta) &=& \sum_{i,l} {\color{blue} v_{\zeta ,e,i,l}} \; {\overline T}_{l,i}(s) \cos\alpha_i + \sum_{i,l} {\color{Cerulean} v_{\zeta ,o,i,l}} \; {\overline T}_{l,i}(s) \sin\alpha_i. \end{eqnarray}

constrained energy functional

  • The constrained energy functional in each volume depends on the vector potential and the Lagrange multipliers,

    \begin{eqnarray} {\cal F} \equiv {\cal F}[{\color{red} A_{\theta,e,i,l}},{\color{blue}A_{\zeta, e,i,l}},{\color{Orange} A_{\theta,o,i,l}},{\color{Cerulean}A_{\zeta ,o,i,l}}, {\color{red} v_{s,e,i,l}},{\color{Orange} v_{s,o,i,l}},{\color{red} v_{\theta,e,i,l}},{\color{Orange} v_{\theta,o,i,l}},{\color{blue} v_{\zeta,e,i,l}},{\color{Cerulean} v_{\zeta,o,i,l}},\mu,a_i,b_i,c_i,d_i,e_i,f_i,g_1,h_1], \end{eqnarray}

    and is given by:

    \begin{eqnarray} \begin{array}{cclcclcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc} {\cal F} & \equiv & \displaystyle \int {\bf B} \cdot {\bf B} \, dv + \int {\bf v} \cdot {\bf v} \, dv - \displaystyle \mu \left[ \int {\bf A} \cdot {\bf B} \, dv - K \right] \\ & + & & \displaystyle \sum_{i=1} & a_i & \displaystyle \left[ \sum_l {\color{red} A_{\theta,e,i,l}} T_l(-1) - 0 \right] \\ & + & & \displaystyle \sum_{i=1} & b_i & \displaystyle \left[ \sum_l {\color{blue} A_{\zeta, e,i,l}} T_l(-1) - 0 \right] \\ & + & & \displaystyle \sum_{i=2} & c_i & \displaystyle \left[ \sum_l {\color{Orange} A_{\theta,o,i,l}} T_l(-1) - 0 \right] \\ & + & & \displaystyle \sum_{i=2} & d_i & \displaystyle \left[ \sum_l {\color{Cerulean}A_{\zeta ,o,i,l}} T_l(-1) - 0 \right] \\ & + & & \displaystyle \sum_{i=2} & e_i & \displaystyle \left[ \sum_l \left( - m_i {\color{blue} A_{\zeta, e,i,l}} - n_i {\color{red} A_{\theta,e,i,l}} \right) T_l(+1) - b_{s,i} \right] \\ & + & & \displaystyle \sum_{i=2} & f_i & \displaystyle \left[ \sum_l \left( + m_i {\color{Cerulean}A_{\zeta ,o,i,l}} + n_i {\color{Orange} A_{\theta,o,i,l}} \right) T_l(+1) - b_{c,i} \right] \\ & + & & \displaystyle & g_1 & \displaystyle \left[ \sum_l {\color{red} A_{\theta,e,1,l}} T_l(+1) - \Delta \psi_t \right] \\ & + & & \displaystyle & h_1 & \displaystyle \left[ \sum_l {\color{blue} A_{\zeta, e,1,l}} T_l(+1) + \Delta \psi_p \right] \end{array} \end{eqnarray}

    where
    • \(a_i\), \(b_i\), \(c_i\) and \(d_i\) are Lagrange multipliers used to enforce the combined gauge and interface boundary condition on the inner interface,
    • \(e_i\) and \(f_i\) are Lagrange multipliers used to enforce the interface boundary condition on the outer interface, namely \(\sqrt g \, {\bf B}\cdot\nabla s = b\); and
    • \(g_1\) and \(h_1\) are Lagrange multipliers used to enforce the constraints on the enclosed fluxes.
  • In each plasma volume the boundary condition on the outer interface is \(b=0\).
  • In the vacuum volume (only for free-boundary), we may set \(\mu=0\).
  • Note: in SPEC version >3.00, the basis recombination method is used to ensure the boundary condition on the inner side of an interface. The lagrange multipliers \(a_i, b_i, c_i, d_i\) are no longer used in volumes without a coordinate singularity. In a volume with a coordinate singularity, they are used only \(a_i, c_i\) with $m=0,1$ are excluded also due to Zernike basis recombination.

derivatives of magnetic energy integrals

  • The first derivatives of \(\int \! dv \; {\bf B} \! \cdot \! {\bf B}\) with respect to \({\color{red} A_{\theta,e,i,l}}\), \({\color{Orange} A_{\theta,o,i,l}}\), \({\color{blue}A_{\zeta, e,i,l}}\) and \({\color{Cerulean}A_{\zeta ,o,i,l}}\) are

    \begin{eqnarray} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \int \!\! dv \; {\bf B} \cdot {\bf B} & = & 2 \int \!\! dv \; {\bf B} \cdot \frac{\partial {\bf B}}{\partial {\color{red} A_{\theta,e,i,l}}} = 2 \int \!\! dv \; {\bf B} \cdot \left[ - n_i {\overline T}_{l,i} \sin\alpha_i \, {\bf e}_s + {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\zeta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \int \!\! dv \; {\bf B} \cdot {\bf B} & = & 2 \int \!\! dv \; {\bf B} \cdot \frac{\partial {\bf B}}{\partial {\color{Orange} A_{\theta,o,i,l}}} = 2 \int \!\! dv \; {\bf B} \cdot \left[ + n_i {\overline T}_{l,i} \cos\alpha_i \, {\bf e}_s + {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\zeta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \int \!\! dv \; {\bf B} \cdot {\bf B} & = & 2 \int \!\! dv \; {\bf B} \cdot \frac{\partial {\bf B}}{\partial {\color{blue}A_{\zeta, e,i,l}}} = 2 \int \!\! dv \; {\bf B} \cdot \left[ - m_i {\overline T}_{l,i} \sin\alpha_i \, {\bf e}_s - {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\theta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \int \!\! dv \; {\bf B} \cdot {\bf B} & = & 2 \int \!\! dv \; {\bf B} \cdot \frac{\partial {\bf B}}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} = 2 \int \!\! dv \; {\bf B} \cdot \left[ + m_i {\overline T}_{l,i} \cos\alpha_i \, {\bf e}_s - {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\theta \right] / \sqrt g \end{eqnarray}

  • The second derivatives of \(\int \! dv \; {\bf B} \! \cdot \! {\bf B}\) with respect to \({\color{red} A_{\theta,e,i,l}}\), \({\color{Orange} A_{\theta,o,i,l}}\), \({\color{blue}A_{\zeta, e,i,l}}\) and \({\color{Cerulean}A_{\zeta ,o,i,l}}\) are

    \begin{eqnarray} \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + n_j n_i {\overline T}_{p,j} {\overline T}_{l,i} s_j s_i g_{ss} - n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j c_i g_{s\zeta} - n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i c_j g_{s\zeta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j c_i g_{\zeta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - n_j n_i {\overline T}_{p,j} {\overline T}_{l,i} c_j s_i g_{ss} + n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j c_i g_{s\zeta} - n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i s_j g_{s\zeta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j c_i g_{\zeta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + m_j n_i {\overline T}_{p,j} {\overline T}_{l,i} s_j s_i g_{ss} - m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j c_i g_{s\zeta} + n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i c_j g_{s\theta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j c_i g_{\theta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - m_j n_i {\overline T}_{p,j} {\overline T}_{l,i} c_j s_i g_{ss} + m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j c_i g_{s\zeta} + n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i s_j g_{s\theta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j c_i g_{\theta\zeta}) / \sqrt g^2\nonumber \end{eqnarray}

    \begin{eqnarray} \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - n_j n_i {\overline T}_{p,j} {\overline T}_{l,i} s_j c_i g_{ss} - n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j s_i g_{s\zeta} + n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i c_j g_{s\zeta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j s_i g_{\zeta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + n_j n_i {\overline T}_{p,j} {\overline T}_{l,i} c_j c_i g_{ss} + n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j s_i g_{s\zeta} + n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i s_j g_{s\zeta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j s_i g_{\zeta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - m_j n_i {\overline T}_{p,j} {\overline T}_{l,i} s_j c_i g_{ss} - m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j s_i g_{s\zeta} - n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i c_j g_{s\theta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j s_i g_{\theta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + m_j n_i {\overline T}_{p,j} {\overline T}_{l,i} c_j c_i g_{ss} + m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j s_i g_{s\zeta} - n_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i s_j g_{s\theta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j s_i g_{\theta\zeta}) / \sqrt g^2\nonumber \end{eqnarray}

    \begin{eqnarray} \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + n_j m_i {\overline T}_{p,j} {\overline T}_{l,i} s_j s_i g_{ss} + n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j c_i g_{s\theta} - m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i c_j g_{s\zeta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j c_i g_{\theta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - n_j m_i {\overline T}_{p,j} {\overline T}_{l,i} c_j s_i g_{ss} - n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j c_i g_{s\theta} - m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i s_j g_{s\zeta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j c_i g_{\theta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + m_j m_i {\overline T}_{p,j} {\overline T}_{l,i} s_j s_i g_{ss} + m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j c_i g_{s\theta} + m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i c_j g_{s\theta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j c_i g_{\theta\theta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - m_j m_i {\overline T}_{p,j} {\overline T}_{l,i} c_j s_i g_{ss} - m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j c_i g_{s\theta} + m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime s_i s_j g_{s\theta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j c_i g_{\theta\theta}) / \sqrt g^2\nonumber \end{eqnarray}

    \begin{eqnarray} \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - n_j m_i {\overline T}_{p,j} {\overline T}_{l,i} s_j c_i g_{ss} + n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j s_i g_{s\theta} + m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i c_j g_{s\zeta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j s_i g_{\theta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + n_j m_i {\overline T}_{p,j} {\overline T}_{l,i} c_j c_i g_{ss} - n_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j s_i g_{s\theta} + m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i s_j g_{s\zeta} - {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j s_i g_{\theta\zeta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( - m_j m_i {\overline T}_{p,j} {\overline T}_{l,i} s_j c_i g_{ss} + m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime s_j s_i g_{s\theta} - m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i c_j g_{s\theta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime c_j s_i g_{\theta\theta}) / \sqrt g^2\nonumber \\ \!\!\!\!\!\!\!\!\! \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \! \int \!\! dv \; {\bf B} \! \cdot \! {\bf B} \!\!&\!\!=\!\!&\!\!2 \int \!\! dv \; ( + m_j m_i {\overline T}_{p,j} {\overline T}_{l,i} c_j c_i g_{ss} - m_j {\overline T}_{p,j} {\overline T}_{l,i}^\prime c_j s_i g_{s\theta} - m_i {\overline T}_{l,i} {\overline T}_{p,j}^\prime c_i s_j g_{s\theta} + {\overline T}_{p,j}^\prime {\overline T}_{l,i}^\prime s_j s_i g_{\theta\theta}) / \sqrt g^2\nonumber \end{eqnarray}

derivatives of helicity integrals

  • The first derivatives of \(\int \! dv \; {\bf A} \cdot{\bf B}\) with respect to \({\color{red} A_{\theta,e,i,l}}\), \({\color{Orange} A_{\theta,o,i,l}}\), \({\color{blue}A_{\zeta, e,i,l}}\) and \({\color{Cerulean}A_{\zeta ,o,i,l}}\) are

    \begin{eqnarray} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left( \frac{\partial {\bf A}}{\partial {\color{red} A_{\theta,e,i,l}}} \cdot {\bf B} + {\bf A} \cdot \frac{\partial {\bf B}}{\partial {\color{red} A_{\theta,e,i,l}}} \right) = \int \!\! dv \; ( {\overline T}_{l,i} \cos\alpha_i \nabla \theta \cdot {\bf B} + {\bf A} \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\zeta / \sqrt g ) \\ \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left( \frac{\partial {\bf A}}{\partial {\color{Orange} A_{\theta,o,i,l}}} \cdot {\bf B} + {\bf A} \cdot \frac{\partial {\bf B}}{\partial {\color{Orange} A_{\theta,o,i,l}}} \right) = \int \!\! dv \; ( {\overline T}_{l,i} \sin\alpha_i \nabla \theta \cdot {\bf B} + {\bf A} \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\zeta / \sqrt g ) \\ \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left( \frac{\partial {\bf A}}{\partial {\color{blue}A_{\zeta, e,i,l}}} \cdot {\bf B} + {\bf A} \cdot \frac{\partial {\bf B}}{\partial {\color{blue}A_{\zeta, e,i,l}}} \right) = \int \!\! dv \; ( {\overline T}_{l,i} \cos\alpha_i \nabla \zeta \cdot {\bf B} - {\bf A} \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\theta / \sqrt g ) \\ \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left( \frac{\partial {\bf A}}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \cdot {\bf B} + {\bf A} \cdot \frac{\partial {\bf B}}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \right) = \int \!\! dv \; ( {\overline T}_{l,i} \sin\alpha_i \nabla \zeta \cdot {\bf B} - {\bf A} \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\theta / \sqrt g ) \end{eqnarray}

  • Note that in the above expressions, \({\bf A}\cdot{\bf e}_s=0\) has been used.
  • The second derivatives of \(\int \! dv \; {\bf A} \cdot{\bf B}\) with respect to \({\color{red} A_{\theta,e,i,l}}\), \({\color{Orange} A_{\theta,o,i,l}}\), \({\color{blue}A_{\zeta, e,i,l}}\) and \({\color{Cerulean}A_{\zeta ,o,i,l}}\) are

    \begin{eqnarray} \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ + {\overline T}_{l,i} \cos\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\zeta} \cancel{ + {\overline T}_{p,j} \cos\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\zeta} \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ + {\overline T}_{l,i} \cos\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\zeta} \cancel{ + {\overline T}_{p,j} \sin\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\zeta} \right] / \sqrt g \\ \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ - {\overline T}_{l,i} \cos\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\theta + {\overline T}_{p,j} \cos\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\zeta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{red} A_{\theta,e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ - {\overline T}_{l,i} \cos\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\theta + {\overline T}_{p,j} \sin\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\zeta \right] / \sqrt g \\ \nonumber \\ \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ + {\overline T}_{l,i} \sin\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\zeta} \cancel{ + {\overline T}_{p,j} \cos\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\zeta} \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ + {\overline T}_{l,i} \sin\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\zeta} \cancel{ + {\overline T}_{p,j} \sin\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\zeta} \right] / \sqrt g \\ \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ - {\overline T}_{l,i} \sin\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\theta + {\overline T}_{p,j} \cos\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\zeta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{Orange} A_{\theta,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ - {\overline T}_{l,i} \sin\alpha_i \nabla \theta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\theta + {\overline T}_{p,j} \sin\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\zeta \right] / \sqrt g \\ \nonumber \\ \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ + {\overline T}_{l,i} \cos\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\zeta - {\overline T}_{p,j} \cos\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\theta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ + {\overline T}_{l,i} \cos\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\zeta - {\overline T}_{p,j} \sin\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\theta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ - {\overline T}_{l,i} \cos\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\theta} \cancel{ - {\overline T}_{p,j} \cos\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\theta} \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{blue}A_{\zeta, e,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ - {\overline T}_{l,i} \cos\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\theta} \cancel{ - {\overline T}_{p,j} \sin\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \cos\alpha_i \, {\bf e}_\theta} \right] / \sqrt g \\ \nonumber \\ \frac{\partial}{\partial {\color{red} A_{\theta,e,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ + {\overline T}_{l,i} \sin\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\zeta - {\overline T}_{p,j} \cos\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\theta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Orange} A_{\theta,o,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ + {\overline T}_{l,i} \sin\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\zeta - {\overline T}_{p,j} \sin\alpha_j \nabla \theta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\theta \right] / \sqrt g \\ \frac{\partial}{\partial {\color{blue} A_{\zeta, e,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ - {\overline T}_{l,i} \sin\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \cos\alpha_j \, {\bf e}_\theta} \cancel{ - {\overline T}_{p,j} \cos\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\theta} \right] / \sqrt g \\ \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,j,p}}} \frac{\partial}{\partial {\color{Cerulean}A_{\zeta ,o,i,l}}} \int \!\! dv \; {\bf A} \cdot {\bf B} & = & \int \!\! dv \; \left[ \cancel{ - {\overline T}_{l,i} \sin\alpha_i \nabla \zeta \cdot {\overline T}_{p,j}^\prime \sin\alpha_j \, {\bf e}_\theta} \cancel{ - {\overline T}_{p,j} \sin\alpha_j \nabla \zeta \cdot {\overline T}_{l,i}^\prime \sin\alpha_i \, {\bf e}_\theta} \right] / \sqrt g \end{eqnarray}

  • In these expressions the terms \(\nabla \theta \cdot {\bf e}_\theta = \nabla \zeta \cdot {\bf e}_\zeta =1 \), and \(\cancel{\nabla \theta \cdot {\bf e}_\zeta} =\cancel{\nabla \zeta \cdot {\bf e}_\theta}=0\) have been included to show the structure of the derivation.

derivatives of kinetic energy integrals

  • The first derivatives of \(\int \! dv \; v^2\) with respect to \({\color{red} v_{ s,e,i,l}}\) etc. are

    \begin{eqnarray} \frac{\partial}{\partial {\color{red} v_{ s,e,i,l}}} \int \!\! dv \; {\bf v} \cdot {\bf v} & = & 2 \int \!\! dv \; {\bf v} \cdot {\overline T}_{l,i} \cos\alpha_i \nabla s \\ \frac{\partial}{\partial {\color{Orange} v_{ s,o,i,l}}} \int \!\! dv \; {\bf v} \cdot {\bf v} & = & 2 \int \!\! dv \; {\bf v} \cdot {\overline T}_{l,i} \sin\alpha_i \nabla s \\ \frac{\partial}{\partial {\color{red} v_{\theta,e,i,l}}} \int \!\! dv \; {\bf v} \cdot {\bf v} & = & 2 \int \!\! dv \; {\bf v} \cdot {\overline T}_{l,i} \cos\alpha_i \nabla \theta \\ \frac{\partial}{\partial {\color{Orange} v_{\theta,o,i,l}}} \int \!\! dv \; {\bf v} \cdot {\bf v} & = & 2 \int \!\! dv \; {\bf v} \cdot {\overline T}_{l,i} \sin\alpha_i \nabla \theta \\ \frac{\partial}{\partial {\color{blue} v_{\zeta ,e,i,l}}} \int \!\! dv \; {\bf v} \cdot {\bf v} & = & 2 \int \!\! dv \; {\bf v} \cdot {\overline T}_{l,i} \cos\alpha_i \nabla \zeta \\ \frac{\partial}{\partial {\color{Cerulean} v_{\zeta ,o,i,l}}} \int \!\! dv \; {\bf v} \cdot {\bf v} & = & 2 \int \!\! dv \; {\bf v} \cdot {\overline T}_{l,i} \sin\alpha_i \nabla \zeta \\ \end{eqnarray}

calculation of volume-integrated basis-function-weighted metric information

  • The required geometric information is calculated in ma00aa().
Parameters
[in]lvol
[in]mn
[in]lrad

References allglobal::ate, allglobal::ato, allglobal::aze, allglobal::azo, allglobal::cpus, allglobal::dbdx, allglobal::ddttcc, allglobal::ddttcs, allglobal::ddttsc, allglobal::ddttss, allglobal::ddtzcc, allglobal::ddtzcs, allglobal::ddtzsc, allglobal::ddtzss, allglobal::ddzzcc, allglobal::ddzzcs, allglobal::ddzzsc, allglobal::ddzzss, allglobal::dma, allglobal::dmb, allglobal::dmd, allglobal::dmg, allglobal::dtoocc, allglobal::dtoocs, allglobal::dtoosc, allglobal::dtooss, allglobal::ibnc, allglobal::ibns, allglobal::im, allglobal::in, allglobal::ivnc, allglobal::ivns, allglobal::lcoordinatesingularity, allglobal::lma, allglobal::lmb, allglobal::lmc, allglobal::lmd, allglobal::lme, allglobal::lmf, allglobal::lmg, allglobal::lmh, matrix(), allglobal::mpi_comm_spec, inputlist::mpol, allglobal::myid, allglobal::nadof, allglobal::ncpu, allglobal::notstellsym, constants::one, fileunits::ounit, allglobal::rtm, allglobal::rtt, numerical::small, allglobal::tdstcc, allglobal::tdstcs, allglobal::tdstsc, allglobal::tdstss, allglobal::tdszcc, allglobal::tdszcs, allglobal::tdszsc, allglobal::tdszss, allglobal::tt, allglobal::ttsscc, allglobal::ttsscs, allglobal::ttsssc, allglobal::ttssss, constants::two, inputlist::wmacros, allglobal::yesstellsym, and constants::zero.

Referenced by dfp100(), get_lu_beltrami_matrices(), matrix(), preset(), and writereadgf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtrxhs()

subroutine mtrxhs ( integer, intent(in)  lvol,
integer, intent(in)  mn,
integer, intent(in)  lrad,
real, dimension(0:nadof(lvol)), intent(out)  resultA,
real, dimension(0:nadof(lvol)), intent(out)  resultD,
integer, intent(in)  idx 
)

◆ spsmat()

subroutine spsmat ( integer, intent(in)  lvol,
integer, intent(in)  mn,
integer, intent(in)  lrad 
)

Constructs matrices for the precondtioner.

Preconditioner

GMRES iteratively looks for \(\mathbf{a}_n \) that minimises the residual \(\epsilon_{\mbox{GMRES}}=\|\hat{\mathcal{A}} \cdot \mathbf{a}_n - \mathbf{b}\|\), where \(\|.\|\) is the Euclidean norm. Instead of solving the original problem which is usually ill-conditioned, a left preconditioner matrix \(\mathcal{M}\) is applied on both side of \(\mathcal{A} \cdot \mathbf{a} = \mathbf{b}\) so that the transformed problem is well conditioned. The convergence speed of (the preconditioned) GMRES depends highly on the quality of \(\mathcal{M}\). A good preconditioner will require the matrix product \(\mathcal{M}^{-1} \hat{\mathcal{A}}\) to be as close as possible to an identity matrix. Also, inverting the preconditioner \(\mathcal{M}\) should be considerably cheaper than inverting \(\hat{\mathcal{A}}\) itself.

If the \(i\)-th and \(j\)-th unknowns in \(\mathbf{a}\) correspond to \(A_{\theta,m_i,n_i,l_i}\) and \(A_{\theta,m_j,n_j,l_j}\), respectively, then the matrix element \(\hat{\mathcal{A}}_{i,j}\) describes the coupling strength between harmonics \((m_i, n_i)\) and \((m_j, n_j)\). Noting that if the Fourier series of the boundary \(R_{m,n}\) and \(Z_{m,n}\) have spectral convergence, then the coupling terms between \(A_{\theta,m_i,n_i,l_i}\) and \(A_{\theta,m_j,n_j,l_j}\), formed by the \((|m_i-m_j|, |n_i-n_j|)\) harmonics of the coordinate metrics, should also decay exponentially with \(|m_i-m_j|\) and \(|n_i-n_j|\) and are thus small compared to the `‘diagonals’' \(m_i=m_j\) and \(n_i=n_j\). Therefore, we can construct \(\mathcal{M}\) from the elements of \(\hat{\mathcal{A}}\) by eliminating all the coupling terms with \(m_i \neq m_j\) or \(n_i \neq n_j\), and keeping the rest (`‘diagonals’' and terms related to Lagrange mulitpliers). Physically, the matrix \(\mathcal{M}\) is equivalent to the \(\hat{\mathcal{A}}\) matrix of a tokamak with similar major radius and minor radius to the stellarator we are solving for. The preconditioning matrix \(\mathcal{M}\) is sparse, with the number of nonzero elements \(\sim O(MNL^2)\), while the total number of elements in \(\mathcal{M}\) is \(O(M^2 N^2 L^2)\). After the construction of \(\mathcal{M}\), the approximate inverse \(\mathcal{M}\) is computed by an incomplete LU factorisation.

This subroutine constructs such a preconditioner matrix \(\mathcal{M}\) and store it inside a sparse matrix. The matrix elements are the same as matrix.f90, however, only the aforementioned terms are kept. The sparse matrix uses the storage structure of Compact Sparse Row (CSR).

Parameters
lvol
mn
lrad

References addline(), allglobal::ate, allglobal::ato, allglobal::aze, allglobal::azo, clean_queue(), allglobal::cpus, allglobal::ddttcc, allglobal::ddttcs, allglobal::ddttsc, allglobal::ddttss, allglobal::ddtzcc, allglobal::ddtzcs, allglobal::ddtzsc, allglobal::ddtzss, allglobal::ddzzcc, allglobal::ddzzcs, allglobal::ddzzsc, allglobal::ddzzss, allglobal::dma, allglobal::dmas, allglobal::dmb, allglobal::dmd, allglobal::dmds, allglobal::dmg, allglobal::dtoocc, allglobal::dtoocs, allglobal::dtoosc, allglobal::dtooss, allglobal::ibnc, allglobal::ibns, allglobal::idmas, allglobal::im, allglobal::in, allglobal::ivnc, allglobal::ivns, allglobal::jdmas, allglobal::lcoordinatesingularity, allglobal::liluprecond, allglobal::lma, allglobal::lmb, allglobal::lmc, allglobal::lmd, allglobal::lme, allglobal::lmf, allglobal::lmg, allglobal::lmh, allglobal::mpi_comm_spec, inputlist::mpol, allglobal::myid, allglobal::nadof, allglobal::ncpu, allglobal::ndmas, allglobal::ndmasmax, allglobal::notstellsym, constants::one, fileunits::ounit, push_back(), allglobal::rtm, allglobal::rtt, numerical::small, spsmat(), allglobal::tdstcc, allglobal::tdstcs, allglobal::tdstsc, allglobal::tdstss, allglobal::tdszcc, allglobal::tdszcs, allglobal::tdszsc, allglobal::tdszss, allglobal::tt, allglobal::ttsscc, allglobal::ttsscs, allglobal::ttsssc, allglobal::ttssss, constants::two, inputlist::wmacros, allglobal::yesstellsym, and constants::zero.

Referenced by dfp100(), and spsmat().

Here is the call graph for this function:
Here is the caller graph for this function: