SPEC 3.20
Stepped Pressure Equilibrium Code
global.f90 File Reference

Defines input namelists and global variables, and opens some output files. More...

Data Types

type  typedefns::subgrid
 used for quantities which have different resolutions in different volumes, e.g. the vector potential More...
 
type  typedefns::matrixlu
 
type  typedefns::derivative
 \({\rm d}\mathbf{B}/{\rm d}\mathbf{X}\) (?) More...
 

Modules

module  constants
 some constants used throughout the code
 
module  numerical
 platform-dependant numerical resolution
 
module  fileunits
 central definition of file units to avoid conflicts
 
module  cputiming
 timing variables
 
module  typedefns
 type definitions for custom datatypes
 
module  allglobal
 global variable storage used as "workspace" throughout the code
 
module  fftw_interface
 Interface to FFTW library.
 

Functions/Subroutines

subroutine fileunits::mute (action)
 
subroutine allglobal::build_vector_potential (lvol, iocons, aderiv, tderiv)
 
subroutine allglobal::set_mpi_comm (comm)
 
subroutine allglobal::read_inputlists_from_file ()
 
subroutine allglobal::write_spec_namelist ()
 
subroutine allglobal::check_inputs ()
 
subroutine allglobal::broadcast_inputs
 
subroutine allglobal::wrtend
 The restart file is written.
 
subroutine allglobal::ismyvolume (vvol)
 Check if volume vvol is associated to the corresponding MPI node. More...
 
subroutine allglobal::whichcpuid (vvol, cpu_id)
 Returns which MPI node is associated to a given volume.
 

Variables

real, parameter constants::zero = 0.0
 0
 
real, parameter constants::one = 1.0
 1
 
real, parameter constants::two = 2.0
 2
 
real, parameter constants::three = 3.0
 3
 
real, parameter constants::four = 4.0
 4
 
real, parameter constants::five = 5.0
 5
 
real, parameter constants::six = 6.0
 6
 
real, parameter constants::seven = 7.0
 7
 
real, parameter constants::eight = 8.0
 8
 
real, parameter constants::nine = 9.0
 9
 
real, parameter constants::ten = 10.0
 10
 
real, parameter constants::eleven = 11.0
 11
 
real, parameter constants::twelve = 12.0
 12
 
real, parameter constants::hundred = 100.0
 100
 
real, parameter constants::thousand = 1000.0
 1000
 
real, parameter constants::half = one / two
 1/2
 
real, parameter constants::third = one / three
 1/3
 
real, parameter constants::quart = one / four
 1/4
 
real, parameter constants::fifth = one / five
 1/5
 
real, parameter constants::sixth = one / six
 1/6
 
real, parameter constants::pi2 = 6.28318530717958623
 \(2\pi\)
 
real, parameter constants::pi = pi2 / two
 \(\pi\)
 
real, parameter constants::mu0 = 2.0E-07 * pi2
 \(4\pi\cdot10^{-7}\)
 
real, parameter constants::goldenmean = 1.618033988749895
 golden mean = \(( 1 + \sqrt 5 ) / 2\) ;
 
real, parameter constants::version = 3.23
 version of SPEC
 
real, parameter numerical::machprec = 1.11e-16
 machine precision: 0.5*epsilon(one) for 64 bit double precision
 
real, parameter numerical::vsmall = 100*machprec
 very small number
 
real, parameter numerical::small = 10000*machprec
 small number
 
real, parameter numerical::sqrtmachprec = sqrt(machprec)
 square root of machine precision
 
real, parameter numerical::logtolerance = 1.0e-32
 this is used to avoid taking alog10(zero); see e.g. dforce;
 
integer fileunits::iunit = 10
 input; used in global/readin:ext.sp, global/wrtend:ext.sp.end
 
integer fileunits::ounit = 6
 screen output;
 
integer fileunits::gunit = 13
 wall geometry; used in wa00aa
 
integer fileunits::aunit = 11
 vector potential; used in ra00aa:.ext.AtAzmn;
 
integer fileunits::dunit = 12
 derivative matrix; used in newton:.ext.GF;
 
integer fileunits::hunit = 14
 eigenvalues of Hessian; under re-construction;
 
integer fileunits::munit = 14
 matrix elements of Hessian;
 
integer fileunits::lunit = 20
 local unit; used in lunit+myid: pp00aa:.ext.poincare,.ext.transform;
 
integer fileunits::vunit = 15
 for examination of adaptive quadrature; used in casing:.ext.vcint;
 
real cputiming::tmanual = 0.0
 
real cputiming::manualt = 0.0
 
real cputiming::trzaxis = 0.0
 
real cputiming::rzaxist = 0.0
 
real cputiming::tpackxi = 0.0
 
real cputiming::packxit = 0.0
 
real cputiming::tvolume = 0.0
 
