LION
 All Classes Files Functions Variables Pages
LION_common.f90 File Reference

Functions/Subroutines

subroutine labrun
 Labels the run. More...
 
subroutine clear
 Clear variables and arrays. More...
 
subroutine preset
 Sets default values of all input variables. More...
 
subroutine datain
 check input data consistency More...
 
subroutine auxval
 Set auxiliary values. More...
 
subroutine iodsk1 (k)
 Handles disk I/O. More...
 
subroutine vacuum
 Organize vaccum and antenna contributions. More...
 
subroutine vaczer
 Put vaccum matrix and rhs to zero. More...
 
subroutine tetmsh
 Define auxiliary quantities for the theta mesh in vaccum region. More...
 
subroutine abcdef (konlyant)
 Computes matrices of surface integral operators D_mu,nu and E_mu,nu. More...
 
subroutine roteta (km, k, kp)
 rho, drho/dtheta and theta at integration points on pairs of intervals along plasma surface, antenna and wall More...
 
subroutine wall_sub (pt, propl, pdropl, pa, pb, pc, prowa, pdrowa)
 rho and drho/dtheta on the wall More...
 
subroutine concel (km, k, kp)
 Contribution of an interval to Green's function matrices D_mu,nu and E_mu,nu. More...
 
subroutine qcon
 performs matrix operations for q-matrix and vector phi_e More...
 
subroutine zero (k)
 Reduces matrix for n=0 case. More...
 
subroutine wcon
 Construct vacuum matrix and source vector. More...
 
subroutine hermic
 Check non-hermicity and impose hermicity of vacuum matrix. More...
 
subroutine mult (a, b, n, nd)
 Multiplies square matrices a=a*b. More...
 
subroutine eknrec (peta, kn, pkn, pkpn)
 Computes elliptical integral \(K_n(\eta)\) and \(dK_n(\eta)/d\eta\) with recursion formula. More...
 
subroutine ek (peta, pe, pk)
 Complete elliptic integrals of 1st and 2nd kind. More...
 
subroutine imgc (a, n, l, nul)
 
subroutine curent
 
subroutine matvec (pmatrx, pin, pout, klong, kdim)
 
subroutine moppow (k)
 
subroutine ekn (peta, kn, pkn, pkpn)
 Computes elliptical integral \(K_n\) and derivative. More...
 
subroutine eknsie (peta, kn, pkn, pkpn)
 Computes elliptical integral \(K_n(\eta)\) and \(dK_n(\eta)/d\eta\) with series. More...
 
subroutine eknlim (peta, kn, pkn, pkpn)
 Computes elliptical integral \(K_n(\eta)\) and \(dK_n(\eta)/d\eta\) for high \(n\) and small \(\eta\). More...
 
real(rkind) function besmdi (nordn, xx)
 Modified Bessel function I of order \(n\). More...
 
real(rkind) function besmdk (nordn, xx)
 Modified Bessel function K of order \(n\). More...
 
subroutine num (k, kn, kchi)
 
subroutine anten (pt, propl, pdropl, pa, pb, pc, proan, pdroan)
 Computes rho and drho/dtheta on antenna, at theta=pt. More...
 
subroutine plansh
 Check definitions of plasma, antenna and wall surfaces. More...
 
subroutine iodsk2 (k)
 I/O disk operations for plasma surface, vacuum and antenna. More...
 
subroutine organ4
 Organize the computation of the linear algebraic system. More...
 
subroutine frontb
 Construct the matrix A and rhs vector b and direct solve A*x=b using a frontal method. More...
 
subroutine integr (k, kpsi, kchi)
 Contribution of one cell to matrix A. More...
 
subroutine rhshyb (kantyp, kpsi, kchi)
 Contribution of one cell to rhs vector from volume antenna currents in the plasma. More...
 
subroutine addvac
 Adds vacuum contribution to matrix block a1d. More...
 
subroutine cald (a, eps, mb1, mb2, nsing, neg)
 LDU-decompose mb2 first lines and columns of matrix a. More...
 
subroutine cdlhxv
 solve upper triangular system DU x = y More...
 
subroutine getrg (pt, p, ks, ke, kp)
 Get a section of vector pt into a sectino of vector p. More...
 
subroutine putrg (pt, p, ks, ke, kp)
 Put a section of p into a sectino of vector pt. More...
 
subroutine dec (kpsi, kchi, kdpsi, kdpol, kplac)
 Relation between local(cell) and global(block) numberings of the 6 unknowns of a cell. More...
 
subroutine ahybrd (kint, ks, kchi)
 Constructs local (6x6) matrix contribution from a cell using finite hybrid elements. More...
 
