15 REAL(rprec),
PARAMETER :: two=2.0_dp
17 REAL(rprec),
PARAMETER :: pexp=4.0_dp
19 INTEGER :: i, m, j, n, mn, mn1, nmin0, istat1, istat2
20 INTEGER :: mnyq0, nnyq0
21 REAL(rprec):: argi, arg, argj, dnorm, dnorm3
22 logical :: dbg_fixaray
23 real(rprec),
allocatable :: arg_mu(:,:), arg_nv(:,:)
33 mnyq = max(0, 2*mnyq0, 2*mpol1)
34 nnyq = max(0, 2*nnyq0, 2*ntor)
38 ALLOCATE(cosmu(ntheta3,0:
mnyq), sinmu(ntheta3,0:
mnyq), &
39 cosmum(ntheta3,0:
mnyq), sinmum(ntheta3,0:
mnyq), &
40 cosmui(ntheta3,0:
mnyq), cosmumi(ntheta3,0:
mnyq), &
41 cosmui3(ntheta3,0:
mnyq),cosmumi3(ntheta3,0:
mnyq), &
42 sinmui(ntheta3,0:
mnyq), sinmumi(ntheta3,0:
mnyq), &
43 cosnv(nzeta,0:
nnyq), sinnv(nzeta,0:
nnyq), &
44 cosnvn(nzeta,0:
nnyq), sinnvn(nzeta,0:
nnyq), &
45 cos01(nznt), sin01(nznt), stat=istat1 )
46 ALLOCATE(xm(mnmax), xn(mnmax), ixm(mnsize), jmin3(0:mnsize-1), &
47 xm_nyq(mnmax_nyq), xn_nyq(mnmax_nyq), &
49 allocate(arg_mu(ntheta3,0:
mnyq), arg_nv(nzeta,0:
nnyq))
51 IF (istat1.ne.0) stop
'allocation error in fixaray: istat1'
52 IF (istat2.ne.0) stop
'allocation error in fixaray: istat2'
58 dnorm = one/(nzeta*(ntheta2-1.0_dp))
63 dnorm3 = one/(nzeta*ntheta1)
65 dnorm3 = one/(nzeta*(ntheta2-1.0_dp))
81 argi = twopi*(i-1)/ntheta1
87 cosmu(i,m) = cos(arg)*
mscale(m)
88 sinmu(i,m) = sin(arg)*
mscale(m)
90 cosmui(i,m) = dnorm*cosmu(i,m)
91 sinmui(i,m) = dnorm*sinmu(i,m)
92 IF (i.EQ.1 .OR. i.EQ.ntheta2)
then
96 cosmui(i,m)=cosmui(i,m)/2.0_dp
100 cosmui3(i,m) = dnorm3*cosmu(i,m)
101 IF (.not.lasym .and. (i.eq.1 .or. i.eq.ntheta2))
then
104 cosmui3(i,m) = cosmui3(i,m)/2.0_dp
107 cosmum(i,m) = cosmu(i,m)*(m)
108 sinmum(i,m) =-sinmu(i,m)*(m)
109 cosmumi(i,m) = cosmui(i,m)*(m)
110 sinmumi(i,m) =-sinmui(i,m)*(m)
112 cosmumi3(i,m) = cosmui3(i,m)*m
117 argj = twopi*(j-1)/nzeta
123 cosnv(j,n) = cos(arg)*
nscale(n)
124 sinnv(j,n) = sin(arg)*
nscale(n)
125 cosnvn(j,n) = cosnv(j,n)*(n*nfp)
126 sinnvn(j,n) = -sinnv(j,n)*(n*nfp)
134 xmpq(m,1) = m*(m - 1.0_dp)
138 xmpq(m,3) = m**(pexp+1.0_dp)
149 IF (m .eq. 0) nmin0 = 0
157 IF (mn1 .ne. mnmax) stop
'mn1 != mnmax'
160 if (dbg_fixaray)
then
162 call add_real_2d(
"arg_mu", ntheta3,
mnyq+1, arg_mu(1:ntheta3, 0:
mnyq))
163 call add_real_2d(
"arg_nv", nzeta,
nnyq+1, arg_nv(1:nzeta, 0:
nnyq))
165 call add_real_2d(
"cosmu", ntheta2,
mnyq+1, cosmu(1:ntheta2,:))
166 call add_real_2d(
"sinmu", ntheta2,
mnyq+1, sinmu(1:ntheta2,:))
167 call add_real_2d(
"cosmum", ntheta2,
mnyq+1, cosmum(1:ntheta2,:))
168 call add_real_2d(
"sinmum", ntheta2,
mnyq+1, sinmum(1:ntheta2,:))
169 call add_real_2d(
"cosmui", ntheta2,
mnyq+1, cosmui(1:ntheta2,:))
170 call add_real_2d(
"sinmui", ntheta2,
mnyq+1, sinmui(1:ntheta2,:))
171 call add_real_2d(
"cosmui3", ntheta2,
mnyq+1, cosmui3(1:ntheta2,:))
172 call add_real_2d(
"cosmumi", ntheta2,
mnyq+1, cosmumi(1:ntheta2,:))
173 call add_real_2d(
"sinmumi", ntheta2,
mnyq+1, sinmumi(1:ntheta2,:))
174 call add_real_2d(
"cosmumi3", ntheta2,
mnyq+1, cosmumi3(1:ntheta2,:))
176 call add_real_2d(
"cosnv", nzeta,
nnyq+1, cosnv)
177 call add_real_2d(
"sinnv", nzeta,
nnyq+1, sinnv)
178 call add_real_2d(
"cosnvn", nzeta,
nnyq+1, cosnvn)
179 call add_real_2d(
"sinnvn", nzeta,
nnyq+1, sinnvn)
197 IF (m .eq. 0) nmin0 = 0
205 IF (mn1 .ne. mnmax_nyq) stop
'mn1 != mnmax_nyq'
214 argi = twopi*(i - 1)/ntheta1
217 cos01(mn) = m*cos(m*argi)*
mscale(m)
218 sin01(mn) =-m*sin(m*argi)*
mscale(m)
227 if (dbg_fixaray)
then
229 call add_int(
"ntheta3", ntheta3)
230 call add_int(
"mnyq",
mnyq)
231 call add_int(
"nzeta", nzeta)
232 call add_int(
"nnyq",
nnyq)
233 call add_int(
"nznt", nznt)
234 call add_int(
"mnmax", mnmax)
235 call add_int(
"mnsize", mnsize)
236 call add_int(
"mnmax_nyq", mnmax_nyq)
238 call add_real_1d(
"cos01", nznt, cos01)
239 call add_real_1d(
"sin01", nznt, sin01)
241 call add_real_1d(
"xm", mnmax, xm)
242 call add_real_1d(
"xn", mnmax, xn)
244 call add_real_1d(
"xm_nyq", mnmax_nyq, xm_nyq)
245 call add_real_1d(
"xn_nyq", mnmax_nyq, xn_nyq)
247 call add_int_1d(
"ixm", mnsize, ixm)
255 call add_real_2d(
"xmpq", mpol, 3,
xmpq(0:mpol1,1:3))
257 call add_real_1d(
"faccon", mpol,
faccon)
integer num_eqsolve_retries
real(rprec), dimension(0:mpol1d, 3) xmpq
spectral condensation weighting factors
real(rprec), dimension(0:mpol1d) faccon
factor for spectral constraint