real cputiming::volumet = 0.0
 
real cputiming::tcoords = 0.0
 
real cputiming::coordst = 0.0
 
real cputiming::tbasefn = 0.0
 
real cputiming::basefnt = 0.0
 
real cputiming::tmemory = 0.0
 
real cputiming::memoryt = 0.0
 
real cputiming::tmetrix = 0.0
 
real cputiming::metrixt = 0.0
 
real cputiming::tma00aa = 0.0
 
real cputiming::ma00aat = 0.0
 
real cputiming::tmatrix = 0.0
 
real cputiming::matrixt = 0.0
 
real cputiming::tspsmat = 0.0
 
real cputiming::spsmatt = 0.0
 
real cputiming::tspsint = 0.0
 
real cputiming::spsintt = 0.0
 
real cputiming::tmp00ac = 0.0
 
real cputiming::mp00act = 0.0
 
real cputiming::tma02aa = 0.0
 
real cputiming::ma02aat = 0.0
 
real cputiming::tpackab = 0.0
 
real cputiming::packabt = 0.0
 
real cputiming::ttr00ab = 0.0
 
real cputiming::tr00abt = 0.0
 
real cputiming::tcurent = 0.0
 
real cputiming::curentt = 0.0
 
real cputiming::tdf00ab = 0.0
 
real cputiming::df00abt = 0.0
 
real cputiming::tlforce = 0.0
 
real cputiming::lforcet = 0.0
 
real cputiming::tintghs = 0.0
 
real cputiming::intghst = 0.0
 
real cputiming::tmtrxhs = 0.0
 
real cputiming::mtrxhst = 0.0
 
real cputiming::tlbpol = 0.0
 
real cputiming::lbpolt = 0.0
 
real cputiming::tbrcast = 0.0
 
real cputiming::brcastt = 0.0
 
real cputiming::tdfp100 = 0.0
 
real cputiming::dfp100t = 0.0
 
real cputiming::tdfp200 = 0.0
 
real cputiming::dfp200t = 0.0
 
real cputiming::tdforce = 0.0
 
real cputiming::dforcet = 0.0
 
real cputiming::tnewton = 0.0
 
real cputiming::newtont = 0.0
 
real cputiming::tcasing = 0.0
 
real cputiming::casingt = 0.0
 
real cputiming::tbnorml = 0.0
 
real cputiming::bnormlt = 0.0
 
real cputiming::tjo00aa = 0.0
 
real cputiming::jo00aat = 0.0
 
real cputiming::tpp00aa = 0.0
 
real cputiming::pp00aat = 0.0
 
real cputiming::tpp00ab = 0.0
 
real cputiming::pp00abt = 0.0
 
real cputiming::tbfield = 0.0
 
real cputiming::bfieldt = 0.0
 
real cputiming::tstzxyz = 0.0
 
real cputiming::stzxyzt = 0.0
 
real cputiming::thesian = 0.0
 
real cputiming::hesiant = 0.0
 
real cputiming::tra00aa = 0.0
 
real cputiming::ra00aat = 0.0
 
real cputiming::tnumrec = 0.0
 
real cputiming::numrect = 0.0
 
real cputiming::tdcuhre = 0.0
 
real cputiming::dcuhret = 0.0
 
real cputiming::tminpack = 0.0
 
real cputiming::minpackt = 0.0
 
real cputiming::tiqpack = 0.0
 
real cputiming::iqpackt = 0.0
 
real cputiming::trksuite = 0.0
 
real cputiming::rksuitet = 0.0
 
real cputiming::ti1mach = 0.0
 
real cputiming::i1macht = 0.0
 
real cputiming::td1mach = 0.0
 
real cputiming::d1macht = 0.0
 
real cputiming::tilut = 0.0
 
real cputiming::ilutt = 0.0
 
real cputiming::titers = 0.0
 
real cputiming::iterst = 0.0
 
real cputiming::tsphdf5 = 0.0
 
real cputiming::sphdf5t = 0.0
 
real cputiming::tpreset = 0.0
 
real cputiming::presett = 0.0
 
real cputiming::tglobal = 0.0
 
real cputiming::globalt = 0.0
 
real cputiming::txspech = 0.0
 
real cputiming::xspecht = 0.0
 
real cputiming::tinputlist = 0.0
 
real cputiming::inputlistt = 0.0
 
real cputiming::treadin = 0.0
 
real cputiming::twrtend = 0.0
 
integer allglobal::myid
 MPI rank of current CPU.
 
integer allglobal::ncpu
 number of MPI tasks
 
integer allglobal::ismyvolumevalue
 flag to indicate if a CPU is operating on its assigned volume
 
real allglobal::cpus
 initial time
 
integer allglobal::mpi_comm_spec
 SPEC MPI communicator.
 
logical allglobal::skip_write = .false.
 