subroutine away (k, l, kr)
 "Remove" a column and a row of a local matrix (put 1 on diagonal, 0 elsewhere) More...
 
subroutine store (k, pweit)
 Adds cell contribution matrix (cona) to the global matrix A (a1d) More...
 
subroutine quaequ (ks, kchi)
 Physical and geometrical local (cell) quantities. More...
 
subroutine basis2 (px, zdx, py, zdy, pf)
 Coefficients of linear finite hybrid elements basis functions. More...
 
subroutine const1 (kchi, pc1)
 Coefficients of weak form terms \(c_1..c_9\). More...
 
subroutine const2 (k, kchi, peta, pksi)
 Coefficients of X,V and their partial derivatives for the test and trial functions appearing in weak form terms. More...
 
subroutine const3 (k, ks, kchi, peta, pksi)
 Coefficients of X,V and their partial derivatives for the test and trial functions appearing in weak form terms. More...
 
subroutine vect (pc, pf, pv)
 Determines vector of coefficients of unknowns in a mesh cell. More...
 
subroutine diadic (kv, ki, pv, pw, pc1, pm)
 Diadic multiplication pm = pc1(ki) * conjg(pv) * pw. More...
 
subroutine add (kv, pm, pcon)
 Adds contribution of one weak form term term to the contribution of the cell. More...
 
subroutine frprof (ps, pfrac)
 Local mass density fractions of all ion species. More...
 
real(rkind) function frshap (ps, kspec)
 Shape of fractionnal density profile of species kspec at s=ps. More...
 
real(rkind) function dampin (ps, pchi)
 Local damping nu/omega. More...
 
real(rkind) function tempi (k, ps)
 Parallel temperature of k-th ion species at radius ps. More...
 
real(rkind) function temprp (k, ps)
 Perpendicular temperature of k-th ion species at radius ps. More...
 
real(rkind) function tempel (ps)
 Electron temperature at radius ps. More...
 
subroutine fastdr (pkperp)
 k-perp of fast wave from dispersion relation More...
 
subroutine dispfn (parg, pfn)
 Fried-Conte plasma dispersion function for real argument (NRL-formulary: \(Z(\zeta) \)) More...
 
subroutine errfc (pz, f)
 Computation of error function in complex plane. More...
 
subroutine bessel (x, y, n, f, z, v, b)
 Bessel routine for errfc. More...
 
subroutine beshhh (lmax, x, bj)
 calculate Bessel functions by backward recursion More...
 
subroutine cvzero (k, px, kx)
 zeroes a complex vector More...
 
real(rkind) function densit (ps)
 Total mass density at radius ps, normalized to 1. at axis. More...
 
subroutine iodsk4 (k)
 I/O disk operations for matrix and rhs if needed. More...
 
subroutine diagno
 Organize the computatino and output of diagnostics. More...
 
subroutine init
 Initializes diagnostic calculations. More...
 
subroutine fourie
 complex Fourier analysis in poloidal coordinate \(\chi\) and geometrical poloidal angle \(\theta\) More...
 
subroutine landau
 Perturbative damping and drive, in the presence of fast ions. More...
 
subroutine slowin (pl, pu, pa, pb, pint)
 Integrals I_j's j=0,1,2 for slowing-down distribution. More...
 
subroutine theend
 This is the end. More...
 
subroutine center (ks, kchi)
 Obtain X, V, dX/dchi, dX/ds, dV/dchi at center of cell. More...
 
subroutine electr
 Electric field, normal and binormal components. More...
 
subroutine locpow
 Local power absorption. More...
 
subroutine magnet
 Perturbed magnetic field. More...
 
subroutine poynti
 Poynting vector Re ( E* cross B ) More...
 
subroutine sflint (ks)
 Contribution to Poynting flux across magnetic surface. More...
 
subroutine outp5 (k)
 Handles std output of diagnostics. More...
 
subroutine table2 (pmat, pmax)
 Printout of pmat(psi,chi) More...
 
subroutine tablef (pmat)
 Printout table of Fourier components. More...
 
subroutine plot5 (k)
 Graphical plot!> More...
 
real(rkind) function across (px1, px2, pf1, pf2)
 f(x) = 0 via linear interpolation More...
 
subroutine onefun (k1, k2, px, py, kchar, pleft, kleft, pright, kright, pbottm, ptop, krows, kplot, klbar)
 fills one function into the plot field for std output graph More...
 
subroutine blank (krows, kplot)
 Puts the std output plot field to blank. More...
 
subroutine frame (kleft, kright, krows, kplot)
 Fills the frame into the plot field. More...
 
subroutine mesage (kmess)
 Print character message on std output. More...
 
