Parameters: equiltype (qsolver), jbs (false)
To solve the Grad-Shafranov Equation, two flux functions must be specified (see References). TOQ allows three major modes (specified by the equiltype namelist variable) depending upon which two flux functions are used:
For each flux function, several ways are used to parameterize the profile as described below.
Subroutine: psetup
TOQ allows five different ways to parameterize the pressure profile. The parametrization chosen is given by the modelp namelist variable.
xpsi=scaled poloidal flux ranging from 0 on axis to 1 at edge nval=(ncent-nedge)*(1.-xpsi**nexpin)**nexpout+nedge tval=(tcent-tedge)*(1.-xpsi**texpin)**texpout+tedge rval=(rcent-redge)*(1.-xpsi**rexpin)**rexpout+redge g_0=rval/(2.*tval) p(R,psi)=nval*tval*exp(((R/Raxis)**2-1.)*g_0)
do j=1,nppcoef p_0prim(i)=p_0prim(i)+ppcoef(j)*xpsi**(j-1) p_0(i)=p_0(i)+ppcoef(j)*(xpsi**j-1.)/float(j) end do do j=1,nrotcoef g_0(i)=g_0(i)+rotcoef(j)*xpsi**(j-1) g_0prim(i)=g_0prim(i)+(j-1)*rotcoef(j)*xpsi**(j-2) end do
p_0prim(i)=-bp4*jff4*((1.-xpsi**alp4)**gamp4* $ (1.+cp4*xpsi**alp4)+ $ sigp4*xpsi/(1.+((xpsi-a04)/d4)**2))/(4.*pi)
call spline(xppspline,ppspline,nppspline,-1.e30,-1.e30, $ y2coeff)
Subroutine: qsetup
TOQ allows three different ways to parameterize the q profile when equiltype='qsolver'. The parametrization chosen is given by the modelq variable.
iqval.lt.0 (roughly gammaq 0:1 determines crossover between alphaq dependence and alpha=2 dependence) alphaq=(qlimp-qaxp-2.*(1-gammaq)*(qlim-qax-qaxp))/ > (gammaq*(qlim-qax-qaxp)) otherwise alphaq specified on input if(iqval.le.0) qval=(qv2*xv+qv1)*xv+qv0+qv3*xv**alphaq else qval=qax+(qlim-qax)*xv**alphaq
call spline(xqspline,qspline,nqspline,qpaxspline, $ qplimspline,qpp)
Subroutine: sigset
TOQ allows three different ways to parameterize the f profile when equiltype='ffprime'. The parametrization chosen is given by the modelf variable.
do i=1,npsi xx=xval(i) temp1=ffpcoef(1) do j=2,nffp ffp(i)=ffp(i)+ffpcoef(j)*xx**(j-1) end do endif integrate ffp to get f with boundary condition f(npsi)=rzero*baxis0
do i=1,npsi xx=xval(i) fp(i)=jff4*((1-xx**aj4)**gamj4+ $ sigj4*xx*(1-xx)**2/(1.+((xx-a04)/d4)**2))*(1.-bp4) end do integrate ffp to get f with boundary condition f(npsi)=rzero*baxis0
Subroutine: sigset
TOQ allows only one way to parameterize the JdotB profile when equiltype='jdotb'.
Parameters: ncdcoeff (2),cdcoeff,cdx (0.5),cddelx (0.02),cdlocbump (1. e10),cdwidthbump (1), bavcd (0)
do j=1,ncdcoeff+1
cdcoeff(j)=(bavcd+(1.-bavcd)*gamma)*cdcoeff(j)
end do
do i=1,npsi
xx=xval(i)
temp1=cdcoeff(1)
do j=2,ncdcoeff
temp1=temp1+cdcoeff(j)*xx**(j-1)
end do
temp1=temp1+ cdcoeff(ncdcoeff+1)*xx*(1-xx)**2
$ /((1.+((xx-cdlocbump)/cdwidthbump)**2))
cd(i)=temp1*0.5*(1.-tanh((xx-cdx)/cddelx))
end do
Bootstrap Options(for when jbs=true)
Subroutine: sigset