real allglobal::pi2nfp
 
real allglobal::pi2pi2nfp
 
real allglobal::pi2pi2nfphalf
 
real allglobal::pi2pi2nfpquart
 
character(len=1000) allglobal::ext
 
real allglobal::forceerr
 total force-imbalance
 
real allglobal::energy
 MHD energy.
 
real allglobal::bnserr
 (in freeboundary) error in self-consistency of field on plasma boundary (Picard iteration)
 
real, dimension(:), allocatable allglobal::ipdt
 
real, dimension(:,:), allocatable allglobal::ipdtdpf
 Toroidal pressure-driven current.
 
integer allglobal::mvol
 
logical allglobal::yesstellsym
 internal shorthand copies of Istellsym, which is an integer input;
 
logical allglobal::notstellsym
 internal shorthand copies of Istellsym, which is an integer input;
 
logical allglobal::yesmatrixfree
 
logical allglobal::notmatrixfree
 to use matrix-free method or not
 
real, dimension(:,:), allocatable allglobal::cheby
 local workspace for evaluation of Chebychev polynomials
 
real, dimension(:,:,:), allocatable allglobal::zernike
 local workspace for evaluation of Zernike polynomials
 
real, dimension(:,:,:), allocatable allglobal::tt
 derivatives of Chebyshev polynomials at the inner and outer interfaces;
 
real, dimension(:,:,:,:), allocatable allglobal::rtt
 derivatives of Zernike polynomials at the inner and outer interfaces;
 
real, dimension(:,:), allocatable allglobal::rtm
 \(r^m\) term of Zernike polynomials at the origin
 
real, dimension(:), allocatable allglobal::zernikedof
 Zernike degree of freedom for each \(m\).
 
integer allglobal::mne
 enhanced resolution for metric elements
 
integer, dimension(:), allocatable allglobal::ime
 enhanced poloidal mode numbers for metric elements
 
integer, dimension(:), allocatable allglobal::ine
 enhanced toroidal mode numbers for metric elements
 
integer allglobal::mns
 enhanced resolution for straight field line transformation
 
integer, dimension(:), allocatable allglobal::ims
 enhanced poloidal mode numbers for straight field line transformation
 
integer, dimension(:), allocatable allglobal::ins
 enhanced toroidal mode numbers for straight field line transformation
 
integer allglobal::lmpol
 what is this?
 
integer allglobal::lntor
 what is this?
 
integer allglobal::smpol
 what is this?
 
integer allglobal::sntor
 what is this?
 
real allglobal::xoffset = 1.0
 used to normalize NAG routines (which ones exacly where?)
 
logical, dimension(:), allocatable allglobal::imagneticok
 used to indicate if Beltrami fields have been correctly constructed;
 
logical allglobal::iconstraintok
 Used to break iteration loops of slaves in the global constraint minimization.
 
real, dimension(:,:), allocatable allglobal::beltramierror
 to store the integral of |curlB-mu*B| computed by jo00aa;
 
integer allglobal::mn
 total number of Fourier harmonics for coordinates/fields; calculated from Mpol, Ntor in readin()
 
integer, dimension(:), allocatable allglobal::im
 poloidal mode numbers for Fourier representation
 
integer, dimension(:), allocatable allglobal::in
 toroidal mode numbers for Fourier representation
 
real, dimension(:), allocatable allglobal::halfmm
 I saw this already somewhere...
 
real, dimension(:), allocatable allglobal::regumm
 I saw this already somewhere...
 
real allglobal::rscale
 no idea
 
real, dimension(:,:), allocatable allglobal::psifactor
 no idea
 
real, dimension(:,:), allocatable allglobal::inifactor
 no idea
 
real, dimension(:), allocatable allglobal::bbweight
 weight on force-imbalance harmonics; used in dforce()
 
real, dimension(:), allocatable allglobal::mmpp
 spectral condensation factors
 
real, dimension(:,:), allocatable allglobal::irbc
 cosine R harmonics of interface surface geometry; stellarator symmetric
 
real, dimension(:,:), allocatable allglobal::izbs
 sine Z harmonics of interface surface geometry; stellarator symmetric
 
real, dimension(:,:), allocatable allglobal::irbs
 sine R harmonics of interface surface geometry; non-stellarator symmetric
 
real, dimension(:,:), allocatable allglobal::izbc
 cosine Z harmonics of interface surface geometry; non-stellarator symmetric
 
real, dimension(:,:), allocatable allglobal::drbc
 cosine R harmonics of interface surface geometry; stellarator symmetric; linear deformation
 
real, dimension(:,:), allocatable allglobal::dzbs
 sine Z harmonics of interface surface geometry; stellarator symmetric; linear deformation
 
real, dimension(:,:), allocatable allglobal::drbs
 sine R harmonics of interface surface geometry; non-stellarator symmetric; linear deformation
 