subroutine iodsk5 (k)
 Disk I/O for disgnostic operations. More...
 
subroutine blines (k)
 Insert k blank lines on std output. More...
 
subroutine iarray (kname, ka, kdim)
 Print name and values of integer array on std output. More...
 
subroutine rarray (kname, pa, kdim)
 Print name and values of real array on std output. More...
 
subroutine ivar (kname, kvalue)
 Print name and value of integer variable on std output. More...
 
subroutine rvar (kname, pvalue)
 Print name and value of real variable on std output. More...
 
subroutine reseti (ka, kdim, kvalue)
 Reset integer array to specified value. More...
 
subroutine resetr (pa, kdim, pvalue)
 Reset real array to specified value. More...
 
subroutine runtime (ptime)
 Get wall clock time. More...
 

Function/Subroutine Documentation

subroutine abcdef ( integer  konlyant)

Computes matrices of surface integral operators D_mu,nu and E_mu,nu.

Eq.(3.31b) of Ref.[1] https://doi.org/10.1016/0167-7977(86)90027-4

Eqs.(3.68), (3.69) of Ref.[2], http://dx.doi.org/10.5075/epfl-thesis-673

---------------------------------------------------------------------
     konlyant = 0 => all 13 matrices
     konlyant = 1 => only antenna-related matrices (jm=7 to 13)
---------------------------------------------------------------------
 
    g(.,.,jm)\n

 jm  1    2    3    4    5    6    7    8    9    10   11   12   13 
 
     a    b    c    d    e    f    gfat hfat fatk fatl fatm fatn rfat 
 
     dpp  epp  dps  dsp  esp  dss  dpa  epa  dap  daa  eap  eaa  dsa 
---------------------------------------------------------------------

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

real(rkind) function across ( real(rkind)  px1,
real(rkind)  px2,
real(rkind)  pf1,
real(rkind)  pf2 
)

f(x) = 0 via linear interpolation

subroutine add ( integer  kv,
complex, dimension(6,6)  pm,
complex, dimension(6,6)  pcon 
)

Adds contribution of one weak form term term to the contribution of the cell.

IN: kv, size of matrix to add IN: pm(6,6), matrix from which to add OUT: pcon(6,6) matrix to which pm is added)

+ Here is the caller graph for this function:

subroutine addvac ( )

Adds vacuum contribution to matrix block a1d.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine ahybrd ( integer  kint,
integer  ks,
integer  kchi 
)

Constructs local (6x6) matrix contribution from a cell using finite hybrid elements.

Deprecated:
kint, not used IN: ks, cell radial number IN: kchi, cell poloidal number

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine anten ( real(rkind)  pt,
real(rkind)  propl,
real(rkind)  pdropl,
real(rkind)  pa,
real(rkind)  pb,
real(rkind)  pc,
real(rkind)  proan,
real(rkind)  pdroan 
)

Computes rho and drho/dtheta on antenna, at theta=pt.

     in:
          pt = theta (defined from 0 to 2*pi)
          propl = rho at theta=pt of plasma surface
          pdropl = drho/dtheta at theta=pt of plasma surface
          pa,pc = distance (pl.,wall) and (pl.,antenna) in units of
          pb = geometrical minor radius (rmax-rmin)/2

     out:
          proan = rho(theta=pt) of antenna surface
          pdroan = drho/dtheta (theta=pt) of antenna surface

+ Here is the caller graph for this function:

subroutine auxval ( )

Set auxiliary values.

Get some parameters from CHEASE namelist, check input consistency and define some auxiliary variables

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine away ( integer  k,
integer  l,
integer  kr 
)

"Remove" a column and a row of a local matrix (put 1 on diagonal, 0 elsewhere)

Deprecated:
k: not used

IN: L, dimension of cona(L,L)
IN: kr, row&column number to "remove"

+ Here is the caller graph for this function:

subroutine basis2 ( real(rkind)  px,
real(rkind)  zdx,
real(rkind)  py,
real(rkind)  zdy,
real(rkind), dimension(16)  pf 
)

Coefficients of linear finite hybrid elements basis functions.

Ref[1], Eq.(3.48)and Fig.7. https://doi.org/10.1016/0167-7977(86)90027-4

------------------------------------------------------------------

     definition of basis functions pf

     point  dxdc    x   dxds  dvdc   v

       1     1      2    3
       2     4      5    6
       3                       7     8
       4                       9    10
       5     11    12    13
       6     14    15    16

     definition of position of the points

         2---4---6
         /   /   /
         /   /   /
         /   /   /
         1---3---5

-------------------------------------------------------------------
Deprecated:
px, py are not used

