19 REAL(rprec),
DIMENSION(ns,nzeta,ntheta3,0:1),
INTENT(in) :: r1, z1
20 REAL(rprec),
DIMENSION(ns,nzeta,ntheta3),
INTENT(in) :: ru0, zu0
22 INTEGER,
PARAMETER :: limpts = 61
23 REAL(rprec),
PARAMETER :: p5 = 0.5_dp, two = 2.0_dp
25 INTEGER :: iv, iu, iu_r, ivminus, nlim, ns12, klim, n
31 REAL(rprec),
DIMENSION(:),
allocatable :: rcom, zcom
32 REAL(rprec),
DIMENSION(:,:),
allocatable :: r1b, z1b, rub, zub
33 REAL(rprec),
DIMENSION(:,:),
allocatable :: r12, z12
34 REAL(rprec),
DIMENSION(:,:),
allocatable :: rs, zs, tau, ru12, zu12, tau0
36 REAL(rprec) :: rlim, zlim
37 REAL(rprec) :: rmax, rmin, zmax, zmin, dzeta
38 REAL(rprec) :: ds, mintau, mintemp
51 allocate(r1b(nzeta,ntheta1)); r1b = cbig
52 allocate(z1b(nzeta,ntheta1)); z1b = cbig
53 allocate(rub(nzeta,ntheta1)); rub = cbig
54 allocate(zub(nzeta,ntheta1)); zub = cbig
55 allocate(r12(nzeta,ntheta1)); r12 = cbig
56 allocate(z12(nzeta,ntheta1)); z12 = cbig
57 allocate(rs(nzeta,ntheta1)); rs = cbig
58 allocate(zs(nzeta,ntheta1)); zs = cbig
59 allocate(tau(nzeta,ntheta1)); tau = cbig
60 allocate(ru12(nzeta,ntheta1)); ru12 = cbig
61 allocate(zu12(nzeta,ntheta1)); zu12 = cbig
62 allocate(tau0(nzeta,ntheta1)); tau0 = cbig
72 planes:
DO iv = 1, nzeta/2+1
74 r1b(iv,:ntheta3) = r1(ns,iv,:,0) + r1(ns,iv,:,1)
75 z1b(iv,:ntheta3) = z1(ns,iv,:,0) + z1(ns,iv,:,1)
77 r12(iv,:ntheta3) = r1(ns12,iv,:,0) + r1(ns12,iv,:,1)*
sqrts(ns12)
78 z12(iv,:ntheta3) = z1(ns12,iv,:,0) + z1(ns12,iv,:,1)*
sqrts(ns12)
80 rub(iv,:ntheta3) = ru0(ns,iv,:)
81 zub(iv,:ntheta3) = zu0(ns,iv,:)
83 ru12(iv,:ntheta3) = p5*(ru0(ns,iv,:) + ru0(ns12,iv,:))
84 zu12(iv,:ntheta3) = p5*(zu0(ns,iv,:) + zu0(ns12,iv,:))
92 ivminus = mod(nzeta - (iv - 1), nzeta) + 1
93 DO iu = 1+ntheta2, ntheta1
94 iu_r = ntheta1 + 2 - iu
96 r1b(iv,iu) = r1(ns, ivminus,iu_r,0) + r1( ns, ivminus,iu_r,1)
97 z1b(iv,iu) =-( z1(ns, ivminus,iu_r,0) + z1( ns, ivminus,iu_r,1))
98 rub(iv,iu) =- ru0(ns, ivminus,iu_r)
99 zub(iv,iu) = zu0(ns, ivminus,iu_r)
101 r12(iv,iu) = r1(ns12,ivminus,iu_r,0) + r1( ns12,ivminus,iu_r,1)*
sqrts(ns12)
102 z12(iv,iu) =-( z1(ns12,ivminus,iu_r,0) + z1( ns12,ivminus,iu_r,1)*
sqrts(ns12))
103 ru12(iv,iu)=-(ru0(ns, ivminus,iu_r) + ru0(ns12,ivminus,iu_r))*p5
104 zu12(iv,iu)= (zu0(ns, ivminus,iu_r) + zu0(ns12,ivminus,iu_r))*p5
109 rmin = minval(r1b(iv,:))
110 rmax = maxval(r1b(iv,:))
111 zmin = minval(z1b(iv,:))
112 zmax = maxval(z1b(iv,:))
115 rcom(iv) = (rmax + rmin)/2.0_dp
116 zcom(iv) = (zmax + zmin)/2.0_dp
122 rs(iv,iu) = (r1b(iv,iu) - r12(iv,iu))/ds + r1(1,iv,1,0)
123 zs(iv,iu) = (z1b(iv,iu) - z12(iv,iu))/ds + z1(1,iv,1,0)
124 tau0(iv,iu) = ru12(iv,iu)*zs(iv,iu) - zu12(iv,iu)*rs(iv,iu)
130 zlim = zmin + ((zmax - zmin)*(nlim-1))/(limpts-1)
132 IF (.not.lasym .and. (iv.eq.1 .or. iv.eq.nzeta/2+1))
THEN
134 IF (nlim .gt. 1)
then
141 rlim = rmin + ((rmax - rmin)*(klim-1))/(limpts-1)
143 tau(iv,:) =
signgs*(tau0(iv,:) - ru12(iv,:)*zlim + zu12(iv,:)*rlim)
145 mintemp = minval(tau(iv,:))
146 IF (mintemp .gt. mintau)
THEN
150 ELSE IF (mintemp .eq. mintau)
THEN
152 IF (abs(zcom(iv)).gt.abs(zlim))
then
161 if (.not. lasym)
then
164 do iv = nzeta/2+2, nzeta
165 rcom(iv) = rcom(nzeta+1-(iv-1))
166 zcom(iv) =-zcom(nzeta+1-(iv-1))
173 raxis_cc(n) = dzeta*sum(cosnv(:,n)*rcom(:))/
nscale(n)
174 zaxis_cs(n) =-dzeta*sum(sinnv(:,n)*zcom(:))/
nscale(n)
176 raxis_cs(n) =-dzeta*sum(sinnv(:,n)*rcom(:))/
nscale(n)
177 zaxis_cc(n) = dzeta*sum(cosnv(:,n)*zcom(:))/
nscale(n)
178 IF (n.eq.0 .or. n.eq.nzeta/2)
THEN
179 raxis_cc(n) = p5*raxis_cc(n)
180 zaxis_cc(n) = p5*zaxis_cc(n)
188 call add_real_1d(
"raxis_in" , ivmax, r1(1,1:ivmax,1,0) )
189 call add_real_1d(
"zaxis_in" , ivmax, z1(1,1:ivmax,1,0) )
191 call add_real_2d(
"r1b" , ivmax, ntheta1, r1b(1:ivmax,:) )
192 call add_real_2d(
"z1b" , ivmax, ntheta1, z1b(1:ivmax,:) )
193 call add_real_2d(
"rub" , ivmax, ntheta1, rub(1:ivmax,:) )
194 call add_real_2d(
"zub" , ivmax, ntheta1, zub(1:ivmax,:) )
196 call add_real_2d(
"r12" , ivmax, ntheta1, r12(1:ivmax,:) )
197 call add_real_2d(
"z12" , ivmax, ntheta1, z12(1:ivmax,:) )
198 call add_real_2d(
"ru12", ivmax, ntheta1, ru12(1:ivmax,:))
199 call add_real_2d(
"zu12", ivmax, ntheta1, zu12(1:ivmax,:))
201 call add_real_2d(
"rs" , ivmax, ntheta1, rs(1:ivmax,:) )
202 call add_real_2d(
"zs" , ivmax, ntheta1, zs(1:ivmax,:) )
204 call add_real_2d(
"tau0", ivmax, ntheta1, tau0(1:ivmax,:))
209 call add_real_2d(
"tau" , ivmax, ntheta1, tau(1:ivmax,:) )
211 call add_real_1d(
"rcom", nzeta, rcom)
212 call add_real_1d(
"zcom", nzeta, zcom)
214 call add_real_1d(
"raxis_cc", ntor+1, raxis_cc)
215 call add_real_1d(
"zaxis_cs", ntor+1, zaxis_cs)
216 call add_real_1d(
"raxis_cs", ntor+1, raxis_cs)
217 call add_real_1d(
"zaxis_cc", ntor+1, zaxis_cc)
222 deallocate(rcom, zcom)
223 deallocate(r1b, z1b, rub, zub, &
225 rs, zs, tau, ru12, zu12, tau0)