real, dimension(:,:), allocatable allglobal::dzbc
 cosine Z harmonics of interface surface geometry; non-stellarator symmetric; linear deformation
 
real, dimension(:,:), allocatable allglobal::irij
 interface surface geometry; real space
 
real, dimension(:,:), allocatable allglobal::izij
 interface surface geometry; real space
 
real, dimension(:,:), allocatable allglobal::drij
 interface surface geometry; real space
 
real, dimension(:,:), allocatable allglobal::dzij
 interface surface geometry; real space
 
real, dimension(:,:), allocatable allglobal::trij
 interface surface geometry; real space
 
real, dimension(:,:), allocatable allglobal::tzij
 interface surface geometry; real space
 
real, dimension(:), allocatable allglobal::ivns
 sine harmonics of vacuum normal magnetic field on interfaces; stellarator symmetric
 
real, dimension(:), allocatable allglobal::ibns
 sine harmonics of plasma normal magnetic field on interfaces; stellarator symmetric
 
real, dimension(:), allocatable allglobal::ivnc
 cosine harmonics of vacuum normal magnetic field on interfaces; non-stellarator symmetric
 
real, dimension(:), allocatable allglobal::ibnc
 cosine harmonics of plasma normal magnetic field on interfaces; non-stellarator symmetric
 
real, dimension(:), allocatable allglobal::lrbc
 local workspace
 
real, dimension(:), allocatable allglobal::lzbs
 local workspace
 
real, dimension(:), allocatable allglobal::lrbs
 local workspace
 
real, dimension(:), allocatable allglobal::lzbc
 local workspace
 
integer allglobal::num_modes
 
integer, dimension(:), allocatable allglobal::mmrzrz
 
integer, dimension(:), allocatable allglobal::nnrzrz
 
real, dimension(:,:,:), allocatable allglobal::allrzrz
 
integer allglobal::nt
 discrete resolution along \(\theta\) of grid in real space
 
integer allglobal::nz
 discrete resolution along \(\zeta\) of grid in real space
 
integer allglobal::ntz
 discrete resolution; Ntz=Nt*Nz shorthand
 
integer allglobal::hnt
 discrete resolution; Ntz=Nt*Nz shorthand
 
integer allglobal::hnz
 discrete resolution; Ntz=Nt*Nz shorthand
 
real allglobal::sontz
 one / sqrt (one*Ntz); shorthand
 
real, dimension(:,:,:), allocatable allglobal::rij
 real-space grid; R
 
real, dimension(:,:,:), allocatable allglobal::zij
 real-space grid; Z
 
real, dimension(:,:,:), allocatable allglobal::xij
 what is this?
 
real, dimension(:,:,:), allocatable allglobal::yij
 what is this?
 
real, dimension(:,:), allocatable allglobal::sg
 real-space grid; jacobian and its derivatives
 
real, dimension(:,:,:,:), allocatable allglobal::guvij
 real-space grid; metric elements
 
real, dimension(:,:,:), allocatable allglobal::gvuij
 real-space grid; metric elements (?); 10 Dec 15;
 
real, dimension(:,:,:,:), allocatable allglobal::guvijsave
 what is this?
 
integer, dimension(:,:), allocatable allglobal::ki
 identification of Fourier modes
 
integer, dimension(:,:,:), allocatable allglobal::kijs
 identification of Fourier modes
 
integer, dimension(:,:,:), allocatable allglobal::kija
 identification of Fourier modes
 
integer, dimension(:), allocatable allglobal::iotakkii
 identification of Fourier modes
 
integer, dimension(:,:), allocatable allglobal::iotaksub
 identification of Fourier modes
 
integer, dimension(:,:), allocatable allglobal::iotakadd
 identification of Fourier modes
 
integer, dimension(:,:), allocatable allglobal::iotaksgn
 identification of Fourier modes
 
real, dimension(:), allocatable allglobal::efmn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::ofmn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::cfmn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::sfmn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::evmn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::odmn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::comn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::simn
 Fourier harmonics; dummy workspace.
 
real, dimension(:), allocatable allglobal::ijreal
 what is this ?
 
real, dimension(:), allocatable allglobal::ijimag
 what is this ?
 
real, dimension(:), allocatable allglobal::jireal
 what is this ?
 
real, dimension(:), allocatable allglobal::jiimag
 what is this ?
 
real, dimension(:), allocatable allglobal::jkreal
 what is this ?
 
real, dimension(:), allocatable allglobal::jkimag
 what is this ?
 
real, dimension(:), allocatable allglobal::kjreal
 what is this ?
 
real, dimension(:), allocatable allglobal::kjimag
 what is this ?
 
real, dimension(:,:,:), allocatable allglobal::bsupumn
 tangential field on interfaces; \(\theta\)-component; required for virtual casing construction of field; 11 Oct 12
 