IN: zdx, radial cell size
IN: zdy, poloidal cell size
OUT: pf(1:16), coefficients

+ Here is the caller graph for this function:

subroutine beshhh ( integer  lmax,
real(rkind)  x,
real(rkind), dimension(lmax+1)  bj 
)

calculate Bessel functions by backward recursion

IN: lmax, Bessel functions up to order lmax IN: x, argument of Bessel function OUT: bj(1)=j_0(x), bj(2)=j_1(x), ... bj(lmax+1)=j_lmax(x)

+ Here is the caller graph for this function:

real(rkind) function besmdi ( integer  nordn,
real(rkind)  xx 
)

Modified Bessel function I of order \(n\).

Ref.[Abramowitz-Stegun 9.8.1 - 9.8.4]

+ Here is the caller graph for this function:

real(rkind) function besmdk ( integer  nordn,
real(rkind)  xx 
)

Modified Bessel function K of order \(n\).

Ref.[Abramowitz-Stegun 9.8.5 - 9.8.8]

Needs function besmdi

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine bessel ( real(rkind)  x,
real(rkind)  y,
integer  n,
complex, dimension(5)  f,
complex  z,
complex  v,
complex, dimension(30)  b 
)

Bessel routine for errfc.

+ Here is the caller graph for this function:

subroutine blank ( integer  krows,
character, dimension(16,krows)  kplot 
)

Puts the std output plot field to blank.

+ Here is the caller graph for this function:

subroutine blines ( integer  k)

Insert k blank lines on std output.

+ Here is the caller graph for this function:

subroutine cald ( complex, dimension((mb1+mb2+2)*mb2+1+(mb1+mb2-1)*(mb1+mb2))  a,
real(rkind)  eps,
integer  mb1,
integer  mb2,
integer  nsing,
integer  neg 
)

LDU-decompose mb2 first lines and columns of matrix a.

IN: eps, tolerance for pivot size mb1: number of lines and columns not to transform mb2: number of lines and columns to decompose nsing: flag -1 if matrix is singular or near-singular

Deprecated:
neg, not used

Need to understand why a is dimensioned in this way. It should be (mb1+mb2)*(mb1+mb2)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine cdlhxv ( )

solve upper triangular system DU x = y

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine center ( integer  ks,
integer  kchi 
)

Obtain X, V, dX/dchi, dX/ds, dV/dchi at center of cell.

Multiply solution vector by finite element basis functions
Eq.(3.48) of Ref.[1], https://doi.org/10.1016/0167-7977(86)90027-4
modified to include option nlphas

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine clear ( )

Clear variables and arrays.

Deprecated:
Does nothing in LION_common
subroutine concel ( integer  km,
integer  k,
integer  kp 
)

Contribution of an interval to Green's function matrices D_mu,nu and E_mu,nu.

km: index (1..13) for type of matrix
k: interval number k
kp: interval number k'

          matrix: a, b, c, d, e, f, g, h, k, l, m, n, r
      km  number: 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13
      data iflag/ 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0/

      iflag = 0 for d_mu,nu;  1 for e_mu,nu

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine const1 ( integer  kchi,
complex, dimension(9)  pc1 
)

Coefficients of weak form terms \(c_1..c_9\).

Ref[1], Eq.(3.19c): https://doi.org/10.1016/0167-7977(86)90027-4

Todo:
Add Ref. for coefficient c_9 (related to e- Landau+TTMP)
Deprecated:
kchi: not used

OUT: pc1(1:9), the coefficients c_1..c_9

Bug:
pc1 array should be dimensioned to 9, and not 8 (well, the bug is now corrected...)

+ Here is the caller graph for this function:

subroutine const2 ( integer  k,
integer  kchi,
complex, dimension(5)  peta,
complex, dimension(5)  pksi 
)

Coefficients of X,V and their partial derivatives for the test and trial functions appearing in weak form terms.

Ref[1], Eq.(3.19b): https://doi.org/10.1016/0167-7977(86)90027-4
but modified for general Jacobian
IN: k, the number of the weak form term (must be between 1 and 9)
OUT: peta(1:5) the coefficients in \(I_k\) for the test function
OUT: pksi(1:5) the coefficients in \(J_k\) for the trial function

Deprecated:
kchi, not used
     the constants are arranged in the following way :

            dxdchi    x     dxds    dvdchi    v
              1       2       3       4       5

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine const3 ( integer  k,
integer  ks,
integer  kchi,
complex, dimension(5)  peta,
complex, dimension(5)  pksi 
)

Coefficients of X,V and their partial derivatives for the test and trial functions appearing in weak form terms.

