13 dimension h_fi(nrp),fia(nrp)
18 psia(i)=(iplas-i)/(iplas-1.d0)
28 psia(i)=1.d0-((i-1)/(iplas-1.d0))**2
32 dpsda(i)=(1-2*i)/(iplas-1.d0)
40 znam=q(i-1)*(iplas-1)**2
41 psia(i)=psia(i-1)+(2*i-3)/znam
50 psia(i)=1.d0-psia(i)/psnor
54 dpsda(i)=-(2*i-1)/( (iplas-1.d0)*q(i)*psnor )
63 if( i.lt.iplas/2 )
then
65 elseif( i.ge.iplas/2 )
then
66 h_fi(i)=h_fi(i-1)*zn_gp
68 fia(i+1)=fia(i)+h_fi(i)
69 psia(i+1)=psia(i)+(fia(i+1)**2-fia(i)**2)/q(i)
75 psia(i)=1.d0-psia(i)/psnor
86 subroutine axdef(rma,zma,psima,dpm)
95 dimension xs(nshp),ys(nshp),
fun(nshp),dpm(*)
118 det = dpm(3)*dpm(5) - dpm(4)**2
120 rma = xs(1) + ( dpm(2)*dpm(4) - dpm(1)*dpm(5) )/det
121 zma = ys(1) + ( dpm(1)*dpm(4) - dpm(2)*dpm(3) )/det
123 erroma=dsqrt((rma-rm0)**2+(zma-zm0)**2)
124 erroma=erroma/(dabs(r(2,2)-rm0))
126 psima=
fun(1)+ dpm(1)*(rma-rm0) + dpm(2)*(zma-zm0)
127 + + 0.5d0*dpm(3)*(rma-rm0)*(rma-rm0)
128 + + dpm(4)*(rma-rm0)*(zma-zm0)
129 + + 0.5d0*dpm(5)*(zma-zm0)*(zma-zm0)
137 implicit real*8(a-h,o-z)
140 real*8 arr2(nro,nteta)
142 real(8),
allocatable :: arrw(:)
143 allocate( arrw(nteta) )
158 implicit real*8(a-h,o-z)
161 real*8 arr2(nro,nteta)
163 real(8),
allocatable :: arrw(:)
164 allocate( arrw(nteta) )
178 implicit real*8(a-h,o-z)
186 avrg=avrg+arr1_c(j)*vol(i,j)
187 sum_vol=sum_vol+vol(i,j)
196 implicit real*8(a-h,o-z)
206 volk=vol1(i,j)+vol4(i,j-1)
207 elseif(i.eq.iplas)
then
208 volk=vol2(i-1,j)+vol3(i-1,j-1)
210 volk=vol1(i,j)+vol2(i-1,j)+vol3(i-1,j-1)+vol4(i,j-1)
212 avrg=avrg+arr1_k(j)*volk
222 implicit real*8(a-h,o-z)
231 avrg=avrg+0.5d0*(arr(j+1)+arr(j))*dlt(iplas,j)
232 sum_len=sum_len+dlt(iplas,j)
248 common/com_bgr/ bin_adg(ntp,ntp),dg_dn(ntp)
264 call
bint(rr,zz, r0,z0,r1,z1, fint,1)
281 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
282 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
284 common/com_bgr/ bin_adg(ntp,ntp),dg_dn(ntp)
285 dimension pspl_b(ntp),aj(ntp),bj(ntp),dj(ntp)
286 dimension aj_g(ntp),bj_g(ntp),dj_g(ntp)
293 a2=a34(i-1,j-1)+a12(i-1,j)
296 g1=psi(i-1,j-1)-psi(i,j-1)
297 g2=psi(i-1,j)-psi(i,j)
298 g3=psi(i-1,j+1)-psi(i,j+1)
300 sqk=sq2(i-1,j)+sq3(i-1,j-1)
301 dltk=(dlt(i,j-1)+dlt(i,j))*0.5d0
302 dgdnl=-(a1*g1+a2*g2+a3*g3)+ cur(i,j)*sqk
304 aj(j)=-(a1+a2+a3)/dltk
305 r0=(3.d0*r(i,j)+r(i-1,j))*0.25d0
330 psb=psb+bin_adg(jb,l)*(dg_dn(jb)+dg_dn(jb+1))*0.5d0
331 ajg=ajg+bin_adg(jb,l)*(aj(jb)+aj(jb+1))*0.5d0
332 bjg=bjg+bin_adg(jb,l)*(bj(jb)+bj(jb+1))*0.5d0
333 djg=djg+bin_adg(jb,l)*(dj(jb)+dj(jb+1))*0.5d0
352 sum_len=sum_len+dlt(iplas,j)
358 avrg=avrg+0.5d0*(aj_g(j+1)+aj_g(j))*dlt(iplas,j)
366 avrg=avrg+0.5d0*(bj_g(j+1)+bj_g(j))*dlt(iplas,j)
374 avrg=avrg+0.5d0*(dj_g(j+1)+dj_g(j))*dlt(iplas,j)
406 s_flux_fi=s_flux_fi-q(i)*(psia(i+1)-psia(i))*psim
413 subroutine metcof(alp22,alp33,delsc,delv,ac0,skcen,cur_I,
414 * alp33k,delsk,delvk)
420 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
421 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
423 common/compsf/ psf(nrp),sqtor(nrp)
425 dimension alp22(nrp),alp33(nrp),delsc(nrp),delv(nrp)
426 dimension alp33k(nrp),delvk(nrp),delsk(nrp)
427 dimension cur_i(nrp),curj_i(nrp),deviat(nrp)
443 r0=(r1+
r2+r3+r4)*0.25d0
447 zavrc=zavrc+s(i,j)/r0
451 alp33(i)=zdelsc/zavrc
460 sqtor(i)=sqtor(i-1)+delsc(i-1)
472 sqk=sq1(i,j)+sq2(i-1,j)+sq3(i-1,j-1)+sq4(i,j-1)
475 sqk=sq2(i-1,j)+sq3(i-1,j-1)
476 r0=(3.d0*r(i,j)+r(i-1,j))*0.25d0
485 alp33k(i)=zdelsk/zavrk
501 a2=a34(i-1,j-1)+a12(i-1,j)
503 a4=a23(i-1,j-1)+a14(i,j-1)
504 a6=a14(i,j)+a23(i-1,j)
506 a8=a34(i,j-1)+a12(i,j)
508 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
520 alp22(i-1)=samn*delsc(i-1)
521 if(i.eq.iplas1) alp22(i)=sapl*delsc(i)
525 dpsids=psipla*(psia(i+1)-psia(i))/delsc(i)
526 cur_i(i)=dpsids*alp22(i)
538 acj=a12(1,j)+a24(1,j)+a34(1,j-1)+a13(1,j-1)
541 skcen=skcen+sq1(1,j)+sq4(1,j-1)
550 curj_i(1)=cur(1,2)*skcen
551 deviat(1)=cur_i(1)-curj_i(1)
557 sqk=sq1(i,j)+sq2(i-1,j)+sq3(i-1,j-1)+sq4(i,j-1)
559 sqk=sq2(i-1,j)+sq3(i-1,j-1)
561 dcurj_i=dcurj_i+cur(i,j)*sqk
563 curj_i(i)=curj_i(i-1)+dcurj_i
564 dcur_i=cur_i(i)-cur_i(i-1)
565 deviat(i)=(dcur_i-dcurj_i)/delsk(i)
568 diff=(alp22(iplas-1)-alp22(iplas-2))/delsk(iplas-1)
569 alp22(iplas)=alp22(iplas-1)+0.5d0*diff*delsk(iplas)
580 parameter(nshp=ntp+1)
583 common/efites/ fcefit,rc_efit,iefit
584 dimension xs(nshp),ys(nshp),
fun(nshp),dp(5)
609 tg2a=2.d0*drz/(drr-dzz)
610 cos2a=1.d0/sqrt(1.d0+tg2a**2)
613 dxx=0.5d0*(drr+dzz)+0.5d0*cos2a*(drr-dzz)+sin2a*drz
614 dyy=0.5d0*(drr+dzz)+0.5d0*cos2a*(dzz-drr)-sin2a*drz
615 c
write(6,*)
'drr,dzz,drz',drr,dzz,drz
616 c
write(6,*)
'dxx,dyy',dxx,dyy
620 c
write(6,*)
'qst:b0,r0',b0ax,rc0
621 if(iefit.eq.1) r0ax=rc_efit
626 c
write(6,*)
'qst:fvac',fvac
628 dpsi=(psia(iplas)-psia(iplas-1))
632 f(iplas-1)=sqrt(fvac**2-ffp*(psim-psip)*dpsi)
635 do 200 i=iplas-2,1,-1
636 dpsi=0.5d0*(psia(i+2)-psia(i))*(psim-psip)
638 f(i)=sqrt(f(i+1)**2-2.d0*ffp*dpsi)
660 r0=(r1+
r2+r3+r4)*0.25d0
661 dflufi=dflufi+s(i,j)*f(i)/r0
666 dflufi=dflufi+(sq3(i-1,j-1)+sq2(i-1,j))*f(i)/r0
674 q2pi=-dflufi/((psia(i+1)-psia(i))*(psim-psip))
676 flx_fi(i+1)=flx_fi(i)+dflufi
680 q2pi=-2.d0*dflufi/((psia(i)-psia(i-1))*(psim-psip))
690 q(iplas)=1.5d0*q(iplas-1)-0.5d0*q(iplas-2)
699 SUBROUTINE extrpc(X,F, X0,X1,X2,X3, F1,F2,F3)
701 IMPLICIT REAL*8(a-h,o-z)
708 d1f2m =(f2-f1)/(x2m-x1m)
709 d1f3m =(f3-f2)/(x3m-x2m)
711 d2f23 = (d1f3m-d1f2m)/(x3m-x1m)
713 f = f1+(x-x1m)*(d1f2m + (x-x2m)*d2f23)
719 SUBROUTINE extrp2(X,F, X1,X2,X3, F1,F2,F3)
721 IMPLICIT REAL*8(a-h,o-z)
725 d2fdx=( (f3-f2)/(x3-x2) - (f2-f1)/(x2-x1) )/(x3-x1)
727 f= f2+(x-x2)*( dfdx + d2fdx*(x-x2) )
738 f=f0+( fp-fm + ( (fp-f0)/(xp-x0)-(f0-fm)/(x0-xm) )*(x-x0) )
756 sqcen = sqcen + sq1(1,j) + sq4(1,j)
768 sqk=sq1(i,j)+sq2(i-1,j)+sq3(i-1,j-1)+sq4(i,j-1)
769 pintg=pintg+zpres*sqk
774 betpol=8.d0*pi*pintg/(tokp*tokp)
775 betpol=betpol*(psim-psip)*cnor/amu0**2
791 zcoin = betplx / betpol
793 zcoin = (1.d0/zcoin-1.d0)*tok/(cnor*tokff)+1.d0
795 coin = (coin-1.d0)*0.33d0+1.d0
805 call taburs(1,coin,nurs)
818 common/savt0/ psi0(nrp),fi0(nrp),f0(nrp),ri0(nrp),q0(nrp),
819 * dpsidt(nrp),dfidt(nrp),rm0,ac0n,skcen0
820 common/com_flag/kastr
821 common /com_jb/ bj_av(nrp),curfi_av(nrp)
822 common /com_b2/ b2_av(nrp)
823 common /com_eb/ eb(nrp),eb_c(nrp),epar_c(nrp)
824 common/com_heat_dj/ wdj(nrp)
826 dimension alfa22(nrp),alfa33(nrp),ds(nrp),dv(nrp),cj(nrp),
827 * alp33k(nrp),dsk(nrp),dvk(nrp)
829 dimension z_nvzk(nrp)
832 bfjf(1)=cur(1,2)*f(1)/rm
839 volk=vol1(i,j)+vol2(i-1,j)+vol3(i-1,j-1)+vol4(i,j-1)
841 bj_i=bj_i+cur(i,j)*(f(i)+f(i-1))*0.5d0*volk/r(i,j)
847 call
metcof(alfa22,alfa33,ds,dv,ac0,skcen,cj,
852 b2_av(1)=(f(1)/rm)**2
855 bj_av(i)=(cj(i)*f(i-1)-cj(i-1)*f(i))/dvk(i)
856 curfi_av(i)=(cj(i)-cj(i-1))/dsk(i)
859 b2_av(i)=( f(i)*(flx_fi(i+1)-flx_fi(i))-
860 & cj(i)*psim*(psia(i+1)-psia(i)) )/dv(i)
863 b2_av(1)=(f(1)/rm)**2
870 b2_av(i)=(3.d0*b2_av(i-1) - b2_av(i-2))/2.0d0
872 b2_av_m=(3.d0*b2_av(1) - b2_av(2))/2.0d0
879 xa=dfloat(i-1)/dfloat(iplas-1)
881 sigma(i) =dabs(
fun_sig(xa,i)*dtim /amu0)
883 sigma(i) =dabs(
fun_sig_a(xa,i)*dtim/amu0 )
888 eb(i)= dpsidt(i)*(flx_fi(i+1)-flx_fi(i-1))
889 & -dfidt(i)*(psia(i+1)-psia(i-1))*psim
890 eb(i)=eb(i)/(dv(i)+dv(i-1))/dtim
891 sebeb=sigma(i)*eb(i)**2
892 wdj(i)=sebeb/b2_av(i)
897 fm=(3.d0*f(1)-f(2))/2.0d0
898 ebm=dpsidt(1)*fm/rm**2/dtim
907 eb(i)= dpsidt(i)*(flx_fi(i)-flx_fi(i-1))
908 & -dfidt(i)*(psia(i)-psia(i-1))*psim
909 eb(i)=eb(i)/(dv(i)+dv(i-1))/dtim
910 sebeb=sigma(i)*eb(i)**2
911 wdj(i)=sebeb/b2_av(i)
916 dpsdt05=0.5d0*(dpsidt(i)+dpsidt(i+1))/dtim
917 dfidt05=0.5d0*(dfidt(i)+dfidt(i+1))/dtim
919 eb_c(i)= dpsdt05*(flx_fi(i+1)-flx_fi(i))
920 & -dfidt05*(psia(i+1)-psia(i))*psim
922 eb_c(i)=-0.5d0*(eb(i)+eb(i+1))
923 epar_c(i)=eb_c(i)/dsqrt(b2_av(i))
927 z_nvzk(i)=amu0*sigma(i)*eb(i)+bj_av(i)
942 common/savt0/ psi0(nrp),fi0(nrp),f0(nrp),ri0(nrp),q0(nrp),
943 * dpsidt(nrp),dfidt(nrp),rm0,ac0n,skcen0
944 common/com_flag/kastr
945 common /com_jb/ bj_av(nrp),curfi_av(nrp)
946 common /com_b2/ b2_av(nrp)
947 common/com_heat_dj/ wdj(nrp)
949 dimension alfa22(nrp),alfa33(nrp),ds(nrp),dv(nrp),cj(nrp),
950 * alp33k(nrp),dsk(nrp),dvk(nrp)
954 bfjf(1)=cur(1,2)*f(1)/rm
961 volk=vol1(i,j)+vol2(i-1,j)+vol3(i-1,j-1)+vol4(i,j-1)
963 bj_i=bj_i+cur(i,j)*(f(i)+f(i-1))*0.5d0*volk/r(i,j)
969 call
metcof(alfa22,alfa33,ds,dv,ac0,skcen,cj,
974 b2_av(1)=(f(1)/rm)**2
977 bj_av(i)=(cj(i)*f(i-1)-cj(i-1)*f(i))/dvk(i)
978 curfi_av(i)=(cj(i)-cj(i-1))/dsk(i)
981 b2_av(i)=( f(i)*(flx_fi(i+1)-flx_fi(i))-
982 & cj(i)*psim*(psia(i+1)-psia(i)) )/dv(i)
985 b2_av(1)=(f(1)/rm)**2
992 b2_av(i)=(3.d0*b2_av(i-1) - b2_av(i-2))/2.0d0
994 b2_av_m=(3.d0*b2_av(1) - b2_av(2))/2.0d0
1001 xa=dfloat(i-1)/dfloat(iplas-1)
1003 sigma(i) =dabs(
fun_sig(xa,i)*dtim /amu0)
1005 sigma(i) =dabs(
fun_sig_a(xa,i)*dtim/amu0 )
1010 eb= dpsidt(i)*(flx_fi(i+1)-flx_fi(i-1))
1011 & -dfidt(i)*(psia(i+1)-psia(i-1))*psim
1012 eb=eb/(dv(i)+dv(i-1))/dtim
1013 sebeb=sigma(i)*eb**2
1014 wdj(i)=sebeb/b2_av(i)
1019 fm=(3.d0*f(1)-f(2))/2.0d0
1021 em=dpsidt(1)/rm/dtim
1028 eb= dpsidt(i)*(flx_fi(i)-flx_fi(i-1))
1029 & -dfidt(i)*(psia(i)-psia(i-1))*psim
1030 eb=eb/(dv(i)+dv(i-1))/dtim
1031 sebeb=sigma(i)*eb**2
1032 wdj(i)=sebeb/b2_av(i)
1041 common /comctr/ ngav
1047 elseif(j.eq.nt)
then
1068 include
'double.inc'
1070 include
'compol.inc'
1072 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
1073 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
1091 a(im)=a12(1,j)+a24(1,j)+a34(1,j-1)+a13(1,j-1)
1107 a2=a34(i-1,j-1)+a12(i-1,j)
1109 a4=a23(i-1,j-1)+a14(i,j-1)
1110 a6=a14(i,j)+a23(i-1,j)
1112 a8=a34(i,j-1)+a12(i,j)
1115 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
1126 ja(im)=
numlin(i-1,j,nr,nt)
1132 ja(im)=
numlin(i-1,j+1,nr,nt)
1138 ja(im)=
numlin(i-1,j-1,nr,nt)
1150 ja(im)=
numlin(i,j+1,nr,nt)
1156 ja(im)=
numlin(i,j-1,nr,nt)
1158 if(i.eq.iplas-1) go to 71
1164 ja(im)=
numlin(i+1,j,nr,nt)
1170 ja(im)=
numlin(i+1,j+1,nr,nt)
1176 ja(im)=
numlin(i+1,j-1,nr,nt)
1198 ja(im)=
numlin(2,j+1,nr,nt)
1204 ja(im)=
numlin(2,j-1,nr,nt)
1216 ja(im)=
numlin(3,j+1,nr,nt)
1222 ja(im)=
numlin(3,j-1,nr,nt)
1229 a2=a34(i-1,j-1)+a12(i-1,j)
1231 a4=a23(i-1,j-1)+a14(i,j-1)
1232 a6=a14(i,j)+a23(i-1,j)
1234 a8=a34(i,j-1)+a12(i,j)
1237 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
1248 ja(im)=
numlin(i-1,j-1,nr,nt)
1254 ja(im)=
numlin(i-1,j,nr,nt)
1260 ja(im)=
numlin(i-1,j+1,nr,nt)
1266 ja(im)=
numlin(i,j-1,nr,nt)
1278 ja(im)=
numlin(i,j+1,nr,nt)
1280 if(i.eq.iplas-1) go to 7
1286 ja(im)=
numlin(i+1,j-1,nr,nt)
1292 ja(im)=
numlin(i+1,j,nr,nt)
1298 ja(im)=
numlin(i+1,j+1,nr,nt)
1314 ja(im)=
numlin(2,j-1,nr,nt)
1326 ja(im)=
numlin(2,j+1,nr,nt)
1332 ja(im)=
numlin(3,j-1,nr,nt)
1344 ja(im)=
numlin(3,j+1,nr,nt)
1357 a2=a34(i-1,j-1)+a12(i-1,j)
1359 a4=a23(i-1,j-1)+a14(i,j-1)
1360 a6=a14(i,j)+a23(i-1,j)
1362 a8=a34(i,j-1)+a12(i,j)
1365 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
1376 ja(im)=
numlin(i-1,j+1,nr,nt)
1382 ja(im)=
numlin(i-1,j-1,nr,nt)
1388 ja(im)=
numlin(i-1,j,nr,nt)
1394 ja(im)=
numlin(i,j+1,nr,nt)
1400 ja(im)=
numlin(i,j-1,nr,nt)
1408 if(i.eq.iplas-1) go to 72
1414 ja(im)=
numlin(i+1,j+1,nr,nt)
1420 ja(im)=
numlin(i+1,j-1,nr,nt)
1426 ja(im)=
numlin(i+1,j,nr,nt)
1442 ja(im)=
numlin(2,j+1,nr,nt)
1448 ja(im)=
numlin(2,j-1,nr,nt)
1460 ja(im)=
numlin(3,j+1,nr,nt)
1466 ja(im)=
numlin(3,j-1,nr,nt)
1488 if( (itin/nitdel*nitdel+nitbeg) .EQ. itin )
then
1498 elseif(itin.gt.nitbeg)
then
1502 dapp(km)=a(km)-app0(km)
1518 include
'double.inc'
1520 parameter(nrpl=nrp+1)
1521 parameter(nrpl4=nrpl+4,nrpl6=nrpl4*6)
1522 include
'compol.inc'
1523 dimension ps(*),q_ps(*)
1524 dimension q_w(nrp+1),ps_w(nrp+1)
1525 real*8 rrk(nrpl4),cck(nrpl4),wrk(nrpl6)
1530 q_m=1.5d0*q(1)-0.5d0*q(2)
1534 q_bon=1.5d0*q(iplas-1)-0.5d0*q(iplas-2)
1543 ps_w(i+1)=1.d0-0.5d0*(psia(i)+psia(i+1))
1553 CALL
e01baf(n3spl,ps_w,q_w,rrk,cck,
1554 * n3spl+4,wrk,6*n3spl+16,ifail)
1558 CALL
e02bcf(n3spl+4,rrk,cck,zspl,0,cwk,ifail)
1563 q_ps(nw)=q_w(iplas+1)
subroutine extrpc(X, F, X0, X1, X2, X3, F1, F2, F3)
subroutine e02bcf(NCAP7, K, C, X, LEFT, S, IFAIL)
subroutine cof_bon(cps_bon, bps_bon, dps_bon)
real *8 function fun_sig(a, i)
real *8 function fun_sig_a(a, i)
real *8 function avr1_k(arr1_k, i)
real(r8) function dpdpsi(psi_n)
subroutine get_flfi(flfi_m)
function numlin(i, j, nr, nt)
subroutine bint(X, Y, R0, Z0, r1, z1, F, I)
subroutine e01baf(M, X, Y, K, C, LCK, WRK, LWRK, IFAIL)
subroutine get_psiext(psi_bon_ext)
subroutine extrp2(X, F, X1, X2, X3, F1, F2, F3)
subroutine skbetp(betplx, betpol)
subroutine deriv5(X, Y, F, M, N, U)
real *8 function avr_bnd(arr)
subroutine bt_pol(betpol)
subroutine axdef(rma, zma, psima, dpm)
subroutine avr2_c(arr2, nro, nteta, arr1)
subroutine avr2_k(arr2, nro, nteta, arr1)
real(r8) function r2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
subroutine metcof(alp22, alp33, delsc, delv, ac0, skcen, cur_I,
real *8 function qvadin(x,
real *8 function avr1_c(arr1_c, i)
subroutine inter_q(ps, nw, q_ps)