real, dimension(:,:,:), allocatable allglobal::bsupvmn
 tangential field on interfaces; \(\zeta\) -component; required for virtual casing construction of field; 11 Oct 12
 
real, dimension(:,:), allocatable allglobal::goomne
 described in preset()
 
real, dimension(:,:), allocatable allglobal::goomno
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gssmne
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gssmno
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gstmne
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gstmno
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gszmne
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gszmno
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gttmne
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gttmno
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gtzmne
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gtzmno
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gzzmne
 described in preset()
 
real, dimension(:,:), allocatable allglobal::gzzmno
 described in preset()
 
real, dimension(:,:,:,:), allocatable allglobal::dtoocc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::dtoocs
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::dtoosc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::dtooss
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ttsscc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ttsscs
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ttsssc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ttssss
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdstcc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdstcs
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdstsc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdstss
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdszcc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdszcs
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdszsc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::tdszss
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddttcc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddttcs
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddttsc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddttss
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddtzcc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddtzcs
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddtzsc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddtzss
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddzzcc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddzzcs
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddzzsc
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:,:,:), allocatable allglobal::ddzzss
 volume-integrated Chebychev-metrics; see matrix()
 
real, dimension(:,:), allocatable allglobal::tsc
 what is this?
 
real, dimension(:,:), allocatable allglobal::tss
 what is this?
 
real, dimension(:,:), allocatable allglobal::dtc
 what is this?
 
real, dimension(:,:), allocatable allglobal::dts
 what is this?
 
real, dimension(:,:), allocatable allglobal::dzc
 what is this?
 
real, dimension(:,:), allocatable allglobal::dzs
 what is this?
 
real, dimension(:,:), allocatable allglobal::ttc
 what is this?
 
real, dimension(:,:), allocatable allglobal::tzc
 what is this?
 
real, dimension(:,:), allocatable allglobal::tts
 what is this?
 
real, dimension(:,:), allocatable allglobal::tzs
 what is this?
 
real, dimension(:), allocatable allglobal::dtflux
 \(\delta \psi_{toroidal}\) in each annulus
 
real, dimension(:), allocatable allglobal::dpflux
 \(\delta \psi_{poloidal}\) in each annulus
 
real, dimension(:), allocatable allglobal::sweight
 minimum poloidal length constraint weight
 
integer, dimension(:), allocatable allglobal::nadof
 degrees of freedom in Beltrami fields in each annulus
 
integer, dimension(:), allocatable allglobal::nfielddof
 degrees of freedom in Beltrami fields in each annulus, field only, no Lagrange multipliers
 
type(subgrid), dimension(:,:,:), allocatable allglobal::ate
 magnetic vector potential cosine Fourier harmonics; stellarator-symmetric
 
type(subgrid), dimension(:,:,:), allocatable allglobal::aze
 magnetic vector potential cosine Fourier harmonics; stellarator-symmetric
 
type(subgrid), dimension(:,:,:), allocatable allglobal::ato
 magnetic vector potential sine Fourier harmonics; non-stellarator-symmetric
 
type(subgrid), dimension(:,:,:), allocatable allglobal::azo
 magnetic vector potential sine Fourier harmonics; non-stellarator-symmetric
 
integer, dimension(:,:), allocatable allglobal::lma
 Lagrange multipliers (?)
 
integer, dimension(:,:), allocatable allglobal::lmb
 Lagrange multipliers (?)
 
integer, dimension(:,:), allocatable allglobal::lmc
 Lagrange multipliers (?)
 
integer, dimension(:,:), allocatable allglobal::lmd
 Lagrange multipliers (?)
 
integer, dimension(:,:), allocatable allglobal::lme
 Lagrange multipliers (?)
 
integer, dimension(:,:), allocatable allglobal::lmf
 Lagrange multipliers (?)
 
integer, dimension(:,:), allocatable allglobal::lmg
 Lagrange multipliers (?)
 
integer, dimension(:,:), allocatable allglobal::lmh
 Lagrange multipliers (?)
 
real, dimension(:,:), allocatable allglobal::lmavalue
 what is this?
 
real, dimension(:,:), allocatable allglobal::lmbvalue
 what is this?
 
real, dimension(:,:), allocatable allglobal::lmcvalue
 what is this?
 
real, dimension(:,:), allocatable allglobal::lmdvalue
 what is this?
 
real, dimension(:,:), allocatable allglobal::lmevalue
 what is this?
 
real, dimension(:,:), allocatable allglobal::lmfvalue
 what is this?
 
real, dimension(:,:), allocatable allglobal::lmgvalue
 what is this?
 
real, dimension(:,:), allocatable allglobal::lmhvalue
 what is this?
 
integer, dimension(:,:), allocatable allglobal::fso
 what is this?
 