Ref[1], Eq.(3.19b): https://doi.org/10.1016/0167-7977(86)90027-4
but modified for general Jacobian and poloidal phase extraction
IN: k, the number of the weak form term (must be between 1 and 9)
IN: ks, cell radial number
IN: kchi, cell poloidal number
OUT: peta(1:5) the coefficients in \(I_k\) for the test function
OUT: pksi(1:5) the coefficients in \(J_k\) for the trial function

     the constants are arranged in the following way :

            dxdchi    x     dxds    dvdchi    v
              1       2       3       4       5

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine curent ( )

+ Here is the caller graph for this function:

subroutine cvzero ( integer  k,
complex, dimension(kx*(k-1)+1)  px,
integer  kx 
)

zeroes a complex vector

+ Here is the caller graph for this function:

real(rkind) function dampin ( real(rkind)  ps,
real(rkind)  pchi 
)

Local damping nu/omega.

Deprecated:
could do without... since nu(x) functionality was never implemented...
subroutine datain ( )

check input data consistency

In this version, the namelist NEWRUN from LION is not read here but in LION_prog_ITM.f90, resp. LION_prog_IMAS.f90

Todo:
(re)introduce call to this routine from LION_prog_ITM.f90, resp. LION_prog_IMAS.f90 after reading LION namelist NEWRUN

+ Here is the caller graph for this function:

subroutine dec ( integer  kpsi,
integer  kchi,
integer  kdpsi,
integer  kdpol,
integer, dimension(6)  kplac 
)

Relation between local(cell) and global(block) numberings of the 6 unknowns of a cell.

IN: kpsi, cell radial number OUT: kchi, cell poloidal number IN: kdpol, number of poloidal cells OUT: kdpol(6): the 'global' numbers of the 6 unknowns of the cell (a block = a range of s=const cells)

Deprecated:
kdpsi is not used

+ Here is the caller graph for this function:

real(rkind) function densit ( real(rkind)  ps)

Total mass density at radius ps, normalized to 1. at axis.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine diadic ( integer  kv,
integer  ki,
complex, dimension(6)  pv,
complex, dimension(6)  pw,
complex, dimension(9)  pc1,
complex, dimension(6,6)  pm 
)

Diadic multiplication pm = pc1(ki) * conjg(pv) * pw.

IN: kv, dimension of vectors pv and pw IN: ki(9), weak form term no. ki IN: pv(6), test-funciton vector IN: pw(6), trail-function vector OUT: pm(6,6), contribution of the cell, weak form term no. ki, to local matrix

Bug:
dimension of pc1 should be (9), not (8). Well, now the bug is corected.

+ Here is the caller graph for this function:

subroutine diagno ( )

Organize the computatino and output of diagnostics.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine dispfn ( real(rkind)  parg,
complex, dimension(5)  pfn 
)

Fried-Conte plasma dispersion function for real argument (NRL-formulary: \(Z(\zeta) \))

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine ek ( real(rkind)  peta,
real(rkind)  pe,
real(rkind)  pk 
)

Complete elliptic integrals of 1st and 2nd kind.

IN: peta, real, argument \(\eta=1-k^2\)
OUT: pk, real, \(K(k)\), 1st kind
OUT: pe, real, \(E(k)\), 2nd kind

+ Here is the caller graph for this function:

subroutine ekn ( real(rkind)  peta,
integer  kn,
real(rkind)  pkn,
real(rkind)  pkpn 
)

Computes elliptical integral \(K_n\) and derivative.

IN: peta, real argument \(\eta\) of elliptical integral
IN: kn, integer, order n of elliptical integral
OUT: pkn, real, \(\int_0^{\pi /2} \cos(2nu)/\sqrt{1-(1-\eta)\sin^2(u)}du \)
OUT: pkpn, real, \( dK_n/d\eta \)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine eknlim ( real(rkind)  peta,
integer  kn,
real(rkind)  pkn,
real(rkind)  pkpn 
)

Computes elliptical integral \(K_n(\eta)\) and \(dK_n(\eta)/d\eta\) for high \(n\) and small \(\eta\).

     The integral and its derivative are expressed in terms of
     the modified Bessel function K of order 0 and 1 resp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine eknrec ( real(rkind)  peta,
integer  kn,
real(rkind)  pkn,
real(rkind)  pkpn 
)

Computes elliptical integral \(K_n(\eta)\) and \(dK_n(\eta)/d\eta\) with recursion formula.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine eknsie ( real(rkind)  peta,
integer  kn,
real(rkind)  pkn,
real(rkind)  pkpn 
)

