1 subroutine prefit(rk,zk,ncpfc,NECON,WECON,rax,zax,alp_b,psi_bnd)
15 integer necon(*),ncpfc
22 c -----------------------------
27 c -----------------------------
30 write(fname,
'(a,a)') path(1:kname),
'bonfit.dat'
31 open(1,file=fname,form=
'formatted')
34 read(1,*) wwl,wdk,wsig
36 read(1,*) (d_wght(ik),ik=1,nequi)
41 read(1,*) rfit(l),zfit(l)
47 read(1,*) rpre(l),zpre(l)
59 write(fname,
'(a,a)') path(1:kname),
'matC.wr'
60 open(1,file=fname,form=
'formatted')
63 read(1,*) (g_wght(i),i=1,n_cc)
64 read(1,*) ((cpir(i,j),i=1,n_cc),j=1,m_cc)
69 cpir(i,j)=cpir(i,j)*g_wght(i)
77 cxcs=cxcs+cpir(k,i)*cpir(k,j)
95 elseif(kastr.eq.1)
then
130 call grimat(rk,zk,ncpfc,necon, wecon)
133 call grimat2x(rk,zk,ncpfc,necon, wecon)
145 subroutine curfit(rk,zk,nk,NECON,WECON,psi_bnd)
154 c -----------------------------
162 call cursol_snf(nequi,pfceqw,psi_bnd)
166 call cursol(nequi,pfceqw,psi_bnd)
167 elseif(kxwx.eq.2)
then
170 call cursol_2x(nequi,pfceqw,psi_bnd)
171 elseif(kxwx.eq.0)
then
173 call cursol_wx(nequi,pfceqw,psi_bnd)
176 write(*,*)
'coil currents'
179 write(*,*) pfceqw(ik),ik
186 subroutine curfit_l(rk,zk,nk,NECON,WECON,psi_bnd)
194 c -----------------------------
201 call cursol_(nequi,pfceqw,psi_bnd)
203 write(*,*)
'coil currents'
206 write(*,*) pfceqw(ik),ik
214 subroutine curfit_(rk,zk,nk,NECON,WECON,psi_bnd)
222 c -----------------------------
230 call cursol_(nequi,pfceqw,psi_bnd)
232 write(*,*)
'coil currents'
235 write(*,*) pfceqw(ik),ik
243 subroutine grimat(rk,zk,ncpfc,NECON, WECON )
250 real*8 rk(*),zk(*), wecon(*)
279 if( necon(ik) .eq. iq )
then
280 zgindk=
greeni(rfit(l),zfit(l),rk(ik),zk(ik))/pi
281 gindk(iq,l)=gindk(iq,l)+zgindk*wecon(ik)
292 if( necon(ik) .eq. iq )
then
293 zgindp=
greeni(rpre(l),zpre(l),rk(ik),zk(ik))/pi
294 gindp(iq,l)=gindp(iq,l)+zgindp*wecon(ik)
302 if( necon(ik) .eq. iq )
then
304 call
grgren(rk(ik),zk(ik),rx_p,zx_p, dgdr,dgdz)
305 gx_r(iq)=gx_r(iq)+dgdr*wecon(ik)/pi
306 gx_z(iq)=gx_z(iq)+dgdz*wecon(ik)/pi
309 call
d2gren(rk(ik),zk(ik),rx_p,zx_p, d2gdrz,d2gdzz,d2gdrr)
310 gx_rz(iq)=gx_rz(iq)+d2gdrz*wecon(ik)/pi
311 gx_zz(iq)=gx_zz(iq)+d2gdzz*wecon(ik)/pi
312 gx_rr(iq)=gx_rr(iq)+d2gdrr*wecon(ik)/pi
325 subroutine grimat2x(rk,zk,ncpfc,NECON, WECON )
332 real*8 rk(*),zk(*), wecon(*)
344 if( necon(ik) .eq. iq )
then
346 call
grgren(rk(ik),zk(ik),rx2_p,zx2_p, dgdr,dgdz)
347 gx2_r(iq)=gx2_r(iq)+dgdr*wecon(ik)/pi
348 gx2_z(iq)=gx2_z(iq)+dgdz*wecon(ik)/pi
366 subroutine precal(rk,zk,nk,NECON, WECON )
375 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
377 real*8 rk(*),zk(*), wecon(*)
390 if( necon(ik) .eq. iq )
then
391 zginda=
greeni(r_ax,z_ax,rk(ik),zk(ik))/pi
392 ginda(iq)=ginda(iq)+zginda*wecon(ik)
393 zgindx=
greeni(rx_p,zx_p,rk(ik),zk(ik))/pi
394 gindx(iq)=gindx(iq)+zgindx*wecon(ik)
406 c---definition of the nearest knote
414 dlx=dsqrt( (rr-r_ax)**2+(zz-z_ax)**2 )
415 if(dlx.lt.sdmin)
then
436 if(k.eq.0 .AND. l.eq.0 ) go to 410
450 psip_a=
fun(1)+ dp(1)*(r_ax-rra) + dp(2)*(z_ax-zza)
451 + + 0.5d0*dp(3)*(r_ax-rra)*(r_ax-rra)
452 + + dp(4)*(r_ax-rra)*(z_ax-zza)
453 + + 0.5d0*dp(5)*(z_ax-zza)*(z_ax-zza)
458 subroutine precal_wx(rk,zk,nk,NECON, WECON )
467 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
469 real*8 rk(*),zk(*), wecon(*)
482 if( necon(ik) .eq. iq )
then
483 zginda=
greeni(r_ax,z_ax,rk(ik),zk(ik))/pi
484 ginda(iq)=ginda(iq)+zginda*wecon(ik)
485 zgindx=
greeni(rx0,zx0,rk(ik),zk(ik))/pi
486 gindx(iq)=gindx(iq)+zgindx*wecon(ik)
498 c---definition of the nearest knote
506 dlx=dsqrt( (rr-r_ax)**2+(zz-z_ax)**2 )
507 if(dlx.lt.sdmin)
then
528 if(k.eq.0 .AND. l.eq.0 ) go to 410
542 psip_a=
fun(1)+ dp(1)*(r_ax-rra) + dp(2)*(z_ax-zza)
543 + + 0.5d0*dp(3)*(r_ax-rra)*(r_ax-rra)
544 + + dp(4)*(r_ax-rra)*(z_ax-zza)
545 + + 0.5d0*dp(5)*(z_ax-zza)*(z_ax-zza)
552 subroutine cursol(NEQUI,PFCEQW,psi_bnd)
557 dimension a(ncf_p,ncf_p),x(ncf_p),y(ncf_p),ip(ncf_p)
558 dimension psictr(ncf_p)
577 asum=asum+gindk(k,l)*gindk(j,l)*w_wght(l)
584 a(j,j)=a(j,j)+d_wght(j)*s_wght
591 a(j,nequi+l)=gindp(j,l)
598 a(j,nequi+lpre+1)=gx_r(j)
604 a(j,nequi+lpre+2)=gx_z(j)
613 a(j,nequi+lpre+3)=(1.d0-alph)*ginda(j)+alph*gindx(j)
624 asum=asum+w_wght(l)*gindk(j,l)
626 a(j,nequi+lpre+4)=-asum
634 asum=asum+w_wght(l)*gindk(j,l)*psifit(l)
636 y(j)=-asum+d_wght(j)*s_wght*curref(j)*amu0
777 a(j,k)=(1.d0-alph)*ginda(k)+alph*gindx(k)
804 y(j)=-(1.d0-alph)*psip_a-alph*psip_x
823 asum=asum+w_wght(l)*gindk(k,l)
836 a(j,nequi+lpre+1)=0.d0
838 a(j,nequi+lpre+2)=0.d0
840 a(j,nequi+lpre+3)=1.d0
848 a(j,nequi+lpre+4)=-asum
853 asum=asum+w_wght(l)*psifit(l)
858 call
ge(nequi+lpre+4,ncf_p,a,y,x,ip)
869 psictr(l)=psictr(l)+gindk(iq,l)*pfceqw(iq)
878 gr_xp=gr_xp+gx_r(iq)*pfceqw(iq)
879 gz_xp=gz_xp+gx_z(iq)*pfceqw(iq)
881 ps_xp=ps_xp+gindx(iq)*pfceqw(iq)
882 ps_ma=ps_ma+ginda(iq)*pfceqw(iq)
885 write(*,*)
'gr_xp=',gr_xp
886 write(*,*)
'gz_xp=',gz_xp
889 psictr(lfit+l)=psipre(l)
891 psictr(lfit+l)=psictr(lfit+l)+gindp(iq,l)*pfceqw(iq)
896 pfceqw(iq)=x(iq)/amu0
899 psi_bnd=x(nequi+lpre+4)
901 alp_out=(ps_ma-psi_bnd)/(ps_ma-ps_xp)
907 subroutine cursol_snf(NEQUI,PFCEQW,psi_bnd)
912 dimension a(ncf_p,ncf_p),x(ncf_p),y(ncf_p),ip(ncf_p)
913 dimension psictr(ncf_p)
932 asum=asum+gindk(k,l)*gindk(j,l)*w_wght(l)
939 a(j,j)=a(j,j)+d_wght(j)*s_wght
946 a(j,k)=a(j,k)+cxc(j,k)*c_wght
956 a(j,nequi+l)=gindp(j,l)
963 a(j,nequi+lpre+1)=gx_r(j)
969 a(j,nequi+lpre+2)=gx_z(j)
978 a(j,nequi+lpre+3)=(1.d0-alph)*ginda(j)+alph*gindx(j)
989 asum=asum+w_wght(l)*gindk(j,l)
991 a(j,nequi+lpre+4)=-asum
997 a(j,nequi+lpre+5)=gx_rz(j)
1003 a(j,nequi+lpre+6)=gx_zz(j)
1011 asum=asum+w_wght(l)*gindk(j,l)*psifit(l)
1013 y(j)=-asum+d_wght(j)*s_wght*curref(j)*amu0
1185 a(j,k)=(1.d0-alph)*ginda(k)+alph*gindx(k)
1220 y(j)=-(1.d0-alph)*psip_a-alph*psip_x
1236 asum=asum+w_wght(l)*gindk(k,l)
1249 a(j,nequi+lpre+1)=0.d0
1251 a(j,nequi+lpre+2)=0.d0
1253 a(j,nequi+lpre+3)=1.d0
1261 a(j,nequi+lpre+4)=-asum
1264 a(j,nequi+lpre+5)=0.d0
1266 a(j,nequi+lpre+6)=0.d0
1272 asum=asum+w_wght(l)*psifit(l)
1370 call
ge(nequi+lpre+6,ncf_p,a,y,x,ip)
1381 psictr(l)=psictr(l)+gindk(iq,l)*pfceqw(iq)
1395 gr_xp=gr_xp+gx_r(iq)*pfceqw(iq)
1396 gz_xp=gz_xp+gx_z(iq)*pfceqw(iq)
1398 ps_xp=ps_xp+gindx(iq)*pfceqw(iq)
1399 ps_ma=ps_ma+ginda(iq)*pfceqw(iq)
1401 d2rz_xp=d2rz_xp+gx_rz(iq)*pfceqw(iq)
1402 d2zz_xp=d2zz_xp+gx_zz(iq)*pfceqw(iq)
1403 d2rr_xp=d2rr_xp+gx_rr(iq)*pfceqw(iq)
1407 write(*,*)
'cursol:'
1408 write(*,*)
'd2rz_xp=',d2rz_xp
1409 write(*,*)
'd2zz_xp=',d2zz_xp
1410 write(*,*)
'd2rr_xp=',d2rr_xp
1411 write(*,*)
'gr_xp=',gr_xp
1412 write(*,*)
'gz_xp=',gz_xp
1415 psictr(lfit+l)=psipre(l)
1417 psictr(lfit+l)=psictr(lfit+l)+gindp(iq,l)*pfceqw(iq)
1422 pfceqw(iq)=x(iq)/amu0
1425 psi_bnd=x(nequi+lpre+4)
1427 alp_out=(ps_ma-psi_bnd)/(ps_ma-ps_xp)
1434 subroutine cursol_2x(NEQUI,PFCEQW,psi_bnd)
1436 include
'double.inc'
1437 include
'parcur.inc'
1439 dimension a(ncf_p,ncf_p),x(ncf_p),y(ncf_p),ip(ncf_p)
1440 dimension psictr(ncf_p)
1459 asum=asum+gindk(k,l)*gindk(j,l)*w_wght(l)
1466 a(j,j)=a(j,j)+d_wght(j)*s_wght
1473 a(j,k)=a(j,k)+cxc(j,k)*c_wght
1483 a(j,nequi+l)=gindp(j,l)
1490 a(j,nequi+lpre+1)=gx_r(j)
1496 a(j,nequi+lpre+2)=gx_z(j)
1505 a(j,nequi+lpre+3)=(1.d0-alph)*ginda(j)+alph*gindx(j)
1516 asum=asum+w_wght(l)*gindk(j,l)
1518 a(j,nequi+lpre+4)=-asum
1524 a(j,nequi+lpre+5)=gx2_r(j)
1530 a(j,nequi+lpre+6)=gx2_z(j)
1538 asum=asum+w_wght(l)*gindk(j,l)*psifit(l)
1540 y(j)=-asum+d_wght(j)*s_wght*curref(j)*amu0
1712 a(j,k)=(1.d0-alph)*ginda(k)+alph*gindx(k)
1747 y(j)=-(1.d0-alph)*psip_a-alph*psip_x
1763 asum=asum+w_wght(l)*gindk(k,l)
1776 a(j,nequi+lpre+1)=0.d0
1778 a(j,nequi+lpre+2)=0.d0
1780 a(j,nequi+lpre+3)=1.d0
1788 a(j,nequi+lpre+4)=-asum
1791 a(j,nequi+lpre+5)=0.d0
1793 a(j,nequi+lpre+6)=0.d0
1799 asum=asum+w_wght(l)*psifit(l)
1897 call
ge(nequi+lpre+6,ncf_p,a,y,x,ip)
1908 psictr(l)=psictr(l)+gindk(iq,l)*pfceqw(iq)
1921 gr_xp=gr_xp+gx_r(iq)*pfceqw(iq)
1922 gz_xp=gz_xp+gx_z(iq)*pfceqw(iq)
1924 ps_xp=ps_xp+gindx(iq)*pfceqw(iq)
1925 ps_ma=ps_ma+ginda(iq)*pfceqw(iq)
1927 gr_xp2=gr_xp2+gx2_r(iq)*pfceqw(iq)
1928 gz_xp2=gz_xp2+gx2_z(iq)*pfceqw(iq)
1932 write(*,*)
'cursol:'
1933 write(*,*)
'gr_xp=',gr_xp
1934 write(*,*)
'gz_xp=',gz_xp
1935 write(*,*)
'gr_xp2=',gr_xp2
1936 write(*,*)
'gz_xp2=',gz_xp2
1939 psictr(lfit+l)=psipre(l)
1941 psictr(lfit+l)=psictr(lfit+l)+gindp(iq,l)*pfceqw(iq)
1946 pfceqw(iq)=x(iq)/amu0
1949 psi_bnd=x(nequi+lpre+4)
1951 alp_out=(ps_ma-psi_bnd)/(ps_ma-ps_xp)
1958 subroutine cursol_wx(NEQUI,PFCEQW,psi_bnd)
1960 include
'double.inc'
1961 include
'parcur.inc'
1963 dimension a(ncf_p,ncf_p),x(ncf_p),y(ncf_p),ip(ncf_p)
1964 dimension psictr(ncf_p)
1983 asum=asum+gindk(k,l)*gindk(j,l)*w_wght(l)
1990 a(j,j)=a(j,j)+d_wght(j)*s_wght
1997 a(j,nequi+l)=gindp(j,l)
2019 a(j,nequi+lpre+1)=(1.d0-alph)*ginda(j)+alph*gindx(j)
2030 asum=asum+w_wght(l)*gindk(j,l)
2032 a(j,nequi+lpre+2)=-asum
2040 asum=asum+w_wght(l)*gindk(j,l)*psifit(l)
2042 y(j)=-asum+d_wght(j)*s_wght*curref(j)*amu0
2183 a(j,k)=(1.d0-alph)*ginda(k)+alph*gindx(k)
2210 y(j)=-(1.d0-alph)*psip_a-alph*psip_x
2229 asum=asum+w_wght(l)*gindk(k,l)
2246 a(j,nequi+lpre+1)=1.d0
2254 a(j,nequi+lpre+2)=-asum
2259 asum=asum+w_wght(l)*psifit(l)
2264 call
ge(nequi+lpre+2,ncf_p,a,y,x,ip)
2275 psictr(l)=psictr(l)+gindk(iq,l)*pfceqw(iq)
2284 gr_xp=gr_xp+gx_r(iq)*pfceqw(iq)
2285 gz_xp=gz_xp+gx_z(iq)*pfceqw(iq)
2287 ps_xp=ps_xp+gindx(iq)*pfceqw(iq)
2288 ps_ma=ps_ma+ginda(iq)*pfceqw(iq)
2292 psictr(lfit+l)=psipre(l)
2294 psictr(lfit+l)=psictr(lfit+l)+gindp(iq,l)*pfceqw(iq)
2299 pfceqw(iq)=x(iq)/amu0
2302 psi_bnd=x(nequi+lpre+2)
2304 alp_out=(ps_ma-psi_bnd)/(ps_ma-ps_xp)
2314 include
'double.inc'
2316 include
'parcur.inc'
2318 include
'comblc.inc'
2319 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
2326 ic=(r0-rmin)/dr(1)+1
2327 jc=(z0-zmin)/dz(1)+1
2329 psifit(l)=
blin(ic,jc,r0,z0)
2338 ic=(r0-rmin)/dr(1)+1
2339 jc=(z0-zmin)/dz(1)+1
2341 psipre(l)=
blin(ic,jc,r0,z0)
2348 ic=(r0-rmin)/dr(1)+1
2349 jc=(z0-zmin)/dz(1)+1
2352 c---definition of the nearest knote
2360 dlx=dsqrt( (rr-rx_p)**2+(zz-zx_p)**2 )
2361 if(dlx.lt.sdmin)
then
2382 if(k.eq.0 .AND. l.eq.0 ) go to 410
2396 dpsx_r = dp(1) + dp(3)*(rx_p-rrx) + dp(4)*(zx_p-zzx)
2397 dpsx_z = dp(2) + dp(5)*(zx_p-zzx) + dp(4)*(rx_p-rrx)
2403 psip_x=
fun(1)+ dp(1)*(rx_p-rrx) + dp(2)*(zx_p-zzx)
2404 + + 0.5d0*dp(3)*(rx_p-rrx)*(rx_p-rrx)
2405 + + dp(4)*(rx_p-rrx)*(zx_p-zzx)
2406 + + 0.5d0*dp(5)*(zx_p-zzx)*(zx_p-zzx)
2415 subroutine psi_cpn_wx
2417 include
'double.inc'
2419 include
'parcur.inc'
2421 include
'comblc.inc'
2422 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(5)
2429 ic=(r0-rmin)/dr(1)+1
2430 jc=(z0-zmin)/dz(1)+1
2432 psifit(l)=
blin(ic,jc,r0,z0)
2441 ic=(r0-rmin)/dr(1)+1
2442 jc=(z0-zmin)/dz(1)+1
2444 psipre(l)=
blin(ic,jc,r0,z0)
2451 ic=(r0-rmin)/dr(1)+1
2452 jc=(z0-zmin)/dz(1)+1
2455 c---definition of the nearest knote
2463 dlx=dsqrt( (rr-rx0)**2+(zz-zx0)**2 )
2464 if(dlx.lt.sdmin)
then
2485 if(k.eq.0 .AND. l.eq.0 ) go to 410
2499 dpsx_r = dp(1) + dp(3)*(rx0-rrx) + dp(4)*(zx0-zzx)
2500 dpsx_z = dp(2) + dp(5)*(zx0-zzx) + dp(4)*(rx0-rrx)
2506 psip_x=
fun(1)+ dp(1)*(rx0-rrx) + dp(2)*(zx0-zzx)
2507 + + 0.5d0*dp(3)*(rx0-rrx)*(rx0-rrx)
2508 + + dp(4)*(rx0-rrx)*(zx0-zzx)
2509 + + 0.5d0*dp(5)*(zx0-zzx)*(zx0-zzx)
2520 include
'double.inc'
2523 include
'parcur.inc'
2525 include
'comblc.inc'
2527 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(9)
2534 ic=(r0-rmin)/dr(1)+1
2535 jc=(z0-zmin)/dz(1)+1
2537 psifit(l)=
blin(ic,jc,r0,z0)
2546 ic=(r0-rmin)/dr(1)+1
2547 jc=(z0-zmin)/dz(1)+1
2549 psipre(l)=
blin(ic,jc,r0,z0)
2556 ic=(r0-rmin)/dr(1)+1
2557 jc=(z0-zmin)/dz(1)+1
2560 c---definition of the nearest node
2568 dlx=dsqrt( (rr-rx_p)**2+(zz-zx_p)**2 )
2569 if(dlx.lt.sdmin)
then
2592 if(k.eq.0 .AND. l.eq.0 ) go to 410
2607 dpsx_r = dp(1) + dp(3)*(rx_p-rrx) + dp(4)*(zx_p-zzx)
2608 + +dp(6)*(rx_p-rrx)**2*3+dp(8)*(zx_p-zzx)**2
2609 + +dp(7)*(rx_p-rrx)*(zx_p-zzx)*2
2610 dpsx_z = dp(2) + dp(5)*(zx_p-zzx) + dp(4)*(rx_p-rrx)
2611 + +dp(7)*(rx_p-rrx)**2+dp(9)*(zx_p-zzx)**2*3
2612 + +dp(8)*(rx_p-rrx)*(zx_p-zzx)*2
2614 + +dp(7)*(rx_p-rrx)*2+dp(8)*(zx_p-zzx)*2
2616 + +dp(8)*(rx_p-rrx)*2+dp(9)*(zx_p-zzx)*6
2618 + +dp(7)*(zx_p-zzx)*2+dp(6)*(rx_p-rrx)*6
2620 psip_x=
fun(1)+ dp(1)*(rx_p-rrx) + dp(2)*(zx_p-zzx)
2621 + + 0.5d0*dp(3)*(rx_p-rrx)*(rx_p-rrx)
2622 + + dp(4)*(rx_p-rrx)*(zx_p-zzx)
2623 + + 0.5d0*dp(5)*(zx_p-zzx)*(zx_p-zzx)
2624 + + dp(6)*(rx_p-rrx)*(rx_p-rrx)*(rx_p-rrx)
2625 + + dp(7)*(rx_p-rrx)*(rx_p-rrx)*(zx_p-zzx)
2626 + + dp(8)*(rx_p-rrx)*(zx_p-zzx)*(zx_p-zzx)
2627 + + dp(9)*(zx_p-zzx)*(zx_p-zzx)*(zx_p-zzx)
2635 subroutine psi_cpn_2x
2637 include
'double.inc'
2640 include
'parcur.inc'
2642 include
'comblc.inc'
2644 real*8 xs(nshp),ys(nshp),
fun(nshp),dp(9)
2650 ic=(r0-rmin)/dr(1)+1
2651 jc=(z0-zmin)/dz(1)+1
2654 c---definition of the nearest node
2662 dlx=dsqrt( (rr-rx2_p)**2+(zz-zx2_p)**2 )
2663 if(dlx.lt.sdmin)
then
2686 if(k.eq.0 .AND. l.eq.0 ) go to 410
2701 dpsx2_r = dp(1) + dp(3)*(rx2_p-rrx) + dp(4)*(zx2_p-zzx)
2702 + +dp(6)*(rx2_p-rrx)**2*3+dp(8)*(zx2_p-zzx)**2
2703 + +dp(7)*(rx2_p-rrx)*(zx2_p-zzx)*2
2704 dpsx2_z = dp(2) + dp(5)*(zx2_p-zzx) + dp(4)*(rx2_p-rrx)
2705 + +dp(7)*(rx2_p-rrx)**2+dp(9)*(zx2_p-zzx)**2*3
2706 + +dp(8)*(rx2_p-rrx)*(zx2_p-zzx)*2
2708 + +dp(7)*(rx2_p-rrx)*2+dp(8)*(zx2_p-zzx)*2
2710 + +dp(8)*(rx2_p-rrx)*2+dp(9)*(zx2_p-zzx)*6
2712 + +dp(7)*(zx2_p-zzx)*2+dp(6)*(rx2_p-rrx)*6
2714 psip_x2=
fun(1)+ dp(1)*(rx2_p-rrx) + dp(2)*(zx2_p-zzx)
2715 + + 0.5d0*dp(3)*(rx2_p-rrx)*(rx2_p-rrx)
2716 + + dp(4)*(rx2_p-rrx)*(zx2_p-zzx)
2717 + + 0.5d0*dp(5)*(zx2_p-zzx)*(zx2_p-zzx)
2718 + + dp(6)*(rx2_p-rrx)*(rx2_p-rrx)*(rx2_p-rrx)
2719 + + dp(7)*(rx2_p-rrx)*(rx2_p-rrx)*(zx2_p-zzx)
2720 + + dp(8)*(rx2_p-rrx)*(zx2_p-zzx)*(zx2_p-zzx)
2721 + + dp(9)*(zx2_p-zzx)*(zx2_p-zzx)*(zx2_p-zzx)
2729 subroutine cursol_(NEQUI,PFCEQW,psi_bnd)
2731 include
'double.inc'
2732 include
'parcur.inc'
2734 dimension a(ncf_p,ncf_p),x(ncf_p),y(ncf_p),ip(ncf_p)
2735 dimension psictr(ncf_p)
2754 asum=asum+gindk(k,l)*gindk(j,l)*w_wght(l)
2761 a(j,j)=a(j,j)+d_wght(j)*s_wght
2768 a(j,nequi+l)=gindp(j,l)
2777 asum=asum+w_wght(l)*gindk(j,l)
2779 a(j,nequi+lpre+1)=-asum
2785 asum=asum+w_wght(l)*gindk(j,l)*psifit(l)
2787 y(j)=-asum+d_wght(j)*s_wght*curref(j)*amu0
2836 asum=asum+w_wght(l)*gindk(k,l)
2838 a(nequi+lpre+1,k)=asum
2845 a(nequi+lpre+1,k)=1.d0
2854 a(nequi+lpre+1,nequi+lpre+1)=-asum
2858 asum=asum+w_wght(l)*psifit(l)
2860 y(nequi+lpre+1)=-asum
2863 call
ge(nequi+lpre+1,ncf_p,a,y,x,ip)
2874 psictr(l)=psictr(l)+gindk(iq,l)*pfceqw(iq)
2879 psictr(lfit+l)=psipre(l)
2881 psictr(lfit+l)=psictr(lfit+l)+gindp(iq,l)*pfceqw(iq)
2886 pfceqw(iq)=x(iq)/amu0
2889 psi_bnd=x(nequi+lpre+1)
2898 include
'double.inc'
2900 include
'parcur.inc'
2901 include
'compol.inc'
2903 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
2904 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
2906 dimension binadg(ntp,ntp),dgdn(ntp)
2913 a2=a34(i-1,j-1)+a12(i-1,j)
2920 dltk=(dlt(i,j-1)+dlt(i,j))*0.5d0
2921 dgdnl=a1*g1+a2*g2+a3*g3
2943 call
bint(rr,zz,r0,z0,r1,z1,fint,1)
2956 psb=psb+binadg(jb,l)*(dgdn(jb)+dgdn(jb+1))*0.5d0
2977 call
bint(rr,zz,r0,z0,r1,z1,fint,1)
2990 psb=psb+binadg(jb,l)*(dgdn(jb)+dgdn(jb+1))*0.5d0
3001 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REAL *8 function greeni(R, Z, RP, ZP)
subroutine deriv9(X, Y, F, M, N, U)
subroutine bint(X, Y, R0, Z0, r1, z1, F, I)
subroutine deriv5(X, Y, F, M, N, U)
subroutine ge(N, NZ, A, X, Y, IP)
subroutine curfit(iopt, m, x, y, w, xb, xe, k, s, nest, n, t, c, fp, wrk, lwrk, iwrk, ier)
subroutine grgren(R0, Z0, R, Z, dGdr, dGdz)
real *8 function blin(i, j, r0, z0)
subroutine d2gren(R0, Z0, R, Z, d2Gdrz, d2Gdzz, d2Gdrr)