integer, dimension(:,:), allocatable allglobal::fse
 what is this?
 
logical allglobal::lcoordinatesingularity
 set by LREGION macro; true if inside the innermost volume
 
logical allglobal::lplasmaregion
 set by LREGION macro; true if inside the plasma region
 
logical allglobal::lvacuumregion
 set by LREGION macro; true if inside the vacuum region
 
logical allglobal::lsavedguvij
 flag used in matrix free
 
logical allglobal::localconstraint
 what is this?
 
real, dimension(:,:), allocatable allglobal::dma
 energy and helicity matrices; quadratic forms
 
real, dimension(:,:), allocatable allglobal::dmb
 energy and helicity matrices; quadratic forms
 
real, dimension(:,:), allocatable allglobal::dmd
 energy and helicity matrices; quadratic forms
 
real, dimension(:), allocatable allglobal::dmas
 sparse version of dMA, data
 
real, dimension(:), allocatable allglobal::dmds
 sparse version of dMD, data
 
integer, dimension(:), allocatable allglobal::idmas
 sparse version of dMA and dMD, indices
 
integer, dimension(:), allocatable allglobal::jdmas
 sparse version of dMA and dMD, indices
 
integer, dimension(:), allocatable allglobal::ndmasmax
 number of elements for sparse matrices
 
integer, dimension(:), allocatable allglobal::ndmas
 number of elements for sparse matrices
 
real, dimension(:), allocatable allglobal::dmg
 what is this?
 
real, dimension(:), allocatable allglobal::adotx
 the matrix-vector product
 
real, dimension(:), allocatable allglobal::ddotx
 the matrix-vector product
 
real, dimension(:,:), allocatable allglobal::solution
 this is allocated in dforce; used in mp00ac and ma02aa; and is passed to packab
 
real, dimension(:,:,:), allocatable allglobal::gmreslastsolution
 used to store the last solution for restarting GMRES
 
real, dimension(:), allocatable allglobal::mbpsi
 matrix vector products
 
logical allglobal::liluprecond
 whether to use ILU preconditioner for GMRES
 
real, dimension(:,:), allocatable allglobal::beltramiinverse
 Beltrami inverse matrix.
 
real, dimension(:,:,:), allocatable allglobal::diotadxup
 measured rotational transform on inner/outer interfaces for each volume; d(transform)/dx; (see dforce)
 
real, dimension(:,:,:), allocatable allglobal::ditgpdxtp
 measured toroidal and poloidal current on inner/outer interfaces for each volume; d(Itor,Gpol)/dx; (see dforce)
 
real, dimension(:,:,:,:), allocatable allglobal::glambda
 save initial guesses for iterative calculation of rotational-transform
 
integer allglobal::lmns
 number of independent degrees of freedom in angle transformation;
 
real, dimension(:,:,:), allocatable allglobal::dlambdaout
 
real, dimension(:,:,:), allocatable allglobal::bemn
 force vector; stellarator-symmetric (?)
 
real, dimension(:,:), allocatable allglobal::iomn
 force vector; stellarator-symmetric (?)
 
real, dimension(:,:,:), allocatable allglobal::somn
 force vector; non-stellarator-symmetric (?)
 
real, dimension(:,:,:), allocatable allglobal::pomn
 force vector; non-stellarator-symmetric (?)
 
real, dimension(:,:,:), allocatable allglobal::bomn
 force vector; stellarator-symmetric (?)
 
real, dimension(:,:), allocatable allglobal::iemn
 force vector; stellarator-symmetric (?)
 
real, dimension(:,:,:), allocatable allglobal::semn
 force vector; non-stellarator-symmetric (?)
 
real, dimension(:,:,:), allocatable allglobal::pemn
 force vector; non-stellarator-symmetric (?)
 
real, dimension(:), allocatable allglobal::bbe
 force vector (?); stellarator-symmetric (?)
 
real, dimension(:), allocatable allglobal::iio
 force vector (?); stellarator-symmetric (?)
 
real, dimension(:), allocatable allglobal::bbo
 force vector (?); non-stellarator-symmetric (?)
 
real, dimension(:), allocatable allglobal::iie
 force vector (?); non-stellarator-symmetric (?)
 
real, dimension(:,:,:), allocatable allglobal::btemn
 covariant \(\theta\) cosine component of the tangential field on interfaces; stellarator-symmetric
 
real, dimension(:,:,:), allocatable allglobal::bzemn
 covariant \(\zeta\) cosine component of the tangential field on interfaces; stellarator-symmetric
 
real, dimension(:,:,:), allocatable allglobal::btomn
 covariant \(\theta\) sine component of the tangential field on interfaces; non-stellarator-symmetric
 
real, dimension(:,:,:), allocatable allglobal::bzomn
 covariant \(\zeta\) sine component of the tangential field on interfaces; non-stellarator-symmetric
 