Computes elliptical integral \(K_n(\eta)\) and \(dK_n(\eta)/d\eta\) with series.

     Evaluation with infinite sum given by
     P.F. Byrd and M.D. Friedman, handbook of elliptic integrals for
     engineers and scientists, Springer, 1971, formula 806.01
-----------------------------------------------------------------------
     We substract from the sums the leading terms in order to
     improve slightly the convergence
-----------------------------------------------------------------------

+ Here is the caller graph for this function:

subroutine electr ( )

Electric field, normal and binormal components.

Eq.(3.16b) of Ref.[1], https://doi.org/10.1016/0167-7977(86)90027-4

+ Here is the caller graph for this function:

subroutine errfc ( complex  pz,
complex, dimension(5)  f 
)

Computation of error function in complex plane.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine fastdr ( real(rkind)  pkperp)

k-perp of fast wave from dispersion relation

Eqs (52-53) of [K. Appert, et al, Varenna 1986], with k_y=0 and k_z=n/r

Todo:
Complete reference

+ Here is the caller graph for this function:

subroutine fourie ( )

complex Fourier analysis in poloidal coordinate \(\chi\) and geometrical poloidal angle \(\theta\)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine frame ( integer  kleft,
integer  kright,
integer  krows,
character, dimension(16,krows)  kplot 
)

Fills the frame into the plot field.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine frontb ( )

Construct the matrix A and rhs vector b and direct solve A*x=b using a frontal method.

Ref.[J.K. Reid, Finite Elements in Physics (North-Holland physics publishing, Amsterdam, 1987) p. 395. (Editor R. Gruber)]

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine frprof ( real(rkind)  ps,
real(rkind), dimension(10)  pfrac 
)

Local mass density fractions of all ion species.

IN: ps, radial position OUT: pfrac(1..nrspec), local mass density fractions

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

real(rkind) function frshap ( real(rkind)  ps,
integer  kspec 
)

Shape of fractionnal density profile of species kspec at s=ps.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine getrg ( complex, dimension(ke)  pt,
complex, dimension(kp+ke-ks+1)  p,
integer  ks,
integer  ke,
integer  kp 
)

Get a section of vector pt into a sectino of vector p.

+ Here is the caller graph for this function:

subroutine hermic ( )

Check non-hermicity and impose hermicity of vacuum matrix.

+ Here is the caller graph for this function:

subroutine iarray ( character*(*)  kname,
integer, dimension(kdim)  ka,
integer  kdim 
)

Print name and values of integer array on std output.

+ Here is the call graph for this function:

subroutine imgc ( real(rkind), dimension(l,l)  a,
integer  n,
integer  l,
integer  nul 
)

+ Here is the caller graph for this function:

subroutine init ( )

Initializes diagnostic calculations.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine integr ( integer  k,
integer  kpsi,
integer  kchi 
)

Contribution of one cell to matrix A.

kpsi: radial cell number
kchi: poloidal cell number

Deprecated:
k: argument not used

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine iodsk1 ( integer  k)

Handles disk I/O.

+ Here is the caller graph for this function:

subroutine iodsk2 ( integer  k)

I/O disk operations for plasma surface, vacuum and antenna.

+ Here is the caller graph for this function:

subroutine iodsk4 ( integer  k)

I/O disk operations for matrix and rhs if needed.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine iodsk5 ( integer  k)

Disk I/O for disgnostic operations.

+ Here is the caller graph for this function:

subroutine ivar ( character*(*)  kname,
integer  kvalue 
)

Print name and value of integer variable on std output.

subroutine labrun ( )

Labels the run.

Writes title on stdout

+ Here is the call graph for this function:

subroutine landau ( )

Perturbative damping and drive, in the presence of fast ions.

  • Electron Landau damping of Alfven wave (TAE/EAE/GAE), due to E_parallel and due to drift, ref Nucl.Fus. review (Vaclavik-Appert), Varenna 92 (Villard), Nucl. Fus. 1992 (Villard, Fu).
  • Electron, ion and fast particle collisionless Landau damping (E_parallel and drift) & TTMP & fast particle drive due to drifts. From drift-kinetic model, ref. Brunner- Vaclavik (bv).
  • Single bulk ion species and omega << omegaci is assumed.
  • Fast particles assume a slowing-down distribution function.
    Todo:
    Complete references

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine locpow ( )

Local power absorption.

Eq.(3.38) of Ref.[1], https://doi.org/10.1016/0167-7977(86)90027-4
Includes harmonic ion-cyclotron and electron Landau + TTMP.
Computed for each species separately.

+ Here is the caller graph for this function:

subroutine magnet ( )

Perturbed magnetic field.

