1 SUBROUTINE output(NGRID,betpol,zli3)
8 common/equili/ bettot, rmx, zzrmx, rmn, zzrmn,
9 * zmx, rrzmx, zmn, rrzmn,
10 * r0cen, z0cen, radm, aspect,
11 * eupper, elower, delup, dellw, bfvakc,
14 common/comlop/ rxb(nbndp2),zxb(nbndp2),nxb
15 common/combrz/ bmr(nip,njp),bmz(nip,njp)
16 common /volpla/ vol_pl
18 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
19 c----------------------------------------------------------------------
20 if(ngrid.eq.0) go to 999
28 c kavin-----------------------------------------------------------------------
30 c------------------------------------------------------------------------------
33 c kavin-----------------------------------------------------------------------
41 slen=slen+dsqrt((rxb(i)-rxb1)**2+(zxb(i)-zxb1)**2)
42 c------------------------------------------------------------------------------
44 if(rxb(i).gt.rmx)
then
49 if(rxb(i).lt.rmn)
then
54 if(zxb(i).gt.zmx)
then
59 if(zxb(i).lt.zmn)
then
70 eupper=dabs(zmx-zm)/radm
71 elower=dabs(zmn-zm)/radm
72 delup=(r0cen-rrzmx)/radm
73 dellw=(r0cen-rrzmn)/radm
75 c
write(3,*)
'___________________________________'
76 c
write(3,*)
' max. R on plasma boundary:'
77 c
write(3,*)
' rmx = ',rmx
78 c
write(3,*)
' Z(rmx)=',zzrmx
79 c
write(3,*)
' min. R on plasma boundary:'
80 c
write(3,*)
' rmn = ',rmn
81 c
write(3,*)
' Z(rmn) ',zzrmn
82 c
write(3,*)
' max. Z on plasma boundary:'
83 c
write(3,*)
' zmx ',zmx
84 c
write(3,*)
' R(zmx) ',rrzmx
85 c
write(3,*)
' min. Z on plasma boundary:'
86 c
write(3,*)
' zmn ',zmn
87 c
write(3,*)
' R(zmn) ',rrzmn
88 c
write(3,*)
' major plasma radius:'
89 c
write(3,*)
' r0cen=',r0cen
90 c
write(3,*)
' z0cen=',z0cen
91 c
write(3,*)
' minor plasma radius:'
92 c
write(3,*)
' radm= ',radm
93 c
write(3,*)
' aspect ratio:'
94 c
write(3,*)
' aspect=',aspect
95 c
write(3,*)
' upper plasma elongation:'
96 c
write(3,*)
' Eupper=',eupper
97 c
write(3,*)
' lower plasma elongation:'
98 c
write(3,*)
' Elower=',elower
99 c
write(3,*)
' upper plasma triang.:'
100 c
write(3,*)
' DELup =',delup
101 c
write(3,*)
' lower plasma triang.:'
102 c
write(3,*)
' DELlw =',dellw
114 if(iprr.ne.1) go to 210
115 c... bp2ij=(bmz(i-1,j)**2+bmz(i,j)**2+
116 c... + bmr(i,j-1)**2+bmr(i,j)**2)*0.5
117 c... bpolin=bpolin+bp2ij*dri(i)*dzj(j)*r(i)
118 c kavin-----------------------------------------------------
119 volpl = volpl + r(i)*dri(i)*dzj(j)
120 sqpl = sqpl + dri(i)*dzj(j)
121 psres = psres + curf(i,j)*u(i,j) *dri(i)*dzj(j)
122 zc = zc + curf(i,j)*z(j) *dri(i)*dzj(j)/tok
123 c-----------------------------------------------------------
129 c... zli3 = 4.*pi*bpolin/(r0cen*tok*tok)
131 c kavin-----------------------------------------------------
132 c psres=(psres/tok-up)/(0.6283185*r0cen*tok)
133 psres=(psres/tok-up)/(0.6283185*tok)*sqpl/volpl
134 c
write(3,*)
' li(3) :'
135 c
write(3,*)
'ZLI3=',zli3
139 c------------------------------------------------------------
147 if(iprr.ne.1) go to 310
150 pintg=pintg+zpres*dri(i)*dzj(j)
151 pintv=pintv+zpres*r(i)*dri(i)*dzj(j)
152 volpl=volpl+ r(i)*dri(i)*dzj(j)
158 betpol = 8.*pi*pintg/(tok*tok)
159 betpol = betpol*(um-up)*cnor
161 c
write(3,*) (paverg*(um-up)*cnor),
' li3=', zli3,
'LENGTH :',slen
162 c ----
write(3,*)
'BETPOL :'
163 c ----
write(3,*)
'BETpol=',betpol
164 c ----
write(3,*)
'cnor,um,up',cnor,um,up
166 c
write(3,
'(3(a,1pe12.4))')
167 c >
' Psmax =',(7.8957*um),
168 c >
' Psbound =',(7.8957*up),
169 c >
' Psxpt =',(7.8957*ux0)
174 fun(nsh) = u(imax,jmax)
184 if(i.eq.imax .AND. j.eq.jmax) go to 810
199 tg2a=2.d0*drz/(drr-dzz)
200 cos2a=1.d0/dsqrt(1.d0+tg2a**2)
203 dxx=0.5d0*(drr+dzz)+0.5d0*cos2a*(drr-dzz)+sin2a*drz
204 dyy=0.5d0*(drr+dzz)+0.5d0*cos2a*(dzz-drr)-sin2a*drz
206 bfcen=qcen*dsqrt(dxx*dyy)
208 bettot=2.d0*paverg/(bfcen**2)
209 c bettot=bettot*(um-up)*cnor
210 bettot=paverg*(um-up)*cnor
212 bettot=betpol*slen**2/sqpl/4d0/pi
214 c
write(6,*)
'bettot ',bettot
216 c _______________________________________________
219 fintg=funfff(1.d0)*(um-up)*cnor
220 fxcen=dsqrt(fcen**2-2.*fintg)
237 common/comlop/ rxb(nbndp2), zxb(nbndp2), nxb
238 common/comus1/ rus1(nbndp2), zus1(nbndp2), nus1
239 common/comus2/ rus2(nbndp2), zus2(nbndp2), nus2
240 dimension rwork(nbndp2), zwork(nbndp2)
241 dimension us(nip,njp)
243 xzer(x1,x2,v1,v2) = (x1*v2-x2*v1)/(v2-v1+1.d-8)
245 c --- **********************************************
246 c
write(5,*)
'*** entrance of subr. loop ***'
248 c
write(6,*)
'*** entrance of subr. loop ***'
249 c --- **********************************************
250 c --- un(i,j)=0 - plasma boundary
257 us(i,j) = alpnew * (un(i,j) - 1.d0) + 1.d0
258 un(i,j) = un(i,j) - delunb
260 c----------------------------------------------------------
261 c------*****----------------------------------------------------
270 if(un(i,j)*un(i+1,j).le.0.)
then
274 rxb(ig)=xzer(r(i+1),r(i),un(i+1,j),un(i,j))
292 c---------------------------------------------------------------
299 if(un(i+1,j)*un(i,j).le.0. .AND. lin.ne.1)
then
305 rxb(ig) = xzer(r(i+1),r(i),un(i+1,j),un(i,j))
308 elseif(un(i+1,j+1)*un(i+1,j).le.0..AND. lin.ne.2)
then
315 zxb(ig) = xzer(z(j+1),z(j),un(i+1,j+1),un(i+1,j))
317 elseif(un(i+1,j+1)*un(i,j+1).le.0. .AND. lin.ne.3)
then
323 rxb(ig) = xzer(r(i+1),r(i),un(i+1,j+1),un(i,j+1))
326 elseif(un(i,j+1)*un(i,j).le.0..AND. lin.ne.4)
then
333 zxb(ig) = xzer(z(j+1),z(j),un(i,j+1),un(i,j))
336 c------------------------
337 c --- control of finish
339 if( (jc.eq.jc1) .and. (ic.eq.ic1) )
then
349 c------------------------
352 c------------------------
355 c---------------------------------------------------------------
356 c
End of plasma boundary treatment
357 c---------------------------------------------------------------
358 c***************************************************************
362 un(i,j) = un(i,j) + delunb
368 c**********************************************************
376 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
378 fps(r_,r0,z_,z0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)=
379 * (ps_0-ps_x)+d_r*(r_-r0)+d_z*(z_-z0)+
380 * 0.5d0*d_rr*(r_-r0)**2+0.5d0*d_zz*(z_-z0)**2+d_rz*(z_-z0)*(r_-r0)
382 fprim_r(r_,r0,z_,z0,d_r,d_rr,d_rz)=d_r+d_rr*(r_-r0)+d_rz*(z_-z0)
388 c---definition of cell, containig s-point
392 if( (rt.lt.r(i+1)) .AND. (rt.ge.r(i)) ) go to 301
398 if( (zt.lt.z(j+1)) .AND. (zt.ge.z(j)) ) go to 311
402 c
write(*,*)
'icelt,jcelt',itx,jtx,rt,zt
404 c---define nearest node
412 dlx=dsqrt( (rr-rt)**2+(zz-zt)**2 )
413 if(dlx.lt.sdmin)
then
425 c
write(*,*)
'it,jt',it,jt
427 c
write(*,*) r(it),z(jt)
448 if(k.eq.0 .AND. l.eq.0 ) go to 410
481 rt = rrt - fps(rrt,r_0,zt,z_0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)/
482 * fprim_r(rrt,r_0,zt,z_0,d_r,d_rr,d_rz)
484 if(accr.lt.1.d-6)
exit
490 if(niter.lt.4) go to 444
503 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
505 fps(r_,r0,z_,z0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)=
506 * (ps_0-ps_x)+d_r*(r_-r0)+d_z*(z_-z0)+
507 * 0.5d0*d_rr*(r_-r0)**2+0.5d0*d_zz*(z_-z0)**2+d_rz*(z_-z0)*(r_-r0)
509 fprim_z(r_,r0,z_,z0,d_z,d_zz,d_rz)=d_z+d_zz*(z_-z0)+d_rz*(r_-r0)
515 c---definition of cell, containig s-point
519 if( (rt.lt.r(i+1)) .AND. (rt.ge.r(i)) ) go to 301
525 if( (zt.lt.z(j+1)) .AND. (zt.ge.z(j)) ) go to 311
529 c
write(*,*)
'icelt,jcelt',itx,jtx,rt,zt
531 c---define nearest node
533 sdmin=rmax-rmin+zmax-zmin
539 dlx=dsqrt( (rr-rt)**2+(zz-zt)**2 )
540 if(dlx.lt.sdmin)
then
552 c
write(*,*)
'it,jt',it,jt
554 c
write(*,*) r(it),z(jt)
575 if(k.eq.0 .AND. l.eq.0 ) go to 410
609 zt = zzt - fps(rt,r_0,zzt,z_0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)/
610 * fprim_z(rt,r_0,zzt,z_0,d_z,d_zz,d_rz)
612 if(accr.lt.1.d-6)
exit
617 if(niter.lt.4) go to 444
623 c**********************************************************
624 subroutine gap(ut,rt,zt,rg,zg)
631 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
633 fps(r_,r0,z_,z0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)=
634 * (ps_0-ps_x)+d_r*(r_-r0)+d_z*(z_-z0)+
635 * 0.5d0*d_rr*(r_-r0)**2+0.5d0*d_zz*(z_-z0)**2+d_rz*(z_-z0)*(r_-r0)
637 fprim_z(r_,r0,z_,z0,d_z,d_zz,d_rz)=d_z+d_zz*(z_-z0)+d_rz*(r_-r0)
639 fprim_r(r_,r0,z_,z0,d_r,d_rr,d_rz)=d_r+d_rr*(r_-r0)+d_rz*(z_-z0)
653 c---definition of cell, containig s-point
657 if( (rt.lt.r(i+1)) .AND. (rt.ge.r(i)) ) go to 301
663 if( (zt.lt.z(j+1)) .AND. (zt.ge.z(j)) ) go to 311
667 c
write(*,*)
'icelt,jcelt',itx,jtx,rt,zt
669 c---define nearest node
677 dlx=dsqrt( (rr-rt)**2+(zz-zt)**2 )
678 if(dlx.lt.sdmin)
then
686 c
write(*,*)
'it,jt',it,jt
688 c
write(*,*) r(it),z(jt)
709 if(k.eq.0 .AND. l.eq.0 ) go to 410
739 if(k_iter*n_iter.eq.1)
then
740 psi_cp=ps_0+d_r*(rg-r_0)+d_z*(zg-z_0)+0.5d0*d_rr*(rg-r_0)**2
741 & +0.5d0*d_zz*(zg-z_0)**2+d_rz*(rg-r_0)*(zg-z_0)
746 dpsidr=fprim_r(rt,r_0,zt,z_0,d_r,d_rr,d_rz)
747 dpsidz=fprim_z(rt,r_0,zt,z_0,d_z,d_zz,d_rz)
748 grad=dsqrt(dpsidr**2+dpsidz**2)
750 dpsi=-fps(rt,r_0,zt,z_0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)
754 rtp = rt + d_ro*dpsidr/grad
755 ztp = zt + d_ro*dpsidz/grad
757 accr=dabs(zt-ztp)+dabs(rt-rtp)
758 if(accr.lt.1.d-6)
exit
765 if(itx.eq.itx_old .AnD. jtx.eq.jtx_old) go to 555
766 if(n_iter.eq.5) go to 555
774 taur=-dpsidz/dsqrt(dpsidr**2+dpsidz**2)
775 tauz= dpsidr/dsqrt(dpsidr**2+dpsidz**2)
779 scal_pro=dgt_r*taur+dgt_z*tauz
783 rt=rt+scal_pro*taur*wght
784 zt=zt+scal_pro*tauz*wght
786 if(dabs(scal_pro).lt.1.d-6) go to 777
787 if(k_iter.eq.5) go to 777
806 include
'compol_add.inc'
808 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
810 fps(r_,r0,z_,z0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)=
811 * (ps_0-ps_x)+d_r*(r_-r0)+d_z*(z_-z0)+
812 * 0.5d0*d_rr*(r_-r0)**2+0.5d0*d_zz*(z_-z0)**2+d_rz*(z_-z0)*(r_-r0)
814 fprim_z(r_,r0,z_,z0,d_z,d_zz,d_rz)=d_z+d_zz*(z_-z0)+d_rz*(r_-r0)
816 fprim_r(r_,r0,z_,z0,d_r,d_rr,d_rz)=d_r+d_rr*(r_-r0)+d_rz*(z_-z0)
830 c---definition of cell, containig s-point
832 call
numcel(rt,zt,itx,jtx)
834 c
write(*,*)
'icelt,jcelt',itx,jtx,rt,zt
839 c---define nearest node
847 dlx=dsqrt( (rr-rt)**2+(zz-zt)**2 )
848 if(dlx.lt.sdmin)
then
879 if(k.eq.0 .AND. l.eq.0 ) go to 410
909 if(k_iter*n_iter.eq.1)
then
910 psi_cp=ps_0+d_r*(rg-r_0)+d_z*(zg-z_0)+0.5d0*d_rr*(rg-r_0)**2
911 & +0.5d0*d_zz*(zg-z_0)**2+d_rz*(rg-r_0)*(zg-z_0)
916 dpsidr=fprim_r(rt,r_0,zt,z_0,d_r,d_rr,d_rz)
917 dpsidz=fprim_z(rt,r_0,zt,z_0,d_z,d_zz,d_rz)
918 grad=dsqrt(dpsidr**2+dpsidz**2)
920 dpsi=-fps(rt,r_0,zt,z_0,d_r,d_z,d_rr,d_zz,d_rz,ps_0,ps_x)
924 rtp = rt + d_ro*dpsidr/grad
925 ztp = zt + d_ro*dpsidz/grad
927 accr=dabs(zt-ztp)+dabs(rt-rtp)
928 if(accr.lt.1.d-6)
exit
935 if(itx.eq.itx_old .AnD. jtx.eq.jtx_old) go to 555
936 if(n_iter.eq.5) go to 555
944 taur=-dpsidz/dsqrt(dpsidr**2+dpsidz**2)
945 tauz= dpsidr/dsqrt(dpsidr**2+dpsidz**2)
949 scal_pro=dgt_r*taur+dgt_z*tauz
953 rt=rt+scal_pro*taur*wght
954 zt=zt+scal_pro*tauz*wght
956 if(dabs(scal_pro).lt.1.d-6) go to 777
957 if(k_iter.eq.5) go to 777
972 parameter(ntet=66,npsi=33)
977 common/comlop/ rxb(nbndp2),zxb(nbndp2),nxb
978 real*8 teta0(nbndp2),tet(ntet),rpol(ntet),zpol(ntet)
979 real*8 psipol(npsi),pppol(npsi),fppol(npsi)
989 rbmax=dmax1(rxb(i),rbmax)
990 rbmin=dmin1(rxb(i),rbmin)
992 zbmax=dmax1(zxb(i),zbmax)
993 zbmin=dmin1(zxb(i),zbmin)
997 rcen=0.5*(rbmax+rbmin)
998 zcen=0.5*(zbmax+zbmin)
1006 if(drx.lt.0) tetp=tetp+pi
1007 if(tetp.lt.0) tetp=tetp+2.*pi
1010 ccc
write(6,*)
'teta0(i) i',teta0(i),i
1015 dtet=2.*pi/(ntet-2.)
1018 tet(i)=tet(i-1)+dtet
1028 ccc
write(6,*)
'tetp j',tetp,j
1035 if(tetx1.gt.tetx2)
then
1038 elseif(tetp.lt.pi)
then
1042 c
write(6,*)
'tetp tetx1 tetx2'
1043 c
write(6,*) tetp,tetx1,tetx2
1045 if(tetp.gt.tetx1 .AND. tetp.le.tetx2)
then
1047 ccc
write(6,*)
'tetp tetx1 tetx2'
1048 ccc
write(6,*) tetp,tetx1,tetx2
1050 rpol(j)=( (tetp-tetx1)*rxb(i)+(tetx2-tetp)*rxb(i-1) )/
1053 zpol(j)=((tetp-tetx1)*zxb(i)+(tetx2-tetp)*zxb(i-1))/
1067 psipol(i)=1.-(i-1)/(npsi-1.)
1069 pppol(i)=cnor*funpp(psipol(i))
1070 fppol(i)=cnor*funfp(psipol(i))
1074 write(fname,
'(a,a)') path(1:kname),
'adpol.dat'
1075 open(1,file=fname,form=
'formatted')
1078 write(1,*) npsi,ntet,rm,zm,rcen,zcen
1080 write(1,*) (rpol(i),i=1,ntet)
1081 write(1,*) (zpol(i),i=1,ntet)
1083 write(1,*) (psipol(i),i=1,npsi)
1084 write(1,*) (pppol(i),i=1,npsi)
1085 write(1,*) (fppol(i),i=1,npsi)
1095 include
'double.inc'
1097 include
'comblc.inc'
1098 common/combrz/ bmr(nip,njp),bmz(nip,njp)
1103 bmr(i,j)=(u(i,j+1)-u(i,j))/dz(j)/r(i)
1110 bmz(i,j)=(u(i+1,j)-u(i,j))/dr(i)/r12(i)
1116 c***************************************************************
1120 include
'double.inc'
1122 include
'comblc.inc'
1129 if(iprr.ne.1) go to 310
1132 pintg=pintg+zpres*dri(i)*dzj(j)
1135 betpol=8.d0*pi*pintg/(tok*tok)
1136 betpol=betpol*(um-up)*cnor/amu0**2
1143 include
'double.inc'
1145 include
'comblc.inc'
1146 common/equili/ bettot, rmx, zzrmx, rmn, zzrmn,
1147 * zmx, rrzmx, zmn, rrzmn,
1148 * r0cen, z0cen, radm, aspect,
1149 * eupper, elower, delup, dellw, bfvakc,
1159 if(iprr.ne.1) go to 310
1162 pintg=pintg+zpres*dri(i)*dzj(j)*r(i)
1163 volpl=volpl+ dri(i)*dzj(j)*r(i)
1167 paverg = pintg*(um-up)*cnor/volpl
1169 b0_cen=b0ax*r0ax/r0cen
1171 bettor=2.d0*paverg/(b0_cen*b0_cen)
1173 tok_nor=tok/(radm*b0_cen)
1175 bet_nor=bettor/tok_nor*100.d0
1179 c***************************************************************
1181 SUBROUTINE arcle ( NBAS, RBAS, ZBAS, ARC, ARCMAX )
1183 include
'double.inc'
1185 dimension rbas(*), zbas(*), arc(*)
1191 ds = sqrt( ( rbas(i) - rbas(i-1) )**2 +
1192 * ( zbas(i) - zbas(i-1) )**2 )
1193 1 arc(i) = arc(i-1) + ds
1196 2 arc(i) = arc(i) / arcmax
1200 c******************************************************************
1201 c-----------------------------------------------------------------------
1203 SUBROUTINE tcontr(KAS,A,JA,IA,NN,Z,B,IPRT,IGRF,BZ,ERR)
1205 IMPLICIT REAL*8(a-h,o-z)
1208 dimension a(*),ja(*),ia(*),z(*),b(*),bz(*)
1209 c iprt=0, igrf=0 --- poptpeta het
1218 CALL
sarvec(a,ja,ia,nn,z,b)
1222 CALL
rarvec(a,ja,ia,nn,z,b)
1227 errlx=abs(b(lx)-bz(lx))
1228 IF(err.LT.errlx) err=errlx
1238 c
WRITE(nout,102)(z(k),k=1,nn)
1242 c
WRITE(nout,102)(bz(k),k=1,nn)
1246 c
WRITE(nout,102)(b(k),k=1,nn)
1249 c+++ CALL
aprt(nn,a,ia,ja)
1259 c+++ CALL
agrf(nn,ia,ja)
1263 299
FORMAT(/5x,
'PRINT - TCONTR',2x,
'ERROR=',e12.5)
1264 404
FORMAT(/5x,
'Z - AFTER *DRV')
1265 405
FORMAT(/5x,
'B - BEFORE *DRV')
1266 406
FORMAT(/5x,
'B - AFTER R(S)ARVEC')
1269 314
FORMAT(2x,
'* * * * * * * * * * * * * * * * * * * * * * * * * *')
1274 c****************************
1278 IMPLICIT REAL*8(a-h,o-z)
1279 dimension a(1),ja(1),ia(1),x(1),y(1)
1285 y(i)=y(i)+a(j)*x(ja(j))
1290 c****************************
1293 c****************************
1295 IMPLICIT REAL*8(a-h,o-z)
1296 dimension a(1),ja(1),ia(1),x(1),y(1)
1306 IF(ja(k1).EQ.i)
THEN
1307 y(i)=y(i)+a(k1)*x(i)
1314 y(i)=y(i)+a(j)*x(ja(j))
1316 y(ja(j))=y(ja(j))+a(j)*x(i)
1324 c****************************
1328 IMPLICIT REAL*8(a-h,o-z)
1329 dimension a(1),ia(1),ja(1)
1350 100
FORMAT(/5x,
'IA(',i7,
')=',i10)
1353 104
FORMAT(/5x,
'ASUM=',e12.5)
1354 102
FORMAT(2x,
'* * * * * * * * * * * * * * * * * * * * * * * * * *')
1359 c*****************************
1362 INTEGER n, ia(1), ja(1)
1363 CHARACTER*1 star , blanc , string(132)
1364 DATA star/
'*'/, blanc/
' '/
1371 DO 2 j=ia(i),ia(i+1)-1
1372 2 string(ja(j))=star
1377 c**********************************************************
1380 include
'double.inc'
1382 include
'comblc.inc'
1384 common/comlop/ rxb(nbndp2), zxb(nbndp2), nxb
1385 common/nostep/ kstep1
1388 c---------------------------------------------------------------
1390 c++++ keywri = mod( kstep1 , 2 )
1393 c---------------------------------------------------------------
1395 c
if( keywri .eq. 0 )
then
1397 write(fname,
'(a,a)') path(1:kname),
'out.wr'
1398 open(1,file=fname,form=
'formatted')
1401 write(1,*) ni,nj,ni1,nj1,ni2,nj2,nxb
1403 write(1,*) (r(i),i=1,ni)
1404 write(1,*) (z(j),j=1,nj)
1405 write(1,*) ((u(i,j),i=1,ni),j=1,nj)
1406 write(1,*) ((curf(i,j),i=1,ni),j=1,nj)
1407 write(1,*) ((ipr(i,j),i=1,ni),j=1,nj)
1408 write(1,*) rm,zm,um,rx0,zx0,ux0,up
1409 write(1,*) (rxb(ig),ig=1,nxb)
1410 write(1,*) (zxb(ig),ig=1,nxb)
1412 write(1,*) ((ui(i,j),i=1,ni),j=1,nj)
1413 write(1,*) ((ue(i,j),i=1,ni),j=1,nj)
1414 write(1,*) ((un(i,j),i=1,ni),j=1,nj)
1417 write(fname,
'(a,a)') path(1:kname),
'recbon.wr'
1418 open(1,file=fname,form=
'formatted')
1422 write(1,*) rxb(ig),zxb(ig)
1430 c
open(1,file=
'out1.wr')
1432 c
write(1,*) ni,nj,ni1,nj1,ni2,nj2,nxb
1434 c
write(1,*) (r(i),i=1,ni)
1435 c
write(1,*) (z(j),j=1,nj)
1436 c
write(1,*) ((u(i,j),i=1,ni),j=1,nj)
1437 c
write(1,*) ((curf(i,j),i=1,ni),j=1,nj)
1438 c
write(1,*) ((ipr(i,j),i=1,ni),j=1,nj)
1439 c
write(1,*) rm,zm,um,rx0,zx0,ux0,up
1440 c
write(1,*) (rxb(ig),ig=1,nxb)
1441 c
write(1,*) (zxb(ig),ig=1,nxb)
1443 c
write(1,*) ((ui(i,j),i=1,ni),j=1,nj)
1444 c
write(1,*) ((ue(i,j),i=1,ni),j=1,nj)
1445 c
write(1,*) ((un(i,j),i=1,ni),j=1,nj)
1449 c---------------------------------------------------------------
1455 include
'double.inc'
1457 include
'comblc.inc'
1459 write(fname,
'(a,a)') path(1:kname),
'rect.wr'
1460 open(1,file=fname,form=
'formatted')
1463 write(1,*) ni,nj,ni1,nj1,ni2,nj2,imax,jmax
1465 write(1,*) (r(i),i=1,ni)
1466 write(1,*) (z(j),j=1,nj)
1467 write(1,*) ((u(i,j),i=1,ni),j=1,nj)
1468 write(1,*) ((ue(i,j),i=1,ni),j=1,nj)
1469 write(1,*) ((un(i,j),i=1,ni),j=1,nj)
1470 write(1,*) ((ipr(i,j),i=1,ni),j=1,nj)
1471 write(1,*) rm,zm,um,rx0,zx0,ux0,up,qcen,b0ax,r0ax
1472 write(1,*) rx1,zx1,rx2,zx2
1473 write(1,*) rmax,zmax,rmin,zmin
1482 include
'double.inc'
1484 include
'comblc.inc'
1486 common/comlop/ rxb(nbndp2), zxb(nbndp2), nxb
1487 common/nostep/ kstep1
1488 character*40 str,dummy
1490 write(fname,
'(a,a)') path(1:kname),
'nw.wr'
1491 open(1,file=fname,form=
'formatted')
1496 if(numwr.lt.10)
then
1497 write(str,
'(a,a,i1,a)') path(1:kname),
'file',numwr,
'.wr'
1499 if(numwr.lt.100)
then
1500 write(str,
'(a,a,i2,a)') path(1:kname),
'file',numwr,
'.wr'
1502 write(str,
'(a,a,i3,a)') path(1:kname),
'file',numwr,
'.wr'
1506 open(1,file=str,form=
'formatted')
1508 write(1,*) ni,nj,ni1,nj1,ni2,nj2,nxb
1511 write(1,*) (r(i),i=1,ni)
1512 write(1,*) (z(j),j=1,nj)
1513 write(1,*) ((u(i,j),i=1,ni),j=1,nj)
1514 write(1,*) ((curf(i,j),i=1,ni),j=1,nj)
1515 write(1,*) ((ipr(i,j),i=1,ni),j=1,nj)
1516 write(1,*) rm,zm,um,rx0,zx0,ux0,up
1517 write(1,*) (rxb(ig),ig=1,nxb)
1518 write(1,*) (zxb(ig),ig=1,nxb)
1525 write(fname,
'(a,a)') path(1:kname),
'flist.wr'
1526 open(1,file=fname,form=
'formatted')
1538 c---------------------------------------------------------------
1541 c***************************************************************
1543 c***************************************************************
1546 include
'double.inc'
1548 include
'comblc.inc'
1550 common/comlop/ rxb(nbndp2),zxb(nbndp2),nxb
1552 write(fname,
'(a,a)') path(1:kname),
'out.wr'
1553 open(1,file=fname,form=
'formatted')
1555 c
open(1,file=
'out.wr',status=
'old',form=
'formatted')
1557 read(1,*) ni,nj,ni1,nj1,ni2,nj2,nxb
1559 read(1,*) (r(i),i=1,ni)
1560 read(1,*) (z(j),j=1,nj)
1561 read(1,*) ((u(i,j),i=1,ni),j=1,nj)
1562 read(1,*) ((curf(i,j),i=1,ni),j=1,nj)
1563 read(1,*) ((ipr(i,j),i=1,ni),j=1,nj)
1564 read(1,*) rm,zm,um,rx0,zx0,ux0,up
1565 read(1,*) (rxb(ig),ig=1,nxb)
1566 read(1,*) (zxb(ig),ig=1,nxb)
1568 read(1,*) ((ui(i,j),i=1,ni),j=1,nj)
1569 read(1,*) ((ue(i,j),i=1,ni),j=1,nj)
1570 read(1,*) ((un(i,j),i=1,ni),j=1,nj)
1575 c**********************************************************
1578 include
'double.inc'
1580 include
'comblc.inc'
1582 write(fname,
'(a,a)') path(1:kname),
'bnd.wr'
1583 open(1,file=fname,form=
'formatted')
1586 write(1,*) ((binadg(i,j),i=1,nbnd),j=1,nbnd)
1592 c**********************************************************
1595 include
'double.inc'
1597 include
'comblc.inc'
1600 write(fname,
'(a,a)') path(1:kname),
'bndin.wr'
1601 open(1,file=fname,form=
'formatted')
1604 write(1,*) nkin,nkout
1605 write(1,*) ((pinadg(ik,j),ik=1,nkout),j=1,nbnd)
1606 write(1,*) (itok(ik),ik=1,nk)
1607 write(1,*) (jtok(ik),ik=1,nk)
1611 c
write(6,*)
' nkin,nkout',nkin,nkout
1613 c
write(6,*) (itok(ik),ik=1,nk)
1614 c
write(6,*) (jtok(ik),ik=1,nk)
1618 c***************************************************************
1621 include
'double.inc'
1623 include
'comblc.inc'
1625 write(fname,
'(a,a)') path(1:kname),
'bnd.wr'
1626 open(1,file=fname,form=
'formatted')
1629 read(1,*) ((binadg(i,j),i=1,nbnd),j=1,nbnd)
1636 c**********************************************************
1637 c***************************************************************
1640 include
'double.inc'
1642 include
'comblc.inc'
1645 write(fname,
'(a,a)') path(1:kname),
'bndin.wr'
1646 open(1,file=fname,form=
'formatted')
1649 read(1,*) nkin,nkout
1650 read(1,*) ((pinadg(ik,j),ik=1,nkout),j=1,nbnd)
1651 read(1,*) (itok(ik),ik=1,nk)
1652 read(1,*) (jtok(ik),ik=1,nk)
1656 c
write(6,*)
' nkin,nkout',nkin,nkout
1658 c
write(6,*) (itok(ik),ik=1,nk)
1659 c
write(6,*) (jtok(ik),ik=1,nk)
1667 include
'double.inc'
1669 include
'comblc.inc'
1671 parameter(np=1000,nbp=np*4)
1674 dimension rbbbs(nbp),zbbbs(nbp)
1676 common/efites/ fcefit,rcentr,iefit
1678 common/com_eqd/ fpol(np),pres(np),qpsi(np),
1679 * ffprim(np),pprime(np),
1680 * rlimtr(np),zlimtr(np),
case,simag,sibry,
1683 common/comlop/ rxb(nbndp2), zxb(nbndp2), nxb
1687 c--------------------------------------------------------------------
1689 write(*,*)
'************************* '
1690 write(*,*)
' Entry of subr."eqdsk_rebild":'
1691 write(*,*)
'------------------------- '
1694 if(ni.ne.nw .or. nj.ne.nh)
then
1696 write(*,*) .ne..or..ne.
' error:ninw njnh '
1697 write(*,*)
'nw,nh',nw,nh
1698 write(*,*)
'ni,nj',ni,nj
1706 zmid = (zmax+zmin)*0.5d0
1720 correc=(um-up)/(simag-sibry)
1724 pres(i)=(pres(i)-pres_bon)*correc + pres_bon
1730 fpol(i)= dsqrt( (fpol(i)**2-f2_bon)*correc + f2_bon )
1734 call
get q_spline(qpsi,nw)
1736 open(1,file=
'eqdsk_rebild.wr')
1738 write(1,2000) (
case(i),i=1,6),idum,nw,nh
1739 write(*,*) idum,nw,nh
1741 write(1,2020) rdim,zdim,rcentr,rleft,zmid
1742 write(1,2020) rmaxis,zmaxis,um,up,bcentr
1743 write(1,2020)
current,um,xdum,rmaxis,xdum
1744 write(1,2020) zmaxis,xdum,up,xdum,xdum
1745 write(1,2020) (fpol(i),i=1,nw)
1746 write(1,2020) (pres(i),i=1,nw)
1747 write(1,2020) (ffprim(i),i=1,nw)
1748 write(1,2020) (pprime(i),i=1,nw)
1749 write(1,2020) ((u(i,j),i=1,ni),j=1,nj)
1750 write(1,2020) (qpsi(i),i=1,nw)
1751 write(1,2022) nxb,limitr
1752 write(1,2020) (rxb(i),zxb(i),i=1,nxb)
1753 write(1,2020) (rlimtr(i),zlimtr(i),i=1,limitr)
1757 2000
format(6a8,3i4)
1770 include
'double.inc'
1772 include
'comblc.inc'
1774 parameter(np=1000,nbp=np*4)
1777 dimension rbbbs(nbp),zbbbs(nbp)
1780 common/efites/ fcefit,rcentr,iefit
1782 common/com_eqd/ fpol(np),pres(np),qpsi(np),
1783 * ffprim(np),pprime(np),
1784 * rlimtr(np),zlimtr(np),
case,simag,sibry,
1787 common/comlop/ rxb(nbndp2), zxb(nbndp2), nxb
1790 c--------------------------------------------------------------------
1792 write(*,*)
'************************* '
1793 write(*,*)
' Entry of subr."eqdsk_build":'
1794 write(*,*)
'------------------------- '
1807 zmid = (zmax+zmin)*0.5d0
1822 ps(i)= dfloat(i-1)/dfloat(nw-1)
1823 pprime(i)=tabp(1.d0-ps(i))*1.d6/amu0
1824 ffprim(i)=tabf(1.d0-ps(i))
1830 dpsi=(um-up)/dfloat(nw-1)
1833 pprim_c = 0.5d0*(pprime(i+1)+pprime(i))
1834 fprim_c = 0.5d0*(ffprim(i+1)+ffprim(i))
1835 pres(i)=pres(i+1) + pprim_c*dpsi
1836 fpol(i)=dsqrt(fpol(i+1)**2 + 2.d0*fprim_c*dpsi)
1841 write(fname,
'(a,a40)') path(1:kname),eqdfn
1842 open(1,file=fname,form=
'formatted')
1845 write(1,2000) (
case(i),i=1,6),idum,nw,nh
1846 write(*,*) idum,nw,nh
1848 write(1,2020) rdim,zdim,rcentr,rleft,zmid
1849 write(1,2020) rmaxis,zmaxis,um,up,bcentr
1850 write(1,2020)
current,up,xdum,rmaxis,xdum
1851 write(1,2020) zmaxis,xdum,up,xdum,xdum
1852 write(1,2020) (fpol(i),i=1,nw)
1853 write(1,2020) (pres(i),i=1,nw)
1854 write(1,2020) (ffprim(i),i=1,nw)
1855 write(1,2020) (pprime(i),i=1,nw)
1856 write(1,2020) ((u(i,j),i=1,ni),j=1,nj)
1857 write(1,2020) (0.5d0*qpsi(i)/pi,i=1,nw)
1858 write(1,2022) nxb,nblm
1859 write(1,2020) (rxb(i),zxb(i),i=1,nxb)
1860 write(1,2020) (rblm(i),zblm(i),i=1,nblm)
1864 2000
format(6a8,3i4)
1872 subroutine get q_spline(qpsi,nw)
1874 include
'double.inc'
1876 parameter(nspz=nrp+1,nsp4=nspz+4,nsp6=nsp4*6)
1877 include
'compol.inc'
1881 real*8 qw(nspz),psiw(nspz)
1882 real*8 rrk(nsp4),cck(nsp4),wrk(nsp6)
1889 xa1=0.5d0*(psia(1)+psia(2))
1890 xa2=0.5d0*(psia(2)+psia(3))
1891 xa3=0.5d0*(psia(3)+psia(4))
1897 call
extrp2(xa0,qx0, xa1,xa2,xa3, qx1,qx2,qx3)
1900 xa1=0.5d0*(psia(iplas-1)+psia(iplas))
1901 xa2=0.5d0*(psia(iplas-2)+psia(iplas-1))
1902 xa3=0.5d0*(psia(iplas-3)+psia(iplas-2))
1908 call
extrp2(xan,qxn, xa1,xa2,xa3, qx1,qx2,qx3)
1914 psiw(i)=1.d0-0.5d0*(psia(i-1)+psia(i))
1921 CALL
e01baf(nspl,psiw,qw,rrk,cck,
1922 * nspl+4,wrk,6*nspl+16,ifail)
1924 qpsi(1)=qw(1)/(2.d0*pi)
1926 zxx=dfloat((i-1))/dfloat((nw-1))
1927 CALL
e02bcf(nspl+4,rrk,cck,zxx,0,cwk,ifail)
1928 qpsi(i)=cwk(1)/(2.d0*pi)
1930 qpsi(nw)=qw(iplas+1)/(2.d0*pi)
subroutine arcle(NBAS, RBAS, ZBAS, ARC, ARCMAX)
subroutine e02bcf(NCAP7, K, C, X, LEFT, S, IFAIL)
subroutine drv(ZIX1, ZIY1, ZIX2, ZIY2)
subroutine output(NGRID, betpol, zli3)
subroutine numcel(rrk, zzk, icell, jcell)
subroutine e01baf(M, X, Y, K, C, LCK, WRK, LWRK, IFAIL)
subroutine gap(ut, rt, zt, rg, zg)
subroutine extrp2(X, F, X1, X2, X3, F1, F2, F3)
subroutine deriv5(X, Y, F, M, N, U)
subroutine rpoint(ut, rt, zt, dp)
subroutine agrf(N, IA, JA)
subroutine aprt(N, A, IA, JA)
subroutine f_gap(ut, rt, zt, rg, zg)
subroutine current(GEOMETRY, PROFILES, TRANSPORT, SOURCES, EVOLUTION, CONTROL, j_boun, ifail, failstring)
CURRENT TRANSPORT EQUATION.
subroutine wrdfmv(numwr, time)
subroutine sarvec(A, JA, IA, N, X, Y)
subroutine zpoint(ut, rt, zt, dp)
subroutine eqdsk_build(eqdfn)
subroutine rarvec(A, JA, IA, N, X, Y)
subroutine tcontr(KAS, A, JA, IA, NN, Z, B, IPRT, IGRF, BZ, ERR)
subroutine inter_q(ps, nw, q_ps)