real, dimension(:,:), allocatable allglobal::bloweremn
 covariant field for Hessian computation
 
real, dimension(:,:), allocatable allglobal::bloweromn
 covariant field for Hessian computation
 
integer allglobal::lgdof
 geometrical degrees of freedom associated with each interface
 
integer allglobal::ngdof
 total geometrical degrees of freedom
 
real, dimension(:,:,:), allocatable allglobal::dbbdrz
 derivative of magnetic field w.r.t. geometry (?)
 
real, dimension(:,:), allocatable allglobal::diidrz
 derivative of spectral constraints w.r.t. geometry (?)
 
real, dimension(:,:,:,:,:), allocatable allglobal::dffdrz
 derivatives of B^2 at the interfaces wrt geometry
 
real, dimension(:,:,:,:), allocatable allglobal::dbbdmp
 derivatives of B^2 at the interfaces wrt mu and dpflux
 
real, dimension(:,:,:,:,:), allocatable allglobal::hdffdrz
 derivatives of B^2 at the interfaces wrt geometry 2D Hessian;
 
real, dimension(:,:,:,:,:), allocatable allglobal::denergydrr
 derivatives of energy at the interfaces wrt geometry 3D Hessian;
 
real, dimension(:,:,:,:,:), allocatable allglobal::denergydrz
 derivatives of energy at the interfaces wrt geometry 3D Hessian;
 
real, dimension(:,:,:,:,:), allocatable allglobal::denergydzr
 derivatives of energy at the interfaces wrt geometry 3D Hessian;
 
real, dimension(:,:,:,:,:), allocatable allglobal::denergydzz
 derivatives of energy at the interfaces wrt geometry 3D Hessian;
 
real, dimension(:,:,:,:,:), allocatable allglobal::dmupfdx
 derivatives of mu and dpflux wrt geometry at constant interface transform
 
logical allglobal::lhessianallocated
 flag to indicate that force gradient matrix is allocated (?)
 
real, dimension(:,:), allocatable allglobal::hessian
 force gradient matrix (?)
 
real, dimension(:,:), allocatable allglobal::dessian
 derivative of force gradient matrix (?)
 
logical allglobal::lhessian2dallocated
 flag to indicate that 2D Hessian matrix is allocated (?)
 
real, dimension(:,:), allocatable allglobal::hessian2d
 Hessian 2D.
 
real, dimension(:,:), allocatable allglobal::dessian2d
 derivative Hessian 2D
 
logical allglobal::lhessian3dallocated
 flag to indicate that 2D Hessian matrix is allocated (?)
 
real, dimension(:,:), allocatable allglobal::hessian3d
 Hessian 3D.
 
real, dimension(:,:), allocatable allglobal::dessian3d
 derivative Hessian 3D
 
real, dimension(:,:), allocatable allglobal::cosi
 some precomputed cosines
 
real, dimension(:,:), allocatable allglobal::sini
 some precomputed sines
 
real, dimension(:), allocatable allglobal::gteta
 something related to \(\sqrt g\) and \(\theta\) ?
 
real, dimension(:), allocatable allglobal::gzeta
 something related to \(\sqrt g\) and \(\zeta\) ?
 
real, dimension(:), allocatable allglobal::ajk
 definition of coordinate axis
 
real, dimension(:,:,:,:), allocatable allglobal::dradr
 derivatives of coordinate axis
 
real, dimension(:,:,:,:), allocatable allglobal::dradz
 derivatives of coordinate axis
 
real, dimension(:,:,:,:), allocatable allglobal::dzadr
 derivatives of coordinate axis
 
real, dimension(:,:,:,:), allocatable allglobal::dzadz
 derivatives of coordinate axis
 
real, dimension(:,:,:), allocatable allglobal::drodr
 derivatives of coordinate axis
 
real, dimension(:,:,:), allocatable allglobal::drodz
 derivatives of coordinate axis
 
real, dimension(:,:,:), allocatable allglobal::dzodr
 derivatives of coordinate axis
 
real, dimension(:,:,:), allocatable allglobal::dzodz
 derivatives of coordinate axis
 
integer, dimension(:,:), allocatable allglobal::djkp
 for calculating cylindrical volume
 
integer, dimension(:,:), allocatable allglobal::djkm
 for calculating cylindrical volume
 
real, dimension(:), allocatable allglobal::lbbintegral
 B.B integral.
 
real, dimension(:), allocatable allglobal::labintegral
 A.B integral.
 
real, dimension(:), allocatable allglobal::vvolume
 volume integral of \(\sqrt g\); computed in volume
 
real allglobal::dvolume
 derivative of volume w.r.t. interface geometry
 
integer allglobal::ivol
 labels volume; some subroutines (called by NAG) are fixed argument list but require the volume label
 