Eq.(3.18) of Ref.[1], https://doi.org/10.1016/0167-7977(86)90027-4

+ Here is the caller graph for this function:

subroutine matvec ( real(rkind), dimension(kdim,kdim)  pmatrx,
complex, dimension(kdim)  pin,
complex, dimension(kdim)  pout,
integer  klong,
integer  kdim 
)

+ Here is the caller graph for this function:

subroutine mesage ( character*(*)  kmess)

Print character message on std output.

+ Here is the caller graph for this function:

subroutine moppow ( integer  k)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine mult ( real(rkind), dimension(nd,nd)  a,
real(rkind), dimension(nd,nd)  b,
integer  n,
integer  nd 
)

Multiplies square matrices a=a*b.

Product a*b, overwrite a
INOUT: a, real matrix, dimension (nd,nd), used size (n,n)
IN: b, real matrix, dimension (nd,nd), used size (n,n)
IN: n, used size
IN: nd, dimension

+ Here is the caller graph for this function:

subroutine num ( integer  k,
integer  kn,
integer  kchi 
)
Deprecated:
Not used anymore
subroutine onefun ( integer  k1,
integer  k2,
real(rkind), dimension(k2)  px,
real(rkind), dimension(k2)  py,
character  kchar,
real(rkind)  pleft,
integer  kleft,
real(rkind)  pright,
integer  kright,
real(rkind)  pbottm,
real(rkind)  ptop,
integer  krows,
character, dimension(16,krows)  kplot,
logical  klbar 
)

fills one function into the plot field for std output graph

+ Here is the caller graph for this function:

subroutine organ4 ( )

Organize the computation of the linear algebraic system.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine outp5 ( integer  k)

Handles std output of diagnostics.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine plansh ( )

Check definitions of plasma, antenna and wall surfaces.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine plot5 ( integer  k)

Graphical plot!>

Deprecated:
Many features of do not work any more
Todo:
Refurbish completely the output for plots - perhaps use hdf5?

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine poynti ( )

Poynting vector Re ( E* cross B )

+ Here is the caller graph for this function:

subroutine preset ( )

Sets default values of all input variables.

+ Here is the caller graph for this function:

subroutine putrg ( complex, dimension(ke)  pt,
complex, dimension(kp+ke-ks+1)  p,
integer  ks,
integer  ke,
integer  kp 
)

Put a section of p into a sectino of vector pt.

+ Here is the caller graph for this function:

subroutine qcon ( )

performs matrix operations for q-matrix and vector phi_e

Ref[1], eq.(3.31b): https://doi.org/10.1016/0167-7977(86)90027-4
Ref[2], eq.(3.73): http://dx.doi.org/10.5075/epfl-thesis-673

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine quaequ ( integer  ks,
integer  kchi 
)

Physical and geometrical local (cell) quantities.

IN: ks, radial cell number
IN: kchi, poloidal cell number
All quantities are evaluated at the centre of the cell
Includes the evaluation of the dielectric tensor for the cold plasma case,
Ref[1], Eq.(3.31): https://doi.org/10.1016/0167-7977(86)90027-4
and for the warm plasma case [Ref. missing]

Todo:
Include reference(s) for warm plasma dielctric tensor

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine rarray ( character*(*)  kname,
real(rkind), dimension(kdim)  pa,
integer  kdim 
)

Print name and values of real array on std output.

+ Here is the call graph for this function:

subroutine reseti ( integer, dimension(kdim)  ka,
integer  kdim,
integer  kvalue 
)

Reset integer array to specified value.

subroutine resetr ( real(rkind), dimension(kdim)  pa,
integer  kdim,
real(rkind)  pvalue 
)

Reset real array to specified value.

+ Here is the caller graph for this function:

subroutine rhshyb ( integer  kantyp,
integer  kpsi,
integer  kchi 
)

Contribution of one cell to rhs vector from volume antenna currents in the plasma.

kpsi: radial cell number
kchi: poloidal cell number

Deprecated:
kantyp: argument not used

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine roteta ( integer  km,
integer  k,
integer  kp 
)

rho, drho/dtheta and theta at integration points on pairs of intervals along plasma surface, antenna and wall

km: index (1..13) for type of matrix
k: interval number k
kp: interval number k'

          matrix: a, b, c, d, e, f, g, h, k, l, m, n, r
      km  number: 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13
      data iarg1/ 1, 1, 1, 3, 3, 3, 1, 1, 2, 2, 2, 2, 3/
      data iarg2/ 1, 1, 3, 1, 1, 3, 2, 2, 1, 2, 1, 2, 2/

          iarg1,iarg2:  1=xp (plasma),  2=xa (antenna),  3=xs (wall)
