2 subroutine qst(qcen,cnor,b0ax,r0ax)
7 parameter(nshp=10,ntp=128,nrp=64)
10 common /complr/ rplr(nrp,ntp),zplr(nrp,ntp),dp(5),
11 * psia(nrp),psi(nrp),psim,psip,rm,zm,
12 * fplr(nrp),qplr(nrp),dflufi(nrp),fluxfi(nrp),
15 common /comhel/ helinp, helout
17 c*************************************************************************
19 c
write(6,*)
'"qst" => enter'
27 tg2a=2.d0*drz/(drr-dzz)
28 cos2a=1.d0/sqrt(1.d0+tg2a**2)
31 dxx=0.5d0*(drr+dzz)+0.5d0*cos2a*(drr-dzz)+sin2a*drz
32 dyy=0.5d0*(drr+dzz)+0.5d0*cos2a*(dzz-drr)-sin2a*drz
36 bfcen=qcen*dsqrt(dxx*dyy)
41 c
write(6,*)
'fcen, qcen = ', fcen, qcen
42 c pause
'pause: fcen, qcen'
44 dpsi=(psia(iplas)-psia(iplas-1))
48 fplr(iplas-1)=sqrt(fvac**2-ffp*cnor*(psim-psip)*dpsi)
51 dpsi=0.5d0*(psia(i+2)-psia(i))*(psim-psip)
53 fplr(i)=sqrt(fplr(i+1)**2-2.d0*ffp*dpsi)
58 c---------------------------------------
59 c
open(1,file=
'q_rec.pr')
61 c
write(1,*)
'----------------------'
79 r0=(r1+
r2+r3+r4)*0.25d0
81 sqpol=
funsq(r1,
r2,r3,r4,z1,z2,z3,z4)
83 dflufi(i)=dflufi(i)+sqpol*fplr(i)/r0
87 q2pi=-dflufi(i)/((psia(i+1)-psia(i))*(psim-psip))
92 c
write(1,*)
'qplr(i), dflufi(i), i ', qplr(i), dflufi(i), i
93 c
write(6,*)
'qplr(i), dflufi(i), i ', qplr(i), dflufi(i), i
95 coment
if( dflufi(i).lt.0.d0 ) pause
'pause: dflufi(i) < 0'
98 c...................................................
103 fluxfi(i)=fluxfi(i-1) + dflufi(i-1)
106 c
write(1,*)
'----------------------'
107 c
write(1,*)
'dflufi(i), i=1,iplas =', iplas
108 c
write(1,*) (dflufi(i), i=1,iplas)
109 c
write(1,*)
'----------------------'
110 c
write(1,*)
'----------------------'
111 c
write(1,*)
'qplr(i), i=1,iplas =', iplas
112 c
write(1,*) (qplr(i), i=1,iplas)
113 c
write(1,*)
'----------------------'
114 c
write(1,*)
'----------------------'
115 c
write(1,*)
'fplr(i), i=1,iplas =', iplas
116 c
write(1,*) (fplr(i), i=1,iplas)
117 c
write(1,*)
'----------------------'
118 c
write(1,*)
'----------------------'
119 c
write(1,*)
'fluxfi(i), i=1,iplas =', iplas
120 c
write(1,*) (fluxfi(i), i=1,iplas)
121 c
write(1,*)
'----------------------'
122 c
write(1,*)
'psim, psip =', psim, psip
123 c
write(1,*)
'----------------------'
124 c
write(1,*)
'psi(i), i=1,iplas =', iplas
125 c
write(1,*) (psi(i), i=1,iplas)
126 c
write(1,*)
'----------------------'
127 c
write(1,*)
'----------------------'
128 c
write(1,*)
'psia(i), i=1,iplas =', iplas
129 c
write(1,*) (psia(i), i=1,iplas)
130 c
write(1,*)
'----------------------'
131 c..................................................
133 helout = - fluxfi(iplas)*psip
136 helout = helout + 0.5d0*( psi(i)+psi(i+1) )*dflufi(i)
139 c
write(1,*)
'----------------------'
140 c
write(6,*)
'helinp, helout =', helinp, helout
141 c
write(1,*)
'helinp, helout =', helinp, helout
142 c
write(1,*)
'----------------------'
143 c--------------------------------------------------
145 c--------------------------------------------------
147 c
write(6,*)
'"qst" => exit'
160 parameter(nshp=10,ntp=128,nrp=64)
163 common /complr/ rplr(nrp,ntp),zplr(nrp,ntp),dp(5),
164 * psia(nrp),psi(nrp),psim,psip,xm,ym,
165 * fplr(nrp),qplr(nrp),dflufi(nrp),fluxfi(nrp),
166 * iplas,nt,iplas1,nt1
168 real*8 ron(ntp),teta(ntp)
169 real*8 xs(nshp),ys(nshp),
fun(nshp)
175 c*******************************************************************
177 c
write(6,*)
'"gridpl" => enter'
201 teta(j) = teta(j-1) + dtet
213 fun(nsh) = u(imax,jmax)
221 if(ii.ne.imax .OR. jj.ne.jmax)
then
235 stpx=(r(imax+1)-r(imax))*1.0
236 stpy=(z(jmax+1)-z(jmax))*0.7
238 c----------------------------------------
241 u0=1.d0-((i-1)/(iplas-1.))
248 ro2j=(ur0-um)/( 0.5*dp(3)*cos(ttj)**2
249 + + dp(4)*cos(ttj)*sin(ttj)
250 + + 0.5*dp(5)*sin(ttj)**2 )
255 rplr(i,j)=rm+ron(j)*cos(teta(j))
256 zplr(i,j)=zm+ron(j)*sin(teta(j))
263 if( ron(2) .GT. dmax1(stpx,stpy) ) go to 2799
267 c------------------------
269 c------------------------
271 c
write(6,*)
'ibeg',ibeg,u0
272 c pause
'pause: ibeg'
276 u0=(iplas-i)/(iplas-1.d0)
281 call
loop95(teta,nt,ron,u0)
284 rplr(i,j)=rm+ron(j)*cos(teta(j))
285 zplr(i,j)=zm+ron(j)*sin(teta(j))
289 c-------------------------
298 rplr(i,1)=rplr(i,nt1)
299 zplr(i,1)=zplr(i,nt1)
305 teta(1)=teta(nt1)-2.d0*pi
306 teta(nt)=teta(2)+2.d0*pi
310 psi(i)=psip+psia(i)*(psim-psip)
314 c
write(6,*)
'"gridpl" => exit'
334 dimension rxb(nbndp2),zxb(nbndp2)
338 real*8 roxb(nbndp2),tetxb(nbndp2)
340 real*8 rrk(nbndp4),cck(nbndp4),wrk(nbndp6)
342 real*8 cwk(4),tetpol(1),ro0(1)
344 xzer(x1,x2,v1,v2) = (x1*v2-x2*v1)/(v2-v1)
350 if(u0.lt.2.d-5) u0=2.d-5
356 if(rm.le.r(i+1) .AND. rm.gt.r(i)) icell=i
360 if(zm.le.z(j+1) .AND. zm.gt.z(j)) jcell=j
371 ut(ii,jj)=un(ii,jj)-u0
382 if(ut(i,j)*ut(i+1,j).le.0.)
then
387 rxb(ig)=xzer(r(i+1),r(i),ut(i+1,j),ut(i,j))
411 if(ut(i+1,j)*ut(i,j).le.0. .AND. lin.ne.1)
then
418 rxb(ig)=xzer(r(i+1),r(i),ut(i+1,j),ut(i,j))
421 elseif(ut(i+1,j+1)*ut(i+1,j).le.0..AND. lin.ne.2)
then
429 zxb(ig)=xzer(z(j+1),z(j),ut(i+1,j+1),ut(i+1,j))
431 elseif(ut(i+1,j+1)*ut(i,j+1).le.0. .AND. lin.ne.3)
then
438 rxb(ig)=xzer(r(i+1),r(i),ut(i+1,j+1),ut(i,j+1))
441 elseif(ut(i,j+1)*ut(i,j).le.0..AND. lin.ne.4)
then
449 zxb(ig)=xzer(z(j+1),z(j),ut(i,j+1),ut(i,j))
453 c
write(6,*)
'loop:ic,jc',ic,jc,ig
455 if(jc.eq.jc1 .AND. ic.eq.ic1)
then
478 if(drx.lt.0.) tetp=tetp+pi
479 deltet=tetp-tetxb(ig-1)
480 if(deltet.lt.0.) tetp=tetp+2.*pi
485 roxb(ig)=dsqrt(drx**2+dzx**2)
487 c
write(6,*)
'ig,ro,tet',ig,roxb(ig),tetxb(ig)
492 CALL
e01baf(nxb,tetxb,roxb,rrk,cck,nxb+4,wrk,6*nxb+16,ifail)
494 c
write(6,*)
'ifail=',ifail
498 if(tetp.lt.tetxb(1))
then
500 elseif(tetp.gt.tetxb(nxb))
then
503 CALL
e02bcf(nxb+4,rrk,cck,tetp ,0,cwk,ifail)
505 c
write(6,*)
'ifail=',ifail,j
subroutine e02bcf(NCAP7, K, C, X, LEFT, S, IFAIL)
REAL *8 function funsq(R1, R2, R3, R4, Z1, Z2, Z3, Z4)
subroutine e01baf(M, X, Y, K, C, LCK, WRK, LWRK, IFAIL)
subroutine deriv5(X, Y, F, M, N, U)
subroutine loop95(tetpol, ntet, ro0, u0)
subroutine qst(qcen, cnor, b0ax, r0ax)
real(r8) function r2(a, x, xr, xs, yr, ys, psi, psir, F_dia)