SPEC 3.20
Stepped Pressure Equilibrium Code
"packing" of Beltrami field solution vector

More...

Functions/Subroutines

subroutine packab (packorunpack, lvol, NN, solution, ideriv)
 Packs and unpacks Beltrami field solution vector. More...
 
subroutine packxi (NGdof, position, Mvol, mn, iRbc, iZbs, iRbs, iZbc, packorunpack, LComputeDerivatives, LComputeAxis)
 Packs, and unpacks, geometrical degrees of freedom; and sets coordinate axis. More...
 

Detailed Description

Function/Subroutine Documentation

◆ packab()

subroutine packab ( character, intent(in)  packorunpack,
integer, intent(in)  lvol,
integer, intent(in)  NN,
real, dimension(1:nn)  solution,
integer, intent(in)  ideriv 
)

Packs and unpacks Beltrami field solution vector.

construction of "vector" of independent degrees of freedom

  • Numerical routines for solving linear equations typically require the unknown, independent degrees of freedom to be "packed" into a vector, \({\bf x}\).
  • The magnetic field is defined by the independent degrees of freedom in the Chebyshev-Fourier representation of the vector potential, \({\color{red} A_{\theta,e,i,l}}\) and \({\color{blue}A_{\zeta, e,i,l}}\); and the non-stellarator-symmetric terms if relevant, \({\color{Orange} A_{\theta,o,i,l}}\) and \({\color{Cerulean}A_{\zeta ,o,i,l}}\); and the Lagrange multipliers, \(a_i\), \(b_i\), \(c_i\), \(d_i\), \(e_i\), etc. as required to enforce the constraints:

    \begin{eqnarray} {\bf x} \equiv \{ {\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}},a_i,b_i,c_i,d_i,e_i,f_i,g_1,h_1\}. \end{eqnarray}

  • The "packing" index is assigned in preset() .
Parameters
packorunpack
lvol
NN
solution
ideriv

References allglobal::ate, allglobal::ato, allglobal::aze, allglobal::azo, allglobal::cpus, allglobal::im, allglobal::in, allglobal::lma, allglobal::lmavalue, allglobal::lmb, allglobal::lmbvalue, allglobal::lmc, allglobal::lmcvalue, allglobal::lmd, allglobal::lmdvalue, allglobal::lme, allglobal::lmevalue, allglobal::lmf, allglobal::lmfvalue, allglobal::lmg, allglobal::lmgvalue, allglobal::lmh, allglobal::lmhvalue, inputlist::lrad, allglobal::mn, allglobal::mpi_comm_spec, allglobal::myid, allglobal::ncpu, allglobal::notstellsym, fileunits::ounit, packab(), numerical::small, allglobal::tt, allglobal::yesstellsym, and constants::zero.

Referenced by dforce(), dfp200(), get_perturbed_solution(), ma02aa(), matvec(), mp00ac(), and packab().

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

◆ packxi()

subroutine packxi ( integer, intent(in)  NGdof,
real, dimension(0:ngdof)  position,
integer, intent(in)  Mvol,
integer, intent(in)  mn,
real, dimension(1:mn,0:mvol)  iRbc,
real, dimension(1:mn,0:mvol)  iZbs,
real, dimension(1:mn,0:mvol)  iRbs,
real, dimension(1:mn,0:mvol)  iZbc,
character  packorunpack,
logical, intent(in)  LComputeDerivatives,
logical, intent(in)  LComputeAxis 
)

Packs, and unpacks, geometrical degrees of freedom; and sets coordinate axis.

geometrical degrees of freedom

  • The geometrical degrees-of-freedom, namely the \(R_{j,v}\) and \(Z_{j,v}\) where \(v\) labels the interface and \(j\) labels the Fourier harmonic, must be "packxi", and "unpackxi", into a single vector, \(\boldsymbol{\xi}\), so that standard numerical routines can be called to find solutions to force-balance, i.e. \({\bf F}[\boldsymbol{\xi}]=0\).
  • A coordinate "pre-conditioning" factor is included:

    \begin{eqnarray} \boldsymbol{\xi}_k \equiv \frac{R_{j,v}}{\Psi_{j,v}}, \end{eqnarray}

    where \(\Psi_{j,v} \equiv\,\)psifactor(j,v) , which is defined in global.f90 .

coordinate axis

  • The coordinate axis is not an independent degree-of-freedom of the geometry. It is constructed by extrapolating the geometry of the innermost interface down to a line.
  • Note that if the coordinate axis depends only on the geometry of the innermost interface then the block tridiagonal structure of the the force-derivative matrix is preserved.
  • Define the arc-length weighted averages,

    \begin{eqnarray} R_0(\zeta) \equiv \frac{\int_{0}^{2\pi} R_1(\theta,\zeta) dl}{L(\zeta)}, \qquad Z_0(\zeta) \equiv \frac{\int_{0}^{2\pi} Z_1(\theta,\zeta) dl}{L(\zeta)}, \end{eqnarray}

    where \(L(\zeta)\equiv \int_{0}^{2\pi} dl\) and \(dl \equiv \sqrt{ \partial_\theta R_1(\theta,\zeta)^2 + \partial_\theta Z_1(\theta,\zeta)^2 } \, d\theta\).
  • Note that if \(dl\) does not depend on \(\theta\), i.e. if \(\theta\) is the equal arc-length angle, then the expressions simplify.
  • Note that the geometry of the coordinate axis thus constructed only depends on the geometry of the innermost interface, by which I mean that the geometry of the coordinate axis is independent of the angle parameterization.

some numerical comments

  • First, the differential poloidal length, \(dl \equiv \sqrt{ R_\theta^2 + Z_\theta^2 }\), is computed in real space using an inverse FFT from the Fourier harmonics of \(R\) and \(Z\).
  • Second, the Fourier harmonics of the \(dl\) are computed using an FFT. The integration over \(\theta\) to construct \(L\equiv \int dl\) is now trivial: just multiply the \(m=0\) harmonics of \(dl\) by \(2\pi\). The ajk(1:mn) variable is used.
  • Next, the weighted \(R\,dl\) and \(Z\,dl\) are computed in real space, and the poloidal integral is similarly taken.
  • Lastly, the Fourier harmonics are constructed using an FFT after dividing in real space.
Parameters
[in]NGdof
position
[in]Mvol
[in]mn
iRbc
iZbs
iRbs
iZbc
packorunpack
[in]LComputeDerivatives
[in]LComputeAxis

References allglobal::ajk, allglobal::cfmn, allglobal::comn, allglobal::cpus, allglobal::efmn, allglobal::evmn, inputlist::igeometry, allglobal::ijimag, allglobal::ijreal, allglobal::im, allglobal::in, allglobal::irij, allglobal::izij, allglobal::jiimag, allglobal::jireal, inputlist::lfindzero, allglobal::mpi_comm_spec, allglobal::myid, allglobal::ncpu, allglobal::notstellsym, allglobal::nt, inputlist::ntor, allglobal::ntz, inputlist::nvol, allglobal::nz, allglobal::odmn, allglobal::ofmn, fileunits::ounit, packxi(), allglobal::psifactor, allglobal::rscale, rzaxis(), allglobal::sfmn, allglobal::simn, allglobal::trij, allglobal::tzij, allglobal::yesstellsym, and constants::zero.

Referenced by dforce(), fcn1(), fcn2(), hesian(), packxi(), and spec().

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