real allglobal::gbzeta
 toroidal (contravariant) field; calculated in bfield; required to convert \(\dot \theta\) to \(B^\theta\), \(\dot s\) to \(B^s\)
 
integer, dimension(:), allocatable allglobal::iquad
 internal copy of Nquad
 
real, dimension(:,:), allocatable allglobal::gaussianweight
 weights for Gaussian quadrature
 
real, dimension(:,:), allocatable allglobal::gaussianabscissae
 abscissae for Gaussian quadrature
 
logical allglobal::lblinear
 controls selection of Beltrami field solver; depends on LBeltrami
 
logical allglobal::lbnewton
 controls selection of Beltrami field solver; depends on LBeltrami
 
logical allglobal::lbsequad
 controls selection of Beltrami field solver; depends on LBeltrami
 
real, dimension(1:3) allglobal::orzp
 used in mg00aa() to determine \((s,\theta,\zeta)\) given \((R,Z,\varphi)\)
 
type(derivative) allglobal::dbdx
 \({\rm d}\mathbf{B}/{\rm d}\mathbf{X}\) (?)
 
integer allglobal::globaljk
 labels position
 
real, dimension(:,:), allocatable allglobal::dxyz
 computational boundary; position
 
real, dimension(:,:), allocatable allglobal::nxyz
 computational boundary; normal
 
real, dimension(:,:), allocatable allglobal::jxyz
 plasma boundary; surface current
 
real, dimension(1:2) allglobal::tetazeta
 what is this?
 
real allglobal::virtualcasingfactor = -one / (four*pi)
 this agrees with diagno
 
integer allglobal::iberror
 for computing error in magnetic field
 
integer allglobal::nfreeboundaryiterations
 number of free-boundary iterations already performed
 
integer, parameter allglobal::node = 2
 best to make this global for consistency between calling and called routines
 
logical allglobal::first_free_bound = .false.
 flag to indicate that this is the first free-boundary iteration
 
type(c_ptr) fftw_interface::planf
 FFTW-related (?)
 
type(c_ptr) fftw_interface::planb
 FFTW-related (?)
 
complex(c_double_complex), dimension(:,:,:), allocatable fftw_interface::cplxin
 FFTW-related (?)
 
complex(c_double_complex), dimension(:,:,:), allocatable fftw_interface::cplxout
 FFTW-related (?)
 

Detailed Description

Defines input namelists and global variables, and opens some output files.

Note that all variables in namelist need to be broadcasted in readin.

Input geometry

  • The geometry of the \(l\)-th interface, for \(l=0,N\) where \(N\equiv\) Nvol, is described by a set of Fourier harmonics, using an arbitrary poloidal angle,

    \begin{eqnarray} R_l(\theta,\zeta)&=&\sum_{j}R_{j,l}\cos(m_j\theta-n_j\zeta), \\ Z_l(\theta,\zeta)&=&\sum_{j}Z_{j,l}\sin(m_j\theta-n_j\zeta). \end{eqnarray}

  • These harmonics are read from the ext.sp file and come directly after the namelists described above. The required format is as follows:

    \begin{eqnarray} \begin{array}{ccccccccc} m_1 & n_1 & R_{1,0} & Z_{1,0} & R_{1,1} & Z_{1,1} & ... & R_{1,N} & Z_{1,N} \\ m_2 & n_2 & R_{2,0} & Z_{2,0} & R_{2,1} & Z_{2,1} & ... & R_{2,N} & Z_{2,N} \\ ... \\ m_j & n_j & R_{j,0} & Z_{j,0} & R_{j,1} & Z_{j,1} & ... & R_{j,N} & Z_{j,N} \\ ... \end{array} \end{eqnarray}

  • The coordinate axis corresponds to \(j=0\) and the outermost boundary corresponds to \(j=\) Nvol.
  • An arbitrary selection of harmonics may be inluded in any order, but only those within the range specified by Mpol and Ntor will be used.
  • The geometry of all the interfaces, i.e. \(l=0,N\), including the degenerate "coordinate-axis" interface, must be given.

Data Type Documentation

◆ typedefns::subgrid

type typedefns::subgrid

used for quantities which have different resolutions in different volumes, e.g. the vector potential

Class Members
real, dimension(:), allocatable s coefficients
integer, dimension(:), allocatable i indices

◆ typedefns::matrixlu

type typedefns::matrixlu
Class Members
real, dimension(:,:), allocatable mat
integer, dimension(:), allocatable ipivot

◆ typedefns::derivative

type typedefns::derivative

\({\rm d}\mathbf{B}/{\rm d}\mathbf{X}\) (?)

Class Members
logical l what is this?
integer vol Used in coords(); required for global constraint force gradient evaluation.
integer innout what is this?
integer ii what is this?
integer irz what is this?
integer issym what is this?