3 SUBROUTINE differ( AOLD, ANEW, N, ERRLOC, ERRVEC,
4 * absmax, absmin, nout, nter )
8 dimension aold(*), anew(*)
14 absmax = abs( anew(1) )
15 absmin = abs( anew(1) )
19 IF( absa.LT.absmin ) absmin = absa
20 IF( absa.GT.absmax ) absmax = absa
21 absd = abs( anew(i) - aold(i) )
22 IF( absa.GT.1.0d-12 )
THEN
24 IF( absr.GT.errloc ) errloc = absr
31 s1 = s1 + ( anew(l) - aold(l) )**2
37 IF( s2 .GT. 1.0d-12 )
THEN
47 SUBROUTINE diftim( AK, AKP1S, AKP1N, N, ERRLOC, ERRVEC,
48 * absmax, absmin, nout, nter )
52 dimension ak(*), akp1s(*), akp1n(*)
58 absmax = abs( akp1n(1) - ak(1) )
59 absmin = abs( akp1n(1) - ak(1) )
62 absa = abs( akp1n(i) - ak(i) )
63 IF( absa.LT.absmin ) absmin = absa
64 IF( absa.GT.absmax ) absmax = absa
65 absd = abs( akp1n(i) - akp1s(i) )
66 IF( absa.GT.1.0d-12 )
THEN
68 IF( absr.GT.errloc ) errloc = absr
75 s1 = s1 + ( akp1n(l) - akp1s(l) )**2
76 s2 = s2 + ( akp1n(l) - ak(l) )**2
82 IF( s2 .GT. 1.0d-12 )
THEN
92 SUBROUTINE difgeo( RM, ZM, RAXPR, ZAXPR, RMAOLD, ZMAOLD,
93 * delaxa, delaxr, nout, nter )
99 delaxa = sqrt( (rmaold-rm)**2 + (zmaold-zm)**2 )
100 delaxt = sqrt( (raxpr -rm)**2 + (zaxpr -zm)**2 )
101 IF( delaxt.GT.1.0d-12 )
THEN
102 delaxr = delaxa / delaxt
118 REAL*8 FUNCTION selind( NTYPE, RC, VC, HC )
128 pi2 = 2.d0 * 3.14159265399d0
131 IF( ntype .EQ. 1 )
THEN
133 vcl=sqrt(hc**2+vc**2)
144 > * (alog( 8.d0*(rc+hc*i/3.d0)/(vcl/3.d0) ) - 0.5d0) / pi2
148 >
greeni( rc+hc*i/3.d0,vc*i/3.d0,rc+hc*j/3.d0,vc*j/3.d0)*2d0
162 IF( ntype .EQ. 2 )
THEN
164 selind = rc*(alog(8.d0*rc/(0.2236d0*(vc+hc)))-2.d0) / pi2
173 IF( ntype .EQ. 3 )
THEN
175 selind = rc*(alog(8.d0*rc/vc)-1.75d0) / pi2
179 IF((ntype.NE.1).AND.(ntype.NE.2).AND.(ntype.NE.3))
THEN
202 REAL*8 FUNCTION betind( NTYPE1, RC1, ZC1, VC1, HC1,
203 * ntype2, rc2, zc2, vc2, hc2 )
210 IF( ntype1 .EQ. 1 .and. ntype2 .EQ. 1)
THEN
215 >
greeni( rc1+hc1*i/3.d0,zc1+vc1*i/3.d0,rc2+hc2*j/3.d0,zc2
222 IF( ntype1 .EQ. 1 .and. ntype2 .EQ. 2)
THEN
226 >
greeni( rc1+hc1*i/3.d0,zc1+vc1*i/3.d0,rc2,zc2)
231 IF( ntype1 .EQ. 2 .and. ntype2 .EQ. 1)
THEN
235 >
greeni( rc1,zc1,rc2+hc2*j/3.d0,zc2+vc2*j/3.d0)
240 IF( ntype1 .EQ. 2 .and. ntype2 .EQ. 2)
THEN
244 IF( ntype1 .EQ. 3 .OR. ntype2 .EQ. 3)
THEN
253 SUBROUTINE gavpar( NOUT , NTER , KEYPRI ,
254 * kstep , tstep , timev ,
256 * k_contr , tau_p , kstep_c , tstep_c ,
257 * v_contr , v0_contr, v_prog , v_full ,
258 * res_comp, res_extr, pfc_ref )
268 dimension v_contr(n_volt_m), v_prog(n_volt_m),
269 * v0_contr(n_volt_m), v_full(n_volt_m)
270 dimension res_comp(n_volt_m), res_extr(n_volt_m)
271 dimension pfc_ref(n_volt_m), tau_p(n_volt_m)
273 dimension tmcur(100), ve1(100), ve8(100)
285 bbb = 1.d0 / ( 2.d0*pi )
293 IF( k_contr .eq. 0 )
THEN
303 if( n_pert.ne.0 )
then
315 kp(i) = kp(i-1) + k_pert1 + k_pert2 + k_rest
320 kk2 = kp(i)+k_pert1+k_pert2
321 if((kp(i).lt.kstep).and.(kstep.le.kk1))
then
325 if((kk1.lt.kstep).and.(kstep.le.kk2))
then
351 IF( (kstepr/kstep_c)*kstep_c .EQ. kstepr )
THEN
365 IF( c3 .GT. 0.0001d0 )
THEN
382 IF( timev .LE. tmcur(1) )
THEN
384 v0_contr(10) = ve8(1)
386 IF( timev .GE. tmcur(4) )
THEN
388 v0_contr(10) = ve8(4)
391 IF( (timev .GT. tmcur(1)) .AND. (timev .LT. tmcur(4)) )
THEN
393 IF((timev.GE.tmcur(i)).AND.(timev.LT.tmcur(i+1)))
THEN
394 v0_contr(3) = ( ve1(i) *(tmcur(i+1) - timev) +
395 * ve1(i+1)*(timev - tmcur(i) ) ) /
396 * (tmcur(i+1) - tmcur(i) )
397 v0_contr(10) = ( ve8(i) *(tmcur(i+1) - timev) +
398 * ve8(i+1)*(timev - tmcur(i) ) ) /
399 * (tmcur(i+1) - tmcur(i) )
409 c0 = tau_p(i)/tstep_c
412 c1 = 1.d0 / ( 1.d0 + c0 )
414 pfvol2(i) = c1*( c0*pfvol1(i) + c2*v_contr(i) + c3*v0_contr(i)
416 * + res_comp(i)*pfceqw(i)*aaa
417 * + res_extr(i)*(pfc_ref(i) - pfceqw(i)*aaa) )
440 101
FORMAT(2x,5e15.7)
446 22 dpfvdt(l) = ( pfvol2(l) - pfvol1(l) ) / tstep
452 volkp1(l) = pfvol2(l) * bbb
467 SUBROUTINE tramat( P, NJLIM, NC, NCPFC, NEQUI,
472 dimension
p(njlim,njlim)
479 ncequi = nc - ncpfc + nequi
488 IF( necon(j).EQ.l )
THEN
490 t(i) = t(i) +
p(i,j)*wecon(j)
501 p(i,nequi + j - ncpfc) =
p(i,j)
511 IF( necon(i).EQ.l )
THEN
513 t(j) = t(j) +
p(i,j)*wecon(i)
524 p(nequi + i - ncpfc,j) =
p(i,j)
535 SUBROUTINE travec (VINP, VOUT, NC, NCPFC, NEQUI, NECON, WECON)
539 dimension vinp(*), vout(*), wecon(*)
547 IF( necon(i).EQ.l )
THEN
548 t = t + vinp(i)*wecon(i)
554 vout(nequi+i-ncpfc) = vinp(i)
566 SUBROUTINE greta ( PJKP1, NCEQUI, PC )
573 dimension pjkp1(*), pc(*)
578 pfcw2(i) = pjkp1( nepfc(i) )
579 pfcur2(i) = pfcw2(i) * nturn(i)
580 pfcd2(i) = pfcur2(i) / ndiv(i)
589 DO 3 i=nequi+1,ncequi
590 pc( ncpfc+i-nequi ) = pjkp1(i)
602 SUBROUTINE printa( NOUT , NTER , KEYPRI, NGAV1 ,
603 * kstep , tstep , timev , knel ,
604 * betpol, zli3 , delbet, delzli,
605 * tokout, psiout, psibou, psidel,
606 * alf0 , alf1 , alf2 , bet0 , bet1 , bet2,
607 * rm , zm , rx0 , zx0 ,
608 * delrma, delzma, delrmb, delzmb,
609 * delrxp, delzxp, delrxb, delzxb,
610 * nctrl , alp , alpnew, numlim,
611 * fwcurr, bpcurr, vvcurr,
618 common /comus1/ rus1(nbndp2), zus1(nbndp2), nus1
619 common /comus2/ rus2(nbndp2), zus2(nbndp2), nus2
620 common /comlop/ rxb(nbndp2), zxb(nbndp2), nxb
622 common /equili/ bettot, rmx, zzrmx, rmn, zzrmn,
623 * zmx, rrzmx, zmn, rrzmn,
624 * r0cen, z0cen, radm, aspect,
625 * eupper, elower, delup, dellw, bfvakc
626 common /volpla/ vol_pl
629 pvolum = 2.d0*pi*vol_pl
631 IF( keypri.EQ.1 )
THEN
632 WRITE(nout,*)
'.............................................'
633 WRITE(nout,*)
' AFTER "EQ" TIME =',timev
634 WRITE(nout,*)
' KSTEP =',kstep ,
' KNEL =',knel
635 WRITE(nout,*)
' NGAV1 =',ngav1 ,
' NCTRL =',nctrl
636 WRITE(nout,*)
'.............................................'
638 WRITE(nout,*)
' BETPOL =',betpol,
' LI3 =',zli3
639 WRITE(nout,*)
' TOKOUT =',tokout,
' PSIout =',psiout
640 WRITE(nout,*)
' PSIdel =',psidel,
' PSIbou =',psibou
641 WRITE(nout,*)
' HELOUT =',helout
642 WRITE(nout,*)
' NUMLIM =',numlim
643 WRITE(nout,*)
' ALP =',alp ,
' ALPNEW =',alpnew
644 WRITE(nout,*)
' ALF0 =',alf0 ,
' BET0 =',bet0
645 WRITE(nout,*)
' ALF1 =',alf1 ,
' BET1 =',bet1
646 WRITE(nout,*)
' ALF2 =',alf2 ,
' BET2 =',bet2
647 WRITE(nout,*)
'.............................................'
648 WRITE(nout,*)
' Rax =',rm ,
' Zax =',zm
649 WRITE(nout,*)
' Rxp =',rx0 ,
' Zxp =',zx0
650 WRITE(nout,*)
' Rmax =',rmx ,
' ZRmax =',zzrmx
651 WRITE(nout,*)
' Rmin =',rmn ,
' ZRmin =',zzrmn
652 WRITE(nout,*)
' Zmax =',zmx ,
' RZmax =',rrzmx
653 WRITE(nout,*)
' Zmin =',zmn ,
' RZmin =',rrzmn
654 WRITE(nout,*)
' Aspect =',aspect,
' Rminor =',radm
655 WRITE(nout,*)
' Eupper =',eupper,
' Elower =',elower
656 WRITE(nout,*)
' Tupper =',delup ,
' Tlower =',dellw
698 IF( kstep .NE. 0 )
THEN
743 101
FORMAT(2x,5e14.7)
749 SUBROUTINE printb(NOUT , NTER , KEYPRI, KSTEP , TSTEP , TIMEV,
751 * betplx, ftok , psiax ,
752 * alf0 , alf1 , alf2 , bet0 , bet1 , bet2 )
756 common/comhel/ helinp, helout
759 IF( keypri.EQ.1 )
THEN
760 WRITE(nout,*)
'.............................................'
761 WRITE(nout,*)
' KSTEP =',kstep
762 WRITE(nout,*)
' TIME =',timev ,
' TSTEP =',tstep
763 WRITE(nout,*)
'.............................................'
791 SUBROUTINE eq_par( z0cen_e, alp_e, alpnew_e, qcen_e,
792 * nctrl_e, numlim_e, up_e,
793 * rm_e, zm_e, rx0_e, zx0_e )
800 common /equili/ bettot, rmx, zzrmx, rmn, zzrmn,
801 * zmx, rrzmx, zmn, rrzmn,
802 * r0cen, z0cen, radm, aspect,
803 * eupper, elower, delup, dellw, bfvakc
826 SUBROUTINE conduc( NC, NCEQUI, NCPFC, NFW, NBP, NVV,
827 * rc,zc, pc, vc,hc, ntype,
828 * rc1,zc1, rc2,zc2, rc3,zc3, rc4,zc4,
831 * nout, nter, ninfw, ngra1 )
840 dimension rc(*), zc(*), pc(*), vc(nclim), hc(nclim)
842 dimension rc1(*), zc1(*), rc2(*), zc2(*),
843 * rc3(*), zc3(*), rc4(*), zc4(*)
845 INTEGER necon(*), ntype(*)
848 dimension res(*), volk(*), volkp1(*)
851 INTEGER kdfw(nplim), kdbp(nplim), kdvv(nplim)
853 dimension rp1fw(nplim), zp1fw(nplim), rp2fw(nplim), zp2fw(nplim),
854 * rfwseg(nplim), cfwseg(nplim)
855 dimension rp1bp(nplim), zp1bp(nplim), rp2bp(nplim), zp2bp(nplim),
856 * rbpseg(nplim), cbpseg(nplim)
857 dimension rp1vv(nplim), zp1vv(nplim), rp2vv(nplim), zp2vv(nplim),
858 * rvvseg(nplim), cvvseg(nplim)
860 dimension rfw(nplim), zfw(nplim), dfw(nplim), hfw(nplim),
861 * resfw(nplim), curfw(nplim), ntyfw(nplim)
862 dimension rfw1(nplim), zfw1(nplim), rfw2(nplim), zfw2(nplim)
864 dimension rbp(nplim), zbp(nplim), dbp(nplim), hbp(nplim),
865 * resbp(nplim), curbp(nplim), ntybp(nplim)
866 dimension rbp1(nplim), zbp1(nplim), rbp2(nplim), zbp2(nplim)
868 dimension rvv(nplim), zvv(nplim), dvv(nplim), hvv(nplim),
869 * resvv(nplim), curvv(nplim), ntyvv(nplim)
870 dimension rvv1(nplim), zvv1(nplim), rvv2(nplim), zvv2(nplim)
874 bbb = 1.d0 / (2.d0*pi)
879 CALL
trecur( ncpfc, rc, zc, pc, ntype, necon, wecon,
880 * hc, vc, nout, nter )
888 res(l) = pfres(l) * bbb
889 1800 volk(l) = pfvol1(l) * bbb
897 CALL
trefw( nout, nter, ninfw, nsegfw,
898 * kdfw, rp1fw, zp1fw, rp2fw, zp2fw, rfwseg, cfwseg,
900 * rfw, zfw, dfw, hfw, resfw, curfw,
901 * rfw1, zfw1, rfw2, zfw2 )
918 ntype(nc+i) = ntyfw(i)
926 res(ncequi+i) = resfw(i) * bbb
927 volk(ncequi+i) = 0.00d0 * bbb
932 ncequi = ncequi + nfw
936 CALL
trebp( nout, nter, ninfw, nsegbp,
937 * kdbp, rp1bp, zp1bp, rp2bp, zp2bp, rbpseg, cbpseg,
939 * rbp, zbp, dbp, hbp, resbp, curbp,
940 * rbp1, zbp1, rbp2, zbp2 )
949 ntype(nc+i) = ntybp(i)
957 res(ncequi+i) = resbp(i) * bbb
958 volk(ncequi+i) = 0.00d0 * bbb
962 ncequi = ncequi + nbp
966 CALL
trevv( nout, nter, ninfw, nsegvv,
967 * kdvv, rp1vv, zp1vv, rp2vv, zp2vv, rvvseg, cvvseg,
969 * rvv, zvv, dvv, hvv, resvv, curvv,
970 * rvv1, zvv1, rvv2, zvv2 )
979 ntype(nc+i) = ntyvv(i)
987 res(ncequi+i) = resvv(i) * bbb
988 volk(ncequi+i) = 0.00d0 * bbb
992 ncequi = ncequi + nvv
1009 write(fname,
'(a,a)') path(1:kname),
'pascon.wr'
1010 open(1,file=fname,form=
'formatted')
1012 write(1,*) nc, ncpfc, nfw, nbp, nvv
1013 write(1,*) (rc(i), i=1,nc), (zc(i), i=1,nc)
REAL *8 function betind(NTYPE1, RC1, ZC1, VC1, HC1, NTYPE2, RC2, ZC2, VC2, HC2)
subroutine trevv(NOUT, NTER, NINFW, NP,
subroutine trefw(NOUT, NTER, NINFW, NP,
subroutine tramat(P, NJLIM, NC, NCPFC, NEQUI, NECON, WECON)
REAL *8 function greeni(R, Z, RP, ZP)
subroutine conduc(NC, NCEQUI, NCPFC, NFW, NBP, NVV, RC, ZC, PC, VC, HC, NTYPE, RC1, ZC1, RC2, ZC2, RC3, ZC3, RC4, ZC4, RES, VOLK, VOLKP1, NECON, WECON, NOUT, NTER, NINFW, ngra1)
subroutine eq_par(z0cen_e, alp_e, alpnew_e, qcen_e, nctrl_e, numlim_e, up_e, rm_e, zm_e, rx0_e, zx0_e)
subroutine trebp(NOUT, NTER, NINFW, NP,
REAL *8 function selind(NTYPE, RC, VC, HC)
subroutine travec(VINP, VOUT, NC, NCPFC, NEQUI, NECON, WECON)
subroutine differ(AOLD, ANEW, N, ERRLOC, ERRVEC, ABSMAX, ABSMIN, NOUT, NTER)
subroutine printb(NOUT, NTER, KEYPRI, KSTEP, TSTEP, TIMEV, NGAV1, NCTRL, BETPLX, FTOK, PSIAX, ALF0, ALF1, ALF2, BET0, BET1, BET2)
subroutine diftim(AK, AKP1S, AKP1N, N, ERRLOC, ERRVEC, ABSMAX, ABSMIN, NOUT, NTER)
subroutine difgeo(RM, ZM, RAXPR, ZAXPR, RMAOLD, ZMAOLD, DELAXA, DELAXR, NOUT, NTER)
real(r8) function p(a, x, xr, xs, yr, ys, psi, psir, F_dia)
subroutine gavpar(NOUT, NTER, KEYPRI, KSTEP, TSTEP, TIMEV, NCEQUI, VOLKP1, k_contr, tau_p, KSTEP_C, TSTEP_C, v_contr, v0_contr, v_prog, v_full, res_comp, res_extr, pfc_ref)
subroutine trecur(NCPFC, RI, ZI, PC, NTYPE, NECON, WECON, HORS, VERS, NPRI, NTER)
subroutine printa(NOUT, NTER, KEYPRI, NGAV1, KSTEP, TSTEP, TIMEV, KNEL, BETPOL, ZLI3, DELBET, DELZLI, TOKOUT, PSIOUT, PSIBOU, PSIDEL, ALF0, ALF1, ALF2, BET0, BET1, BET2, RM, ZM, RX0, ZX0, DELRMA, DELZMA, DELRMB, DELZMB, DELRXP, DELZXP, DELRXB, DELZXB, NCTRL, ALP, ALPNEW, NUMLIM, fwcurr, bpcurr, vvcurr, pvolum, helout)
subroutine greta(PJKP1, NCEQUI, PC)