-----------------------------------------------------------------------

     the integration points in theta are read from CHEASE equilibrium,
     with the corresponding values of rho and drho/dtheta at the plasma
     surface, in arrays thint(.,.), roint(.,.) and droint(.,.).

     in this version the integration points are:

     thint(k,1) = (th(k)+th(k+1))/2 - 1/srqt(6) * (th(k+1)-th(k))
     thint(k,2) = (th(k)+th(k+1))/2
     thint(k,3) = (th(k)+th(k+1))/2 + 1/srqt(6) * (th(k+1)-th(k))

     where th(k) is the theta angle at the edges of chi intervals at
     plasma surface, also read from CHEASE equilibrium.
-----------------------------------------------------------------------

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine runtime ( real(rkind)  ptime)

Get wall clock time.

+ Here is the caller graph for this function:

subroutine rvar ( character*(*)  kname,
real(rkind)  pvalue 
)

Print name and value of real variable on std output.

subroutine sflint ( integer  ks)

Contribution to Poynting flux across magnetic surface.

IN: ks, cell radial no.

+ Here is the caller graph for this function:

subroutine slowin ( real(rkind)  pl,
real(rkind)  pu,
real(rkind)  pa,
real(rkind)  pb,
real(rkind), dimension(3)  pint 
)

Integrals I_j's j=0,1,2 for slowing-down distribution.

Ref. Eqs. (54-56) Brunner-Vaclavik dke

Todo:
Complete reference

+ Here is the caller graph for this function:

subroutine store ( integer  k,
real(rkind)  pweit 
)

Adds cell contribution matrix (cona) to the global matrix A (a1d)

Deprecated:

k: not used

pweit: always called only with pweit=1.0

+ Here is the caller graph for this function:

subroutine table2 ( real(rkind), dimension(mdpsi,mdpol)  pmat,
real(rkind)  pmax 
)

Printout of pmat(psi,chi)

+ Here is the caller graph for this function:

subroutine tablef ( real(rkind), dimension(md2fp1, npsi)  pmat)

Printout table of Fourier components.

+ Here is the caller graph for this function:

real(rkind) function tempel ( real(rkind)  ps)

Electron temperature at radius ps.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

real(rkind) function tempi ( integer  k,
real(rkind)  ps 
)

Parallel temperature of k-th ion species at radius ps.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

real(rkind) function temprp ( integer  k,
real(rkind)  ps 
)

Perpendicular temperature of k-th ion species at radius ps.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine tetmsh ( )

Define auxiliary quantities for the theta mesh in vaccum region.

The theta grid values at grid cell edges and midpoints have been read in iodsk1(2)

+ Here is the caller graph for this function:

subroutine theend ( )

This is the end.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine vacuum ( )

Organize vaccum and antenna contributions.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine vaczer ( )

Put vaccum matrix and rhs to zero.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine vect ( complex, dimension(5)  pc,
real(rkind), dimension(16)  pf,
complex, dimension(6)  pv 
)

Determines vector of coefficients of unknowns in a mesh cell.

IN: pc(5), the 5 complex coefficients for dX/dchi, X, dX/ds, dV/dchi, V
IN: pf(16), the 16 basis functions values at grid points, see subroutine basis2
OUT: pv(6), the 6 values of coeeficients for the 6 unknowns

  The local numbering of the 6 unknowns of the cell corresponds to:

                  2---4---6
                  /   /   /
                  /   /   /
                  1---3---5

+ Here is the caller graph for this function:

subroutine wall_sub ( real(rkind)  pt,
real(rkind)  propl,
real(rkind)  pdropl,
real(rkind)  pa,
real(rkind)  pb,
real(rkind)  pc,
real(rkind)  prowa,
real(rkind)  pdrowa 
)

rho and drho/dtheta on the wall

IN: pt: angle theta
IN: propl: rho at plasma surface
IN: pdropl: drho/dtheta at plasma surface
IN: pa: wall-plasma distance in units of horizontal minor radius (walrad-1)
IN: pb: horizontal minor radius (Rmax-Rmin)/2 at plasma surface
OUT: prowa: rho at wall
OUT: drho/dtheta at wall

Deprecated:
IN: pc: not used

+ Here is the caller graph for this function:

subroutine wcon ( )

Construct vacuum matrix and source vector.

Ref[1], Eq.(3.31): https://doi.org/10.1016/0167-7977(86)90027-4
Ref[2], Eqs.(4.11-4.16): http://dx.doi.org/10.5075/epfl-thesis-673

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

subroutine zero ( integer  k)

Reduces matrix for n=0 case.

+ Here is the caller graph for this function: