18 common /comabw/ alf0p,alf1p,alf2p,bet0f,bet1f,bet2f
24 common /com_0st/ key_0st,key_prs
39 if(kstep.eq.0 .OR. (ngav.eq.0 .AnD. kastr.eq.0))
then
60 curcen=r0*curp+curf/r0+curw*r0**3
66 sqcen=sqcen+sq1(1,j)+sq4(1,j)
73 tokww=curw*sqcen*r0**3
77 right(il)=curcen*sqcen
86 sqk=sq1(i,j)+sq2(i-1,j)+sq3(i-1,j-1)+sq4(i,j-1)
92 sqk=sq2(i-1,j)+sq3(i-1,j-1)
95 r0=(3.d0*r(i,j)+r(i-1,j))*0.25d0
96 psn=(3.d0*psin(i,j)+psin(i-1,j))*0.25d0
104 cur(i,j)=r0*curp+curf/r0+curw*r0**3
106 tokp=tokp+cur(i,j)*sqk
107 tokff=tokff+curf*sqk/r0
108 tokpp=tokpp+curp*sqk*r0
109 tokww=tokww+curw*sqk*r0**3
113 right(il)=cur(i,j)*sqk
124 dfdpsi(iplas)=tabf(0.d0)
125 dwdpsi(iplas)=tabw(0.d0)
129 c
write(*,*)
'cnor,tok,tokp'
130 c
write(*,*) cnor,tok,tokp
132 if(key_0st.eq.1) cnor=1.d0
147 cur(i,j)=cur(i,j)*cnor
161 right(il)=right(il)*cnor
174 dfdpsi(i)=dfdpsi(i)*cnor
175 dwdpsi(i)=dwdpsi(i)*cnor
186 if(kastr.eq.1 .AND. key_prs.eq.1 .AND. erru.lt.5.d-3)
then
194 dfdpsi_sur=-(fvac**2-f(iplas-1)**2)/psia(iplas-1)/psim
199 curcen=rm*
dpdpsi(1)+dfdpsi(1)/rm+dwdpsi(1)*rm**3
205 sqcen=sqcen+sq1(1,j)+sq4(1,j)
213 right(il)=curcen*sqcen
233 sqk=sq1(i,j)+sq2(i-1,j)+sq3(i-1,j-1)+sq4(i,j-1)
242 sqk=sq2(i-1,j)+sq3(i-1,j-1)
244 r0=(3.d0*r(i,j)+r(i-1,j))*0.25d0
252 cur(i,j)=r0*curp+curf/r0+curw*r0**3
254 tokp=tokp+cur(i,j)*sqk
258 right(il)=cur(i,j)*sqk
262 c
write(6,*)
'rightp:tokp=',tokp
280 right(il)=right(il)*cnor
284 cur(i,j)=cur(i,j)*cnor
291 write(*,*)
'cnor=',cnor
310 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
311 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
342 a8=a34(i,j-1)+a12(i,j)
347 right(il)=right(il)-(a7*psib(j-1)+a8*psib(j)+a9*psib(j+1))
362 parameter(nshp=ntp+1)
365 common/efites/ fcefit,rc_efit,iefit
366 dimension xs(nshp),ys(nshp),
fun(nshp),dp(5)
390 tg2a=2.d0*drz/(drr-dzz)
391 cos2a=1.d0/sqrt(1.d0+tg2a**2)
394 dxx=0.5d0*(drr+dzz)+0.5d0*cos2a*(drr-dzz)+sin2a*drz
395 dyy=0.5d0*(drr+dzz)+0.5d0*cos2a*(dzz-drr)-sin2a*drz
397 c
write(6,*)
'drr,dzz,drz',drr,dzz,drz
398 c
write(6,*)
'dxx,dyy',dxx,dyy
400 bfcen=qcen*dsqrt(dxx*dyy)*(psim-psip)
405 dpsi=(psia(1)-psia(2))
406 ps14=1.d0-0.25d0*dpsi
410 f(1)=sqrt(fcen**2-ffp*cnor*(psim-psip)*dpsi)
416 pspl=0.5d0*(psia(i)+psia(i+1))*(psim-psip)
417 psmn=0.5d0*(psia(i)+psia(i-1))*(psim-psip)
421 pspl=0.5d0*psia(i)*(psim-psip)
422 psmn=0.5d0*psia(i-1)*(psim-psip)
431 f(i)=sqrt(f(i-1)**2+2.d0*ffp*(pspl-psmn))
453 r0=(r1+
r2+r3+r4)*0.25d0
454 flucfi=flucfi+s(i,j)*f(i)/r0
459 flucfi=flucfi+(sq3(i-1,j-1)+sq2(i-1,j))*f(i)/r0
467 q2pi=-flucfi/((psia(i+1)-psia(i))*(psim-psip))
473 q2pi=-2.d0*flucfi/((psia(i)-psia(i-1))*(psim-psip))
506 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
507 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
509 common/com_bgr/ binadg(ntp,ntp),dgdn(ntp)
510 dimension pspl_b(ntp)
517 a2=a34(i-1,j-1)+a12(i-1,j)
524 sqk=sq2(i-1,j)+sq3(i-1,j-1)
525 dltk=(dlt(i,j-1)+dlt(i,j))*0.5d0
526 dgdnl=-(a1*g1+a2*g2+a3*g3) + cur(i,j)*sqk
540 psb=psb+binadg(jb,l)*(dgdn(jb)+dgdn(jb+1))*0.5d0
548 pspl_b(1)=pspl_b(nt1)
567 common /comind/ ni,nj,ni1,nj1,ni2,nj2,nbnd,nkin,nkout
568 common /comrz/ x(nip),y(njp),dx(nip),dy(njp),
569 + dxi(nip),dyj(njp),x12(nip)
571 common /compot/ u(nip,njp),ue(nip,njp),un(nip,njp),
572 + ui(nip,njp),g(nip,njp),
573 + ux0,ux1,ux2,up,um,xm,ym,
574 + xx0,yx0,xx1,yx1,xx2,yx2,imax,jmax,
576 + xx10,yx10,xx20,yx20,xm0,ym0,
578 dimension rlop(*),zlop(*),psilop(*)
603 psilop(i)=
blin_(r0,z0,r1,
r2,z1,z2,u1,u2,u3,u4 )
621 dimension psex_b(ntp),rbon(ntp),zbon(ntp)
632 psex_b(1)=psex_b(nt1)
649 common /com_mf/ bpol(nrp,ntp),btor(nrp,ntp),
650 & br(nrp,ntp),bz(nrp,ntp),
651 & rc(nrp,ntp),zc(nrp,ntp)
653 common /com_trap/ trap(nrp)
655 dimension btot(nrp,ntp)
662 bp_ij=(psi(i+1,j)-psi(i,j))/st(i,j)
663 bp_ij1=(psi(i+1,j+1)-psi(i,j+1))/st(i,j+1)
667 & bp_ij**2*( vol1(i,j)/sin1(i,j)+vol2(i,j)/sin2(i,j) )+
668 & bp_ij1**2*( vol3(i,j)/sin3(i,j)+vol4(i,j)/sin4(i,j) )
672 & bp_ij**2*( vol2(i,j)/sin2(i,j) )+
673 & bp_ij1**2*( vol3(i,j)/sin3(i,j) )
677 btor_ij=f(i)*s(i,j)/vol(i,j)
681 btot_ij=dsqrt(bp_2+btor_ij**2)
687 r0=(r1+
r2+r3+r4)*0.25d0
698 z0=(z1+z2+z3+z4)*0.25d0
707 drz= dsqrt(dr**2+dz**2)
721 bpol(i,1)=bpol(i,nt-1)
722 btor(i,1)=btor(i,nt-1)
733 b_ij=dsqrt(bpol(i,j)**2+btor(i,j)**2)
734 bmax=dmax1(bmax,b_ij)
743 & (b0ax/btot(i,j))**2
744 & *( 1.d0-dsqrt(1.d0-bnor)*(1.d0+.5d0*bnor) )*vol(i,j)
751 write(fname,
'(a,a)') path(1:kname),
'fields.wr'
754 write(1,*) iplas-1,nt-1
755 write(1,*) ((rc(i,j),i=1,iplas-1),j=1,nt-1)
756 write(1,*) ((zc(i,j),i=1,iplas-1),j=1,nt-1)
757 write(1,*) ((br(i,j),i=1,iplas-1),j=1,nt-1)
758 write(1,*) ((bz(i,j),i=1,iplas-1),j=1,nt-1)
759 write(1,*) ((btor(i,j),i=1,iplas-1),j=1,nt-1)
760 write(1,*) ((bpol(i,j),i=1,iplas-1),j=1,nt-1)
761 write(1,*) (trap(i),i=1,iplas-1)
subroutine psloop_e(rlop, zlop, psilop, nlop)
subroutine psib_ext(psex_av)
subroutine procof(icq, cur_mu)
real(r8) function dpdpsi(psi_n)
function numlin(i, j, nr, nt)
subroutine deriv5(X, Y, F, M, N, U)
real *8 function avr_bnd(arr)
subroutine psib_pla(pspl_av)
real *8 function blin_(r0, z0, r1, r2, z1, z2, u1, u2, u3, u4)
real(r8) function r2(a, x, xr, xs, yr, ys, psi, psir, F_dia)