32SUBROUTINE totzsps(rzl_array, r11, ru1, rv1, z11, zu1, zv1, lu1, lv1, rcn1, zcn1)
36 USE vmec_params,
ONLY:
jmin1,
jlam,
ntmax,
rcc,
rss,
zsc,
zcs,
m0,
m1,
n0
40 REAL(rprec),
DIMENSION(ns,0:ntor,0:mpol1,3*ntmax),
TARGET,
INTENT(inout) :: rzl_array
41 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: r11
42 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: ru1
43 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: rv1
44 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: z11
45 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: zu1
46 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: zv1
47 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: lu1
48 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: lv1
49 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: rcn1
50 REAL(rprec),
DIMENSION(ns*nzeta*ntheta3,0:1),
INTENT(out) :: zcn1
52 INTEGER :: n, m, mparity, k, i, j1, l, j1l, nsl
53 INTEGER :: ioff, joff, mj, ni, nsz
54 REAL(rprec),
DIMENSION(:,:,:),
POINTER :: rmncc, rmnss, zmncs, zmnsc, lmncs, lmnsc
58 REAL(rprec),
DIMENSION(:,:),
ALLOCATABLE :: work1
59 REAL(rprec) :: cosmux, sinmux
65 rmncc => rzl_array(:,:,:,
rcc)
67 lmnsc => rzl_array(:,:,:,
zsc+2*
ntmax)
69 rmnss => rzl_array(:,:,:,
rss)
71 lmncs => rzl_array(:,:,:,
zcs+2*
ntmax)
91 rzl_array(1,:,
m1,:) = rzl_array(2,:,
m1,:)
93 ioff = lbound(rmncc,2)
94 joff = lbound(rmncc,3)
98 lmncs(1,:,
m0+joff) = lmncs(2,:,
m0+joff)
102 ALLOCATE (work1(nsz,12), stat=i)
103 IF (i .ne. 0) stop
'Allocation error in VMEC2000 totzsps'
105 r11 = 0; ru1 = 0; rv1 = 0; rcn1 = 0
106 z11 = 0; zu1 = 0; zv1 = 0; zcn1 = 0
129 work1(j1l:nsl, 1) = work1(j1l:nsl, 1) + rmncc(j1:ns,ni,mj)*cosnv(k,n)
130 work1(j1l:nsl, 6) = work1(j1l:nsl, 6) + zmnsc(j1:ns,ni,mj)*cosnv(k,n)
131 work1(j1l:nsl,10) = work1(j1l:nsl,10) + lmnsc(j1:ns,ni,mj)*cosnv(k,n)
135 work1(j1l:nsl, 4) = work1(j1l:nsl, 4) + rmnss(j1:ns,ni,mj)*cosnvn(k,n)
136 work1(j1l:nsl, 7) = work1(j1l:nsl, 7) + zmncs(j1:ns,ni,mj)*cosnvn(k,n)
137 work1(j1l:nsl,11) = work1(j1l:nsl,11) + lmncs(j1:ns,ni,mj)*cosnvn(k,n)
139 work1(j1l:nsl, 2) = work1(j1l:nsl, 2) + rmnss(j1:ns,ni,mj)*sinnv(k,n)
140 work1(j1l:nsl, 5) = work1(j1l:nsl, 5) + zmncs(j1:ns,ni,mj)*sinnv(k,n)
141 work1(j1l:nsl, 9) = work1(j1l:nsl, 9) + lmncs(j1:ns,ni,mj)*sinnv(k,n)
143 work1(j1l:nsl, 3) = work1(j1l:nsl, 3) + rmncc(j1:ns,ni,mj)*sinnvn(k,n)
144 work1(j1l:nsl, 8) = work1(j1l:nsl, 8) + zmnsc(j1:ns,ni,mj)*sinnvn(k,n)
145 work1(j1l:nsl,12) = work1(j1l:nsl,12) + lmnsc(j1:ns,ni,mj)*sinnvn(k,n)
160 cosmux =
xmpq(m,1)*cosmu(i,m)
161 sinmux =
xmpq(m,1)*sinmu(i,m)
163 r11(j1l:nsl,mparity) = r11(j1l:nsl,mparity) + work1(1:nsz,1)*cosmu(i,m)
164 ru1(j1l:nsl,mparity) = ru1(j1l:nsl,mparity) + work1(1:nsz,1)*sinmum(i,m)
167 rcn1(j1l:nsl,mparity) = rcn1(j1l:nsl,mparity) + work1(1:nsz,1)*cosmux
170 z11(j1l:nsl,mparity) = z11(j1l:nsl,mparity) + work1(1:nsz,6)*sinmu(i,m)
171 zu1(j1l:nsl,mparity) = zu1(j1l:nsl,mparity) + work1(1:nsz,6)*cosmum(i,m)
174 zcn1(j1l:nsl,mparity) = zcn1(j1l:nsl,mparity) + work1(1:nsz,6)*sinmux
177 lu1(j1l:nsl,mparity) = lu1(j1l:nsl,mparity) + work1(1:nsz,10)*cosmum(i,m)
181 r11(j1l:nsl,mparity) = r11(j1l:nsl,mparity) + work1(1:nsz,2)*sinmu(i,m)
182 ru1(j1l:nsl,mparity) = ru1(j1l:nsl,mparity) + work1(1:nsz,2)*cosmum(i,m)
185 rcn1(j1l:nsl,mparity) = rcn1(j1l:nsl,mparity) + work1(1:nsz,2)*sinmux
188 rv1(j1l:nsl,mparity) = rv1(j1l:nsl,mparity) + work1(1:nsz,3)*cosmu(i,m) &
189 + work1(1:nsz,4)*sinmu(i,m)
190 z11(j1l:nsl,mparity) = z11(j1l:nsl,mparity) + work1(1:nsz,5)*cosmu(i,m)
192 zu1(j1l:nsl,mparity) = zu1(j1l:nsl,mparity) + work1(1:nsz,5)*sinmum(i,m)
195 zcn1(j1l:nsl,mparity) = zcn1(j1l:nsl,mparity) + work1(1:nsz,5)*cosmux
198 zv1(j1l:nsl,mparity) = zv1(j1l:nsl,mparity) + work1(1:nsz,7)*cosmu(i,m) &
199 + work1(1:nsz,8)*sinmu(i,m)
201 lu1(j1l:nsl,mparity) = lu1(j1l:nsl,mparity) + work1(1:nsz,9)*sinmum(i,m)
202 lv1(j1l:nsl,mparity) = lv1(j1l:nsl,mparity) - ( work1(1:nsz,11)*cosmu(i,m) &
203 + work1(1:nsz,12)*sinmu(i,m) )
256SUBROUTINE totzspa(rzl_array, r11, ru1, rv1, z11, zu1, zv1, lu1, lv1, rcn1, zcn1)
260 USE vmec_params,
ONLY:
jmin1,
jlam,
ntmax,
rcs,
rsc,
zcc,
zss,
m0,
m1,
n0
264 REAL(rprec),
DIMENSION(ns,0:ntor,0:mpol1,3*ntmax),
TARGET,
INTENT(inout) :: rzl_array
265 REAL(rprec),
DIMENSION(ns*nzeta,ntheta3,0:1),
INTENT(out) :: &
266 r11, ru1, rv1, z11, zu1, zv1, lu1, lv1, rcn1, zcn1
268 INTEGER :: m, n, mparity, k, i, l, j1, j1l, nsl
269 INTEGER :: ioff, joff, mj, ni
270 REAL(rprec),
DIMENSION(:,:,:),
POINTER :: rmncs, rmnsc, zmncc, zmnss, lmncc, lmnss
271 REAL(rprec),
DIMENSION(:,:),
ALLOCATABLE :: work1
272 REAL(rprec) :: cosmux, sinmux
276 rmnsc => rzl_array(:,:,:,
rsc)
278 lmncc => rzl_array(:,:,:,
zcc+2*
ntmax)
280 rmncs => rzl_array(:,:,:,
rcs)
282 lmnss => rzl_array(:,:,:,
zss+2*
ntmax)
292 ioff = lbound(rmnsc,2)
293 joff = lbound(rmnsc,3)
295 ALLOCATE (work1(ns*nzeta,12), stat=i)
296 IF (i .ne. 0) stop
'Allocation error in VMEC totzspa'
299 r11 = 0; ru1 = 0; rv1 = 0
300 z11 = 0; zu1 = 0; zv1 = 0
304 IF (
jlam(
m0) .gt. 1) lmncc(1,:,
m0+joff) = lmncc(2,:,
m0+joff)
317 work1(j1l:nsl,1) = work1(j1l:nsl,1) + rmnsc(j1:ns,ni,mj)*cosnv(k,n)
318 work1(j1l:nsl,6) = work1(j1l:nsl,6) + zmncc(j1:ns,ni,mj)*cosnv(k,n)
319 work1(j1l:nsl,10) = work1(j1l:nsl,10) + lmncc(j1:ns,ni,mj)*cosnv(k,n)
323 work1(j1l:nsl,2) = work1(j1l:nsl,2) + rmncs(j1:ns,ni,mj)*sinnv(k,n)
324 work1(j1l:nsl,3) = work1(j1l:nsl,3) + rmnsc(j1:ns,ni,mj)*sinnvn(k,n)
325 work1(j1l:nsl,4) = work1(j1l:nsl,4) + rmncs(j1:ns,ni,mj)*cosnvn(k,n)
326 work1(j1l:nsl,5) = work1(j1l:nsl,5) + zmnss(j1:ns,ni,mj)*sinnv(k,n)
327 work1(j1l:nsl,7) = work1(j1l:nsl,7) + zmnss(j1:ns,ni,mj)*cosnvn(k,n)
328 work1(j1l:nsl,8) = work1(j1l:nsl,8) + zmncc(j1:ns,ni,mj)*sinnvn(k,n)
329 work1(j1l:nsl,9) = work1(j1l:nsl,9) + lmnss(j1:ns,ni,mj)*sinnv(k,n)
330 work1(j1l:nsl,11) = work1(j1l:nsl,11) + lmnss(j1:ns,ni,mj)*cosnvn(k,n)
331 work1(j1l:nsl,12) = work1(j1l:nsl,12) + lmncc(j1:ns,ni,mj)*sinnvn(k,n)
338 cosmux =
xmpq(m,1)*cosmu(i,m)
339 sinmux =
xmpq(m,1)*sinmu(i,m)
341 r11(:,i,mparity) = r11(:,i,mparity) + work1(:,1)*sinmu(i,m)
342 ru1(:,i,mparity) = ru1(:,i,mparity) + work1(:,1)*cosmum(i,m)
343 z11(:,i,mparity) = z11(:,i,mparity) + work1(:,6)*cosmu(i,m)
344 zu1(:,i,mparity) = zu1(:,i,mparity) + work1(:,6)*sinmum(i,m)
345 lu1(:,i,mparity) = lu1(:,i,mparity) + work1(:,10)*sinmum(i,m)
348 rcn1(:,i,mparity) = rcn1(:,i,mparity) + work1(:,1)*sinmux
349 zcn1(:,i,mparity) = zcn1(:,i,mparity) + work1(:,6)*cosmux
354 r11(:,i,mparity) = r11(:,i,mparity) + work1(:,2)*cosmu(i,m)
355 ru1(:,i,mparity) = ru1(:,i,mparity) + work1(:,2)*sinmum(i,m)
356 z11(:,i,mparity) = z11(:,i,mparity) + work1(:,5)*sinmu(i,m)
357 zu1(:,i,mparity) = zu1(:,i,mparity) + work1(:,5)*cosmum(i,m)
358 lu1(:,i,mparity) = lu1(:,i,mparity) + work1(:,9)*cosmum(i,m)
361 rcn1(:,i,mparity) = rcn1(:,i,mparity) + work1(:,2)*cosmux
362 zcn1(:,i,mparity) = zcn1(:,i,mparity) + work1(:,5)*sinmux
365 rv1(:,i,mparity) = rv1(:,i,mparity) + work1(:,3)*sinmu(i,m) + work1(:,4)*cosmu(i,m)
366 zv1(:,i,mparity) = zv1(:,i,mparity) + work1(:,7)*sinmu(i,m) + work1(:,8)*cosmu(i,m)
367 lv1(:,i,mparity) = lv1(:,i,mparity) - (work1(:,11)*sinmu(i,m)+work1(:,12)*cosmu(i,m))