SPEC 3.20
Stepped Pressure Equilibrium Code
Plasma volume

Functions/Subroutines

subroutine volume (lvol, vflag)
 Computes volume of each region; and, if required, the derivatives of the volume with respect to the interface geometry. More...
 

Detailed Description

Function/Subroutine Documentation

◆ volume()

subroutine volume ( integer, intent(in)  lvol,
integer  vflag 
)

Computes volume of each region; and, if required, the derivatives of the volume with respect to the interface geometry.

Calculates volume of each region; \({\cal V}_i \equiv \int dv\).

volume integral

  • The volume enclosed by the \(v\)-th interface is given by the integral

    \begin{eqnarray} V = \int_{{\cal V}} \; dv = \frac{1}{3}\int_{{\cal V}} \; \nabla \cdot {\bf x} \; dv = \frac{1}{3}\int_{{\cal S}} \; {\bf x} \cdot d{\bf s} = \frac{1}{3} \int_{0}^{2\pi} \!\! d\theta \int_{0}^{2\pi/N} \!\! d\zeta \;\;\; \left. {\bf x } \cdot {\bf x_\theta} \times {\bf x_\zeta} \right|^s \end{eqnarray}

    where we have used \(\nabla \cdot {\bf x} = 3\), and have assumed that the domain is periodic in the angles.

representation of surfaces

  • The coordinate functions are

    \begin{eqnarray} R(\theta,\zeta) & = & \sum_i R_{e,i} \; \cos\alpha_i + \sum_i R_{o,i} \; \sin\alpha_i \\ Z(\theta,\zeta) & = & \sum_i Z_{e,i} \; \cos\alpha_i + \sum_i Z_{o,i} \; \sin\alpha_i, \end{eqnarray}

    where \(\alpha_i \equiv m_i \theta - n_i \zeta\).

geometry

  • The geometry is controlled by the input parameter Igeometry as follows:

  • Igeometry.eq.1 : Cartesian : \(\sqrt g = R_s\)

    \begin{eqnarray} V & = & \int_{0}^{2\pi}\!\!\!d\theta \int_{0}^{2\pi/N}\!\!\!\!\! d\zeta \; R \nonumber \\ & = & 2\pi \; \frac{2\pi}{N} \; R_{e,1} \end{eqnarray}

  • Igeometry.eq.2 : cylindrical : \(\sqrt g = R R_s = \frac{1}{2}\partial_s (R^2)\)

    \begin{eqnarray} V & = & \frac{1}{2}\int_{0}^{2\pi}\!\!\!d\theta \int_{0}^{2\pi/N}\!\!\!\!\! d\zeta \; R^2 \nonumber \\ & = & \frac{1}{2} \; 2\pi \; \frac{2\pi}{N} \; \frac{1}{2} \; \sum_i\sum_j R_{e,i}R_{e,j}\left[\cos(\alpha_i-\alpha_j)+\cos(\alpha_i+\alpha_j)\right] \nonumber \\ & + & \frac{1}{2} \; 2\pi \; \frac{2\pi}{N} \; \frac{1}{2} \; \sum_i\sum_j R_{o,i}R_{o,j}\left[\cos(\alpha_i-\alpha_j)-\cos(\alpha_i+\alpha_j)\right] \end{eqnarray}

  • Igeometry.eq.3 : toroidal : \({\bf x}\cdot {\bf e}_\theta \times {\bf e}_\zeta = R ( Z R_\theta - R Z_\theta ) \) This is computed by fast Fourier transform:

    \begin{eqnarray} V & = & \frac{1}{3} \; \int_{0}^{2\pi}\!\!\!d\theta \int_{0}^{2\pi/N}\!\!\!\!\! d\zeta \; R \left( Z R_{\theta} - R Z_{\theta} \right) \nonumber \\ & = & \frac{1}{3} \; \sum_i \sum_j \sum_k R_{e,i} \left(Z_{e,j} R_{o,k} - R_{e,j} Z_{o,k} \right) (+m_k) \int \!\!\!\! \int \!\! d\theta d\zeta \; \cos\alpha_i \cos\alpha_j \cos\alpha_k \nonumber \\ & + & \frac{1}{3} \; \sum_i \sum_j \sum_k R_{e,i} \left(Z_{o,j} R_{e,k} - R_{o,j} Z_{e,k} \right) (-m_k) \int \!\!\!\! \int \!\! d\theta d\zeta \; \cos\alpha_i \sin\alpha_j \sin\alpha_k \nonumber \\ & + & \frac{1}{3} \; \sum_i \sum_j \sum_k R_{o,i} \left(Z_{e,j} R_{e,k} - R_{e,j} Z_{e,k} \right) (-m_k) \int \!\!\!\! \int \!\! d\theta d\zeta \; \sin\alpha_i \cos\alpha_j \sin\alpha_k \nonumber \\ & + & \frac{1}{3} \; \sum_i \sum_j \sum_k R_{o,i} \left(Z_{o,j} R_{o,k} - R_{o,j} Z_{o,k} \right) (+m_k) \int \!\!\!\! \int \!\! d\theta d\zeta \; \sin\alpha_i \sin\alpha_j \cos\alpha_k \end{eqnarray}

  • (Recall that the integral over an odd function is zero, so various terms in the above expansion have been ignored.)

  • The trigonometric terms are

    \begin{eqnarray} \begin{array}{ccccccccccccccccccccccccccccccccccccccccccc} 4 \; \cos\alpha_i \cos\alpha_j \cos\alpha_k & \!\!\! = & \!\!\! + \!\!\! & \cos(\alpha_i+\alpha_j+\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i+\alpha_j-\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i-\alpha_j+\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i-\alpha_j-\alpha_k) \\ 4 \; \cos\alpha_i \sin\alpha_j \sin\alpha_k & \!\!\! = & \!\!\! - \!\!\! & \cos(\alpha_i+\alpha_j+\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i+\alpha_j-\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i-\alpha_j+\alpha_k) & \!\!\! - \!\!\! & \cos(\alpha_i-\alpha_j-\alpha_k) \\ 4 \; \sin\alpha_i \cos\alpha_j \sin\alpha_k & \!\!\! = & \!\!\! - \!\!\! & \cos(\alpha_i+\alpha_j+\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i+\alpha_j-\alpha_k) & \!\!\! - \!\!\! & \cos(\alpha_i-\alpha_j+\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i-\alpha_j-\alpha_k) \\ 4 \; \sin\alpha_i \sin\alpha_j \cos\alpha_k & \!\!\! = & \!\!\! - \!\!\! & \cos(\alpha_i+\alpha_j+\alpha_k) & \!\!\! - \!\!\! & \cos(\alpha_i+\alpha_j-\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i-\alpha_j+\alpha_k) & \!\!\! + \!\!\! & \cos(\alpha_i-\alpha_j-\alpha_k) \end{array} \end{eqnarray}

  • The required derivatives are

    \begin{eqnarray} \begin{array}{cclccccccccccccccccccccccccccccccccccccccccccccccc} 3 \displaystyle \frac{\partial V}{\partial R_{e,i}} & = & \left( + Z_{e,j} R_{o,k} m_k - R_{e,j} Z_{o,k} m_k - R_{e,j} Z_{o.k} m_k \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \cos\alpha_i \cos\alpha_j \cos\alpha_k \\ & + & \left( - Z_{o,j} R_{e,k} m_k + R_{o,j} Z_{e,k} m_k + R_{o,j} Z_{e,k} m_k \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \cos\alpha_i \sin\alpha_j \sin\alpha_k \\ & + & \left( - R_{o,k} Z_{e,j} m_i \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \sin\alpha_i \cos\alpha_j \sin\alpha_k \\ & + & \left( - R_{e,k} Z_{o,j} m_i \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \sin\alpha_i \sin\alpha_j \cos\alpha_k \end{array} \end{eqnarray}

    \begin{eqnarray} \begin{array}{cclccccccccccccccccccccccccccccccccccccccccccccccc} 3 \displaystyle \frac{\partial V}{\partial Z_{o,i}} & = & \left( - R_{e,k} R_{e,j} m_i \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \cos\alpha_i \cos\alpha_j \cos\alpha_k \\ & + & \left( - R_{o,k} R_{o,j} m_i \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \cos\alpha_i \sin\alpha_j \sin\alpha_k \\ & + & \left( - R_{e,j} R_{e,k} m_k \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \sin\alpha_i \cos\alpha_j \sin\alpha_k \\ & + & \left( + R_{o,j} R_{o,k} m_k \right) & \displaystyle \int \!\!\!\! \int \!\! d\theta d\zeta \; \sin\alpha_i \sin\alpha_j \cos\alpha_k \end{array} \end{eqnarray}

References coords(), allglobal::cosi, allglobal::cpus, allglobal::dbdx, allglobal::djkm, allglobal::djkp, allglobal::dvolume, constants::four, constants::half, inputlist::igeometry, allglobal::im, allglobal::in, allglobal::irbc, allglobal::irbs, allglobal::izbc, allglobal::izbs, allglobal::mn, allglobal::mpi_comm_spec, allglobal::myid, allglobal::ntz, inputlist::nvol, constants::one, fileunits::ounit, constants::pi2, inputlist::pscale, constants::quart, allglobal::rij, allglobal::sini, numerical::small, constants::third, constants::two, volume(), numerical::vsmall, allglobal::vvolume, allglobal::yesstellsym, constants::zero, and allglobal::zij.

Referenced by coords(), dforce(), dfp100(), dfp200(), evaluate_dmupfdx(), fcn2(), final_diagnostics(), sphdf5::hdfint(), ma00aa(), sphdf5::mirror_input_to_outfile(), pp00ab(), spec(), and volume().

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