SPEC 3.20
Stepped Pressure Equilibrium Code
Coordinate axis

Functions/Subroutines

subroutine rzaxis (Mvol, mn, inRbc, inZbs, inRbs, inZbc, ivol, LcomputeDerivatives)
 The coordinate axis is assigned via a poloidal average over an arbitrary surface. More...
 

Detailed Description

Function/Subroutine Documentation

◆ rzaxis()

subroutine rzaxis ( integer, intent(in)  Mvol,
integer, intent(in)  mn,
real, dimension(1:mn,0:mvol)  inRbc,
real, dimension(1:mn,0:mvol)  inZbs,
real, dimension(1:mn,0:mvol)  inRbs,
real, dimension(1:mn,0:mvol)  inZbc,
integer, intent(in)  ivol,
logical, intent(in)  LcomputeDerivatives 
)

The coordinate axis is assigned via a poloidal average over an arbitrary surface.

Specifies position of coordinate axis; \({\bf x}_a(\zeta) \equiv \int {\bf x}_1(\theta,\zeta) dl \, / \int dl\).

coordinate axis

  • The coordinate axis is not an independent degree-of-freedom of the geometry. It is constructed by extrapolating the geometry of a given interface, as determined by \(i \equiv\,\)ivol which is given on input, down to a line.
  • If the coordinate axis depends only on the geometry of the interface and not the angle parameterization, then the block tri-diagonal structure of the the force-derivative matrix is preserved.
  • Define the arc-length-weighted averages,

    \begin{eqnarray} R_0(\zeta) \equiv \frac{\displaystyle \int_{0}^{2\pi} R_i(\theta,\zeta) \, dl}{\displaystyle \int_{0}^{2\pi} \!\!\!\! dl}, \qquad Z_0(\zeta) \equiv \frac{\displaystyle \int_{0}^{2\pi} Z_i(\theta,\zeta) \, dl}{\displaystyle \int_{0}^{2\pi} \!\!\!\! dl}, \end{eqnarray}

    where \(dl \equiv \dot l \, d\theta = \sqrt{ \partial_\theta R_i(\theta,\zeta)^2 + \partial_\theta Z_i(\theta,\zeta)^2 } \, d\theta\).
  • (Note that if \(\dot l\) does not depend on \(\theta\), i.e. if \(\theta\) is the equal arc-length angle, then the expressions simplify. This constraint is not enforced.)
  • The geometry of the coordinate axis thus constructed only depends on the geometry of the interface, i.e. the angular parameterization of the interface is irrelevant.

coordinate axis: derivatives

  • The derivatives of the coordinate axis with respect to the Fourier harmonics of the given interface are given by

    \begin{eqnarray} \displaystyle \frac{\partial R_0}{\partial R_{i,j}^c} & = & \displaystyle \int \left( \cos\alpha_j \; \dot l - \Delta R_i R_{i,\theta} \, m_j \sin\alpha_j / \; \dot l \right) d\theta / L \\ \displaystyle \frac{\partial R_0}{\partial R_{i,j}^s} & = & \displaystyle \int \left( \sin\alpha_j \; \dot l + \Delta R_i R_{i,\theta} \, m_j \cos\alpha_j / \; \dot l \right) d\theta / L \\ \displaystyle \frac{\partial R_0}{\partial Z_{i,j}^c} & = & \displaystyle \int \left( \;\;\;\;\;\;\;\;\;\;\;\;\, - \Delta R_i Z_{i,\theta} \, m_j \sin\alpha_j / \; \dot l \right) d\theta / L \\ \displaystyle \frac{\partial R_0}{\partial Z_{i,j}^s} & = & \displaystyle \int \left( \;\;\;\;\;\;\;\;\;\;\;\;\, + \Delta R_i Z_{i,\theta} \, m_j \cos\alpha_j / \; \dot l \right) d\theta / L \\ \nonumber \\ \displaystyle \frac{\partial Z_0}{\partial R_{i,j}^c} & = & \displaystyle \int \left( \;\;\;\;\;\;\;\;\;\;\;\;\, - \Delta Z_i R_{i,\theta} \, m_j \sin\alpha_j / \; \dot l \right) d\theta / L \\ \displaystyle \frac{\partial Z_0}{\partial R_{i,j}^s} & = & \displaystyle \int \left( \;\;\;\;\;\;\;\;\;\;\;\; + \Delta Z_i R_{i,\theta} \, m_j \cos\alpha_j / \; \dot l \right) d\theta / L \\ \displaystyle \frac{\partial Z_0}{\partial Z_{i,j}^c} & = & \displaystyle \int \left( \cos\alpha_j \; \dot l - \Delta Z_i Z_{i,\theta} \, m_j \sin\alpha_j / \; \dot l \right) d\theta / L \\ \displaystyle \frac{\partial Z_0}{\partial Z_{i,j}^s} & = & \displaystyle \int \left( \sin\alpha_j \; \dot l + \Delta Z_i Z_{i,\theta} \, m_j \cos\alpha_j / \; \dot l \right) d\theta / L \end{eqnarray}

    where \(\displaystyle L(\zeta) \equiv \int_{0}^{2\pi} \!\!\!\! dl\).

some numerical comments

  • First, the differential poloidal length, \(\dot l \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 \(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, and this is assigned in readin() .
  • Next, the weighted \(R \, dl\) and \(Z \, dl\) are computed in real space, and the poloidal integral is similarly taken.
  • Last, the Fourier harmonics are constructed using an FFT after dividing in real space.
Parameters
[in]Mvol
[in]mn
inRbc
inZbs
inRbs
inZbc
[in]ivol
LcomputeDerivatives

References allglobal::ajk, allglobal::cfmn, allglobal::comn, coords(), allglobal::cosi, allglobal::cpus, allglobal::dbdx, allglobal::dradr, allglobal::dradz, allglobal::drodr, allglobal::drodz, allglobal::dzadr, allglobal::dzadz, allglobal::dzodr, allglobal::dzodz, allglobal::efmn, allglobal::evmn, constants::half, inputlist::igeometry, allglobal::ijimag, allglobal::ijreal, allglobal::im, allglobal::in, allglobal::irbc, allglobal::irbs, allglobal::izbc, allglobal::izbs, allglobal::jiimag, allglobal::jireal, allglobal::jkimag, allglobal::jkreal, allglobal::kjimag, allglobal::kjreal, inputlist::lcheck, allglobal::lcoordinatesingularity, inputlist::lfreebound, inputlist::linitialize, inputlist::lreflect, inputlist::lrzaxis, allglobal::mpi_comm_spec, allglobal::myid, allglobal::ncpu, allglobal::notstellsym, allglobal::nt, inputlist::ntor, inputlist::ntoraxis, allglobal::ntz, allglobal::nz, allglobal::odmn, allglobal::ofmn, constants::one, fileunits::ounit, allglobal::rij, rzaxis(), allglobal::sfmn, allglobal::sg, allglobal::simn, allglobal::sini, constants::two, numerical::vsmall, inputlist::wmacros, allglobal::yesstellsym, constants::zero, and allglobal::zij.

Referenced by packxi(), preset(), and rzaxis().

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