13 include
'compol_add.inc'
20 if(psia(i).ge.0.05d0)
then
28 ro(nr,j)=ro(i_bc,j)*ronor(nr,j)
33 ro(i,j)=ro(iplas,j)*ronor(i,j)
41 delro=(robon-ropla)/(nr-iplas)
42 ro(i,j)=ropla+delro*(i-iplas)
43 ronor(i,j)=ro(i,j)/ropla
49 r(i,j)=ro(i,j)*cos(teta(j))+rm
50 z(i,j)=ro(i,j)*sin(teta(j))+zm
59 ronor(i,1)=ronor(i,nt1)
60 ronor(i,nt)=ronor(i,2)
77 if(r(nr,j).gt.rb_max) rb_max=r(nr,j)
78 if(r(nr,j).lt.rb_min) rb_min=r(nr,j)
79 if(z(nr,j).gt.zb_max) zb_max=z(nr,j)
80 if(z(nr,j).lt.zb_min) zb_min=z(nr,j)
89 * zb_min.lt.ymin )
then
92 write(*,*)
'eqq is large then rectangular box'
100 if(key_ang.eq.1)
then
103 teta(j)=tet0+2.d0*pi*(j-2)/(nt-2.d0)
105 teta(1)=teta(nt1)-2.d0*pi
106 teta(nt)=teta(2)+2.d0*pi
110 r(i,j)=ro(i,j)*cos(teta(j))+rm
111 z(i,j)=ro(i,j)*sin(teta(j))+zm
120 ronor(i,1)=ronor(i,nt1)
121 ronor(i,nt)=ronor(i,2)
144 parameter(ntp4=ntp+4,ntp6=ntp4*6)
146 common /com_sp3/ rrksp(ntp4),ccksp(ntp4)
148 include
'compol_add.inc'
150 dimension ron(ntp),rop(ntp),rn(ntp),zn(ntp),tetn(ntp)
151 dimension rob(ntp),teti(ntp),roi(ntp)
152 dimension roh(nrp),rh(nrp),zh(nrp)
153 dimension roplt(nrp,ntp)
154 dimension psiold(nrp,ntp)
186 c
write(6,*)
'rm,zm,psim',rm,zm,psim
188 call
axdef(rma,zma,psima,dp)
189 c
write(6,*)
'rma,zma,psima',rma,zma,psima
192 rm=rma*alfa+rmold*(1.0d0-alfa)
193 zm=zma*alfa+zmold*(1.0d0-alfa)
196 erro=dsqrt((rmold-rm)**2+(zmold-zm)**2)
199 write(*,*)
'erro mag.axix',erro
207 call
f_xpoint(rx1,zx1,ixp1,jxp1,psix1,tetx1,kodex1)
209 call
f_xpoint(rx2,zx2,ixp2,jxp2,psix2,tetx2,kodex2)
212 write(*,*)
'kodex1,kodex2',kodex1,kodex2
216 if(kodex1.eq.0 .AND. kodex2.eq.0)
then
217 if(psix1.ge.psix2)
then
226 elseif(kodex1.eq.0)
then
230 elseif(kodex2.eq.0)
then
235 errox=dsqrt((rxold-rx0)**2+(zxold-zx0)**2)
237 write(*,*)
'erro x-point',errox
239 c
write(*,*)
'rx zx',rx0,zx0,psix0
241 psip=psim-alp*(psim-psix0)
245 call
fdefln(psiblm,rblm(llim),zblm(llim))
246 if(psiblm.gt.psip )
then
261 psin(i,j)=(psi(i,j)-psip)/(psim-psip)
262 delpsn=dabs(psin(i,j)-psnn)
264 if(delpsn.gt.errpsi)
then
275 write(6,*)
'i,j errpsi',ierm,jerm,errpsi,(psim-psip)
279 cc definition of new angle
grid teta(j)
290 rob(j)=sqrt(drx**2+dzx**2)
291 teta(j)=atan(dzx/drx)
297 if(teta(j).lt.teta(j-1))
then
301 if(teta(j).lt.teta(j-1))
then
308 teta(1)=teta(nt1)-2.d0*pi
309 teta(nt)=teta(2)+2.d0*pi
335 ccc
grid moving along rais
353 if(zps.le.ps0 .and. zps.ge.pspl)
then
354 zro=((pspl-zps)*ro0-(ps0-zps)*ropl)/(pspl-ps0)
382 ron(j)=zro*alfa+ro(i,j)*(1.d0-alfa)
389 rnj=rmold+ron(j)*cos(tetn(j))
390 znj=zmold+ron(j)*sin(tetn(j))
395 roi(j)=sqrt(drx**2+dzx**2)
396 teti(j)=atan(dzx/drx)
402 if(teti(j).lt.teti(j-1))
then
406 if(teti(j).lt.teti(j-1))
then
413 teti(1)=teti(nt1)-2.d0*pi
414 teti(nt)=teti(2)+2.d0*pi
424 if(tetv.lt.teti(1)) tetv=tetv+2.d0*pi
425 if(tetv.gt.teti(nt)) tetv=tetv-2.d0*pi
438 if(tetv.le.ttpl .and. tetv.ge.tt0)
then
439 zro=((ttpl-tetv)*ro0+(tetv-tt0)*ropl)/(ttpl-tt0)
449 roerr=dabs(ron(j)-ro(i,j))
450 if(roerr.gt.erro)
then
456 roplt(i,j)=ron(j)-ro(i,j)
459 r(i,j)=rop(j)*cos(teta(j))+rm
460 z(i,j)=rop(j)*sin(teta(j))+zm
467 write(*,*)
'erro max.',erro
468 write(*,*)
'i,j erro',ierm,jerm,erro
475 ro(i,j)=dsqrt((r(i,j)-rm)**2+(z(i,j)-zm)**2)
495 spro=ro(nr,j)-ro(iplas-1,j)
497 droj=ro(iplas,j)-ro(iplas-1,j)
498 cpro=
cpr(droj,npro,spro)
507 rh(i)=rm+row*cos(teta(j))
508 zh(i)=zm+row*sin(teta(j))
520 if(row.le.ropl .and. row.ge.ro0)
then
535 psia(i)=( ps1*(ro2-row)+ps2*(row-ro1) )/(ro2-ro1)
541 roerr=dabs(roh(i)-ro(i,j))
542 erro=dmax1(erro,roerr)
546 r(i,j)=roh(i)*cos(teta(j))+rm
547 z(i,j)=roh(i)*sin(teta(j))+zm
558 ronor(i,j)=ro(i,j)/ro(iplas,j)
568 ronor(i,1)=ronor(i,nt1)
569 ronor(i,nt)=ronor(i,2)
577 roplt(i,1)=roplt(i,nt1)
578 roplt(i,nt)=roplt(i,2)
593 psiold(i,j)=psip+psin(i,j)*(psim-psip)
624 include
'compol_add.inc'
633 if(psi(i,j).gt.psimax)
then
668 parameter(nshp=ntp+1)
671 include
'compol_add.inc'
673 dimension ron(ntp),rop(ntp),rn(ntp),zn(ntp),tetn(ntp)
674 dimension rob(ntp),teti(ntp),roi(ntp)
675 dimension xs(nshp),ys(nshp),
fun(nshp),dp(5)
676 dimension roh(nrp),rh(nrp),zh(nrp)
677 dimension roplt(nrp,ntp)
678 dimension psiold(nrp,ntp)
690 write(17,*)
'prgrid:::'
710 fun(nsh)=psi(imax,jmax)
719 elseif(imax.eq.2)
then
738 if(i.ne.imax .OR. j.ne.jmax)
then
755 det = dp(3)*dp(5) - dp(4)**2
756 rm = xs(1) + ( dp(2)*dp(4) - dp(1)*dp(5) )/det
757 zm = ys(1) + ( dp(1)*dp(4) - dp(2)*dp(3) )/det
759 erro=dsqrt( (rm-rm0)**2+(zm-zm0)**2 )
764 psim=
fun(1)+ dp(1)*(rm-rmx) + dp(2)*(zm-zmx)
765 + + 0.5d0*dp(3)*(rm-rmx)*(rm-rmx)
766 + + dp(4)*(rm-rmx)*(zm-zmx)
767 + + 0.5d0*dp(5)*(zm-zmx)*(zm-zmx)
770 write(*,*)
'rm zm psim',rm,zm,psim
771 write(*,*)
'prgrid:errma',erro
782 call
f_xpoint(rx1,zx1,ixp1,jxp1,psix1,tetx1,kodex1)
784 call
f_xpoint(rx2,zx2,ixp2,jxp2,psix2,tetx2,kodex2)
787 write(*,*)
'kodex1,kodex2',kodex1,kodex2
794 write(*,*)
' all x-points out of box'
795 write(*,*)
' only limiter case '
807 if(kodex1.eq.0 .AND. kodex2.eq.0)
then
808 if(psix1.ge.psix2)
then
817 elseif(kodex1.eq.0)
then
821 elseif(kodex2.eq.0)
then
826 errox=dsqrt((rxold-rx0)**2+(zxold-zx0)**2)
828 write(*,*)
'erro x-point',errox
830 c
write(6,*)
'rx zx',rx0,zx0,psix0
832 psip=psim-alp*(psim-psix0)
835 psipr=zwgt*psip+(1.d0-zwgt)*psipn
836 psip=dmax1(psip,psipr)
843 call
fdefln(psiblm,rblm(llim),zblm(llim))
844 if(psiblm.gt.psip )
then
851 write(*,*)
'numlim',numlim
863 psin(i,j)=(psi(i,j)-psip)/(psim-psip)
864 delpsn=dabs(psin(i,j)-psnn)
866 if(delpsn.gt.errpsi)
then
887 robj=sqrt(drx**2+dzx**2)
899 if(teta(j).lt.teta(j-1))
then
900 teta(j)=teta(j)+2.d0*pi
903 if(teta(j).lt.teta(j-1))
then
904 teta(j)=teta(j)+2.d0*pi
909 teta(1)=teta(nt1)-2.d0*pi
910 teta(nt)=teta(2)+2.d0*pi
912 ccc
grid moving along rais
917 if(psia(i).lt.psinm0)
then
934 if(zps.le.ps0 .and. zps.ge.pspl)
then
942 grad=-(pspl-ps0)/(ropl-ro0)
944 zro=ro0-(psia(i)-ps0)/grad
950 rnj=rm0+ron(j)*cos(tetn(j))
951 znj=zm0+ron(j)*sin(tetn(j))
956 roi(j)=sqrt(drx**2+dzx**2)
957 tetp=acos(drx/roi(j))
968 if(teti(j).lt.teti(j-1))
then
969 teti(j)=teti(j)+2.d0*pi
972 if(teti(j).lt.teti(j-1))
then
973 teti(j)=teti(j)+2.d0*pi
978 teti(1)=teti(nt1)-2.d0*pi
979 teti(nt)=teti(2)+2.d0*pi
988 if(tetv.lt.teti(1)) tetv=tetv+2.d0*pi
989 if(tetv.lt.teti(1)) tetv=tetv+2.d0*pi
990 if(tetv.gt.teti(nt)) tetv=tetv-2.d0*pi
991 if(tetv.gt.teti(nt)) tetv=tetv-2.d0*pi
1001 if(tetv.le.ttpl .and. tetv.ge.tt0)
then
1002 zro=((ttpl-tetv)*ro0+(tetv-tt0)*ropl)/(ttpl-tt0)
1011 r(i,j)=rop(j)*cos(teta(j))+rm
1012 z(i,j)=rop(j)*sin(teta(j))+zm
1023 ps0=psip+zps*(psim-psip)
1028 ro2j=(ps0-psim)/( 0.5d0*dp(3)*cos(ttj)**2
1029 + + dp(4)*cos(ttj)*sin(ttj)
1030 + + 0.5d0*dp(5)*sin(ttj)**2 )
1036 r(i,j)=rm+rop(j)*cos(teta(j))
1037 z(i,j)=zm+rop(j)*sin(teta(j))
1047 ros1=(r(2,j)-rm)**2+(z(2,j)-zm)**2
1048 ros2=(r(ibeg,j)-rm)**2+(z(ibeg,j)-zm)**2
1055 rosi=( (psa2-psai)*ros1+(psai-psa1)*ros2 )/(psa2-psa1)
1058 r(i,j)=rm+rosi*cos(teta(j))
1059 z(i,j)=zm+rosi*sin(teta(j))
1070 ro(i,j)=dsqrt((r(i,j)-rm)**2+(z(i,j)-zm)**2)
1082 spro=rob(j)-ro(iplas-1,j)
1084 droj=ro(iplas,j)-ro(iplas-1,j)
1088 dro=(rob(j)-ro(iplas,j))/(nr-iplas)
1090 do 220 i=iplas+1,nr1
1095 rh(i)=rm+row*cos(teta(j))
1096 zh(i)=zm+row*sin(teta(j))
1108 if(row.le.ropl .and. row.ge.ro0)
then
1123 psia(i)=( ps1*(ro2-row)+ps2*(row-ro1) )/(ro2-ro1)
1127 do 250 i=iplas+1,nr1
1129 roerr=dabs(roh(i)-ro(i,j))
1130 erro=dmax1(erro,roerr)
1134 r(i,j)=roh(i)*cos(teta(j))+rm
1135 z(i,j)=roh(i)*sin(teta(j))+zm
1166 roplt(i,1)=roplt(i,nt1)
1167 roplt(i,nt)=roplt(i,2)
1181 psiold(i,j)=psip+psin(i,j)*(psim-psip)
1197 include
'double.inc'
1198 include
'parevo.inc'
1199 parameter(nkp=njlim)
1202 include
'compol.inc'
1203 include
'compol_add.inc'
1205 dimension ron(ntp),rop(ntp),rn(ntp),zn(ntp),tetn(ntp)
1206 dimension rob(ntp),teti(ntp),roi(ntp)
1207 dimension roplt(nrp,ntp)
1209 dimension roh(nrp),rh(nrp),zh(nrp)
1210 dimension psiold(nrp,ntp)
1239 psi(i,j)=alfa*psi(i,j)+(1.d0-alfa)*psiold(i,j)
1250 write(*,*)
'rm,zm,psim',rm,zm,psim
1252 call
axdef(rma,zma,psima,dp)
1255 write(*,*)
'rma,zma,psima',rma,zma,psima
1261 erro=dsqrt((rmold-rm)**2+(zmold-zm)**2)
1264 write(*,*)
'erro mag.axis',erro
1274 call
f_xpoint(rx1,zx1,ixp1,jxp1,psix1,tetx1,kodex1)
1276 call
f_xpoint(rx2,zx2,ixp2,jxp2,psix2,tetx2,kodex2)
1279 write(*,*)
'kodex1,kodex2',kodex1,kodex2
1286 write(*,*)
' all x-points out of box'
1287 write(*,*)
' only limiter case '
1297 if(kodex1.eq.0 .AND. kodex2.eq.0)
then
1298 if(psix1.ge.psix2)
then
1307 elseif(kodex1.eq.0)
then
1311 elseif(kodex2.eq.0)
then
1317 errox=dsqrt((rxold-rx0)**2+(zxold-zx0)**2)
1319 write(*,*)
'erro x-point',errox
1320 write(*,*)
'rx zx',rx0,zx0,psix0
1323 psip=psim-alp*(psim-psix0)
1331 call
fdefln(psiblm,rblm(llim),zblm(llim))
1333 if(psiblm.gt.psip)
then
1341 write(*,*)
'numlim',numlim
1351 psin(i,j)=(psi(i,j)-psip)/(psim-psip)
1352 delpsn=dabs(psin(i,j)-psnn)
1354 if(delpsn.gt.errpsi)
then
1366 write(*,*)
'i,j errpsi',ierm,jerm,errpsi,(psim-psip)
1368 cc definition of new angle
grid teta(j)
1379 robj=sqrt(drx**2+dzx**2)
1382 if(dzx.lt.0.d0)
then
1392 if(teta(j).lt.teta(j-1))
then
1393 teta(j)=teta(j)+2.d0*pi
1396 if(teta(j).lt.teta(j-1))
then
1397 teta(j)=teta(j)+2.d0*pi
1402 teta(1)=teta(nt1)-2.d0*pi
1403 teta(nt)=teta(2)+2.d0*pi
1410 ps0=psip+zps*(psim-psip)
1416 ro2j=(ps0-psim)/( 0.5d0*dp(3)*cos(ttj)**2
1417 + + dp(4)*cos(ttj)*sin(ttj)
1418 + + 0.5d0*dp(5)*sin(ttj)**2 )
1422 r(i,j)=rm+rop(j)*cos(teta(j))
1423 z(i,j)=zm+rop(j)*sin(teta(j))
1429 ccc
grid moving along rais
1447 if(zps.le.ps0 .and. zps.ge.pspl)
then
1448 zro=((pspl-zps)*ro0-(ps0-zps)*ropl)/(pspl-ps0)
1463 rnj=rmold+ron(j)*cos(tetn(j))
1464 znj=zmold+ron(j)*sin(tetn(j))
1469 roi(j)=sqrt(drx**2+dzx**2)
1470 tetp=acos(drx/roi(j))
1471 if(dzx.lt.0.d0)
then
1481 if(teti(j).lt.teti(j-1))
then
1482 teti(j)=teti(j)+2.d0*pi
1485 if(teti(j).lt.teti(j-1))
then
1486 teti(j)=teti(j)+2.d0*pi
1491 teti(1)=teti(nt1)-2.d0*pi
1492 teti(nt)=teti(2)+2.d0*pi
1501 if(tetv.lt.teti(1)) tetv=tetv+2.d0*pi
1502 if(tetv.lt.teti(1)) tetv=tetv+2.d0*pi
1503 if(tetv.gt.teti(nt)) tetv=tetv-2.d0*pi
1504 if(tetv.gt.teti(nt)) tetv=tetv-2.d0*pi
1516 if(tetv.le.ttpl .and. tetv.ge.tt0)
then
1517 zro=((ttpl-tetv)*ro0+(tetv-tt0)*ropl)/(ttpl-tt0)
1528 roerr=dabs(ron(j)-ro(i,j))
1530 if(roerr.gt.erro)
then
1536 roplt(i,j)=ron(j)-ro(i,j)
1538 r(i,j)=rop(j)*cos(teta(j))+rm
1539 z(i,j)=rop(j)*sin(teta(j))+zm
1546 write(*,*)
'erro max.',erro
1547 write(*,*)
'i,j erro',ierm,jerm,erro
1553 ro(i,j)=dsqrt((r(i,j)-rm)**2+(z(i,j)-zm)**2)
1554 ronor(i,j)=ro(i,j)/rob(j)
1564 spro=rob(j)-ro(iplas-1,j)
1566 droj=ro(iplas,j)-ro(iplas-1,j)
1567 cpro=
cpr(droj,npro,spro)
1571 do 220 i=iplas+1,nr1
1576 rh(i)=rm+row*cos(teta(j))
1577 zh(i)=zm+row*sin(teta(j))
1589 if(row.le.ropl .and. row.ge.ro0)
then
1604 psia(i)=( ps1*(ro2-row)+ps2*(row-ro1) )/(ro2-ro1)
1608 do 250 i=iplas+1,nr1
1610 roerr=dabs(roh(i)-ro(i,j))
1611 erro=dmax1(erro,roerr)
1615 r(i,j)=roh(i)*cos(teta(j))+rm
1616 z(i,j)=roh(i)*sin(teta(j))+zm
1636 ronor(i,j)=ro(i,j)/ro(iplas,j)
1647 ronor(i,1)=ronor(i,nt1)
1648 ronor(i,nt)=ronor(i,2)
1656 roplt(i,1)=roplt(i,nt1)
1657 roplt(i,nt)=roplt(i,2)
1671 psiold(i,j)=psip+psin(i,j)*(psim-psip)
1686 include
'double.inc'
1687 include
'parevo.inc'
1688 parameter(nkp=njlim)
1691 include
'compol.inc'
1692 include
'compol_add.inc'
1694 dimension ron(ntp),rop(ntp),rn(ntp),zn(ntp),tetn(ntp)
1695 dimension rob(ntp),teti(ntp),roi(ntp)
1696 dimension roplt(nrp,ntp)
1698 dimension roh(nrp),rh(nrp),zh(nrp)
1699 dimension psiold(nrp,ntp)
1740 write(*,*)
'rm,zm,psim',rm,zm,psim
1743 call
axdef(rma,zma,psima,dp)
1746 write(*,*)
'rma,zma,psima',rma,zma,psima
1753 erro=dsqrt((rmold-rm)**2+(zmold-zm)**2)
1756 write(*,*)
'erro mag.axis',erro
1767 call
f_xpoint(rx1,zx1,ixp1,jxp1,psix1,tetx1,kodex1)
1769 call
f_xpoint(rx2,zx2,ixp2,jxp2,psix2,tetx2,kodex2)
1772 write(*,*)
'kodex1,kodex2',kodex1,kodex2
1779 write(*,*)
' all x-points out of box'
1780 write(*,*)
' only limiter case '
1792 if(kodex1.eq.0 .AND. kodex2.eq.0)
then
1793 if(psix1.ge.psix2)
then
1802 elseif(kodex1.eq.0)
then
1806 elseif(kodex2.eq.0)
then
1812 errox=dsqrt((rxold-rx0)**2+(zxold-zx0)**2)
1814 write(*,*)
'erro x-point',errox
1815 write(*,*)
'rx zx',rx0,zx0,psix0
1818 psip=psim-alp*(psim-psix0)
1822 psipr=zwgt*psip+(1.d0-zwgt)*psipn
1823 psip=dmax1(psip,psipr)
1824 alp_pr=(psim-psip)/(psim-psix0)
1833 call
fdefln(psiblm,rblm(llim),zblm(llim))
1835 if(psiblm.gt.psip)
then
1843 write(*,*)
'numlim',numlim
1854 psin(i,j)=(psi(i,j)-psip)/(psim-psip)
1855 delpsn=dabs(psin(i,j)-psnn)
1857 if(delpsn.gt.errpsi)
then
1869 write(*,*)
'i,j errpsi',ierm,jerm,errpsi,(psim-psip)
1872 cc definition of new angle
grid teta(j)
1883 robj=sqrt(drx**2+dzx**2)
1886 if(dzx.lt.0.d0)
then
1896 if(teta(j).lt.teta(j-1))
then
1897 teta(j)=teta(j)+2.d0*pi
1900 if(teta(j).lt.teta(j-1))
then
1901 teta(j)=teta(j)+2.d0*pi
1906 teta(1)=teta(nt1)-2.d0*pi
1907 teta(nt)=teta(2)+2.d0*pi
1914 ps0=psip+zps*(psim-psip)
1920 ro2j=(ps0-psim)/( 0.5d0*dp(3)*cos(ttj)**2
1921 + + dp(4)*cos(ttj)*sin(ttj)
1922 + + 0.5d0*dp(5)*sin(ttj)**2 )
1926 r(i,j)=rm+rop(j)*cos(teta(j))
1927 z(i,j)=zm+rop(j)*sin(teta(j))
1933 ccc
grid moving along rais
1951 if(zps.le.ps0 .and. zps.ge.pspl)
then
1952 zro=((pspl-zps)*ro0-(ps0-zps)*ropl)/(pspl-ps0)
1967 rnj=rmold+ron(j)*cos(tetn(j))
1968 znj=zmold+ron(j)*sin(tetn(j))
1973 roi(j)=sqrt(drx**2+dzx**2)
1974 tetp=acos(drx/roi(j))
1975 if(dzx.lt.0.d0)
then
1985 if(teti(j).lt.teti(j-1))
then
1986 teti(j)=teti(j)+2.d0*pi
1989 if(teti(j).lt.teti(j-1))
then
1990 teti(j)=teti(j)+2.d0*pi
1995 teti(1)=teti(nt1)-2.d0*pi
1996 teti(nt)=teti(2)+2.d0*pi
2005 if(tetv.lt.teti(1)) tetv=tetv+2.d0*pi
2006 if(tetv.lt.teti(1)) tetv=tetv+2.d0*pi
2007 if(tetv.gt.teti(nt)) tetv=tetv-2.d0*pi
2008 if(tetv.gt.teti(nt)) tetv=tetv-2.d0*pi
2020 if(tetv.le.ttpl .and. tetv.ge.tt0)
then
2021 zro=((ttpl-tetv)*ro0+(tetv-tt0)*ropl)/(ttpl-tt0)
2032 roerr=dabs(ron(j)-ro(i,j))
2034 if(roerr.gt.erro)
then
2040 roplt(i,j)=ron(j)-ro(i,j)
2042 r(i,j)=rop(j)*cos(teta(j))+rm
2043 z(i,j)=rop(j)*sin(teta(j))+zm
2050 write(6,*)
'erro max.',erro
2051 write(6,*)
'i,j erro',ierm,jerm,erro
2057 ro(i,j)=dsqrt((r(i,j)-rm)**2+(z(i,j)-zm)**2)
2058 ronor(i,j)=ro(i,j)/rob(j)
2068 spro=rob(j)-ro(iplas-1,j)
2070 droj=ro(iplas,j)-ro(iplas-1,j)
2073 dro=(rob(j)-ro(iplas,j))/(nr-iplas)
2075 do 220 i=iplas+1,nr1
2080 rh(i)=rm+row*cos(teta(j))
2081 zh(i)=zm+row*sin(teta(j))
2093 if(row.le.ropl .and. row.ge.ro0)
then
2108 psia(i)=( ps1*(ro2-row)+ps2*(row-ro1) )/(ro2-ro1)
2112 do 250 i=iplas+1,nr1
2114 roerr=dabs(roh(i)-ro(i,j))
2115 erro=dmax1(erro,roerr)
2119 r(i,j)=roh(i)*cos(teta(j))+rm
2120 z(i,j)=roh(i)*sin(teta(j))+zm
2140 ronor(i,j)=ro(i,j)/ro(iplas,j)
2151 ronor(i,1)=ronor(i,nt1)
2152 ronor(i,nt)=ronor(i,2)
2160 roplt(i,1)=roplt(i,nt1)
2161 roplt(i,nt)=roplt(i,2)
2175 psiold(i,j)=psip+psin(i,j)*(psim-psip)
2189 include
'double.inc'
2191 include
'parevo.inc'
2192 parameter(nkp=njlim)
2194 include
'compol.inc'
2195 include
'parrc1.inc'
2196 include
'comrec.inc'
2197 include
'compol_add.inc'
2212 if(psia(i).ge.0.05d0)
then
2220 ro(nr,j)=ro(i_bc,j)*ronor(nr,j)
2233 delro=(robon-ropla)/(nr-iplas)
2234 ro(i,j)=ropla+delro*(i-iplas)
2235 ronor(i,j)=ro(i,j)/ropla
2241 r(i,j)=ro(i,j)*cos(teta(j))+rm
2242 z(i,j)=ro(i,j)*sin(teta(j))+zm
2251 ronor(i,1)=ronor(i,nt1)
2252 ronor(i,nt)=ronor(i,2)
2269 if(r(nr,j).gt.rb_max) rb_max=r(nr,j)
2270 if(r(nr,j).lt.rb_min) rb_min=r(nr,j)
2271 if(z(nr,j).gt.zb_max) zb_max=z(nr,j)
2272 if(z(nr,j).lt.zb_min) zb_min=z(nr,j)
2281 * zb_min.lt.ymin )
then
2284 write(*,*)
'egg is large then rectangular box'
2318 include
'double.inc'
2320 include
'parevo.inc'
2321 parameter(nkp=njlim)
2324 parameter(ntp4=ntp+4,ntp6=ntp4*6)
2325 include
'parrc1.inc'
2327 include
'compol.inc'
2328 include
'compol_add.inc'
2329 include
'comrec.inc'
2330 common /com_sp3/ rrksp(ntp4),ccksp(ntp4)
2332 dimension xs(nshp),ys(nshp),
fun(nshp),dp(5)
2337 frbon(r0,as,tr,tet,skv)=
2338 * r0+(r0/as)*dcos(tet+tr*dsin(tet)-skv*dsin(2.d0*tet))
2339 fzbon(r0,z0,as,el,tet)=z0+(r0/as)*el*dsin(tet)
2349 psia(i)=(iplas-i)/(iplas-1.d0)
2356 elseif(igdf.eq.1 .OR. igdf.eq.2)
then
2359 psia(i)=1.d0-((i-1)/(iplas-1.d0))**2
2363 dpsda(i)=(1-2*i)/(iplas-1.d0)
2375 teta(j)=teta(j-1)+dtet
2379 teta(1)=teta(nt1)-2.d0*pi
2380 teta(nt)=teta(2)+2.d0*pi
2404 write(fname,
'(a,a)') path(1:kname),
'shegg.dat'
2427 tri=0.5d0*(tr_up+tr_lw+(tr_up-tr_lw)*sin(tet))
2428 ell=0.5d0*(el_up+el_lw+(el_up-el_lw)*sin(tet))
2429 rrr=frbon(rc0,asp0,tri,tet,skv)
2431 zzz=fzbon(rc0,zc0,asp0,ell,tet)
2440 teta(j)=atan(dzx/drx)
2445 if(teta(j).lt.teta(j-1))
then
2449 if(teta(j).lt.teta(j-1))
then
2455 teta(1)=teta(nt1)-2.d0*pi
2456 teta(nt)=teta(2)+2.d0*pi
2464 fun(nsh)=u(imax,jmax)
2474 if(ii.ne.imax .OR. jj.ne.jmax)
then
2489 stpx=(x(imax+1)-x(imax))
2490 stpy=(y(jmax+1)-y(jmax))
2500 ro2j=(ur0-um)/( 0.5d0*dp(3)*cos(ttj)**2
2501 + + dp(4)*cos(ttj)*sin(ttj)
2502 + + 0.5d0*dp(5)*sin(ttj)**2 )
2507 r(i,j)=rm+ron(j)*cos(teta(j))
2508 z(i,j)=zm+ron(j)*sin(teta(j))
2519 write(6,*)
'ro(1)',ro(i,1),ro(i,2),stpx,stpy
2522 if( ron(2) .GT. dmax1(stpx,stpy) ) go to 2799
2540 r(i,j)=rm+ron(j)*cos(teta(j))
2541 z(i,j)=zm+ron(j)*sin(teta(j))
2563 droj=sqrt( (r(iplas,j)-r(iplas-1,j))**2+
2564 + (z(iplas,j)-z(iplas-1,j))**2 )
2565 delbn=sqrt( (r(nr,j)-r(iplas,j))**2+
2566 + (z(nr,j)-z(iplas,j))**2 )
2568 cpro=
cpr(droj,npro,delbn+droj)
2577 r(i,j)=rm+row*cos(teta(j))
2578 z(i,j)=zm+row*sin(teta(j))
2600 teta(1)=teta(nt1)-2.d0*pi
2601 teta(nt)=teta(2)+2.d0*pi
2618 include
'double.inc'
2619 include
'parevo.inc'
2620 parameter(nkp=njlim)
2622 parameter(ntp4=ntp+4,ntp6=ntp4*6)
2624 common /com_sp3/ rrksp(ntp4),ccksp(ntp4)
2625 include
'compol.inc'
2626 include
'compol_add.inc'
2628 dimension ron(nrp),rn(nrp),zn(nrp)
2633 xzer(x1,x2,v1,v2) = (x1*v2-x2*v1)/(v2-v1)
2644 call
f_xpoint(rx1,zx1,ixp1,jxp1,psix1,tetx1,kodex1)
2647 write(*,*)
'kodex1',kodex1
2648 write(*,*)
'rx1 zx1',rx1,zx1,psix1
2651 call
f_xpoint(rx2,zx2,ixp2,jxp2,psix2,tetx2,kodex2)
2654 write(*,*)
'kodex2',kodex2
2655 write(*,*)
'rx2 zx2',rx2,zx2,psix2
2662 write(*,*)
' all x-points out of box'
2663 write(*,*)
' only limiter case '
2674 if(kodex1.eq.0 .AND. kodex2.eq.0)
then
2675 if(psix1.gt.psix2)
then
2684 elseif(kodex1.eq.0)
then
2688 elseif(kodex2.eq.0)
then
2695 write(*,*)
'kodex1,kodex2',kodex1,kodex2
2696 write(*,*)
'rx zx',rx0,zx0,psix0
2700 if(ngav/10*10.eq.ngav)
then
2701 psip=psim-alp*(psim-psix0)
2703 psip=psi(iplas,jrolim)
2711 call
fdefln(psiblm,rblm(llim),zblm(llim))
2712 if(psiblm.gt.psip )
then
2719 alpnew=(psim-psip)/(psim-psix0)
2724 psin(i,j)=(psi(i,j)-psip)/(psim-psip)
2730 write(*,*)
'ada:nctrli,nctrl',nctrli,nctrl
2731 write(*,*)
'ada:alpnew,numlim',alpnew,numlim
2749 if(zps.le.ps0 .and. zps.ge.pspl)
then
2758 grad=-(pspl-ps0)/(ropl-ro0)
2762 gradpl=-(pspl-ps0)/(ropl-ro0)
2763 gradmn=-(ps0-psmn)/(ro0-romn)
2764 grad=dmax1(gradpl,gradmn)
2767 grad=-(pspl-ps0)/(ropl-ro0)
2769 zro=ro0-(zps-ps0)/grad
2787 ron(i)=alfa*zro+(1.d0-alfa)*ro(i,j)
2790 if(ron(i).lt.ron(i-1))
then
2791 ron(i)=ron(i-1)+1.d-8
2793 write(*,*)
'grid crash i,j',i,j
2800 if(ngav.gt.0 .AnD. j.eq.jrolim .AnD. kpr.eq.1)
then
2801 write(*,*)
'ro(iplas),rolim',ron(iplas),rolim
2804 spro=ro(nr,j)-ron(iplas-1)
2806 droj=ron(iplas)-ron(iplas-1)
2810 dro=(ro(nr,j)-row)/(nr-iplas)
2812 do 220 i=iplas+1,nr1
2817 rn(i)=rm+row*cos(teta(j))
2818 zn(i)=zm+row*sin(teta(j))
2832 if(row.le.ropl .and. row.ge.ro0)
then
2848 psia(i)=( ps1*(ro2-row)+ps2*(row-ro1) )/(ro2-ro1)
2854 roerr=dabs(ron(i)-ro(i,j))
2855 erro=dmax1(erro,roerr)
2859 r(i,j)=ron(i)*cos(teta(j))+rm
2860 z(i,j)=ron(i)*sin(teta(j))+zm
2871 teta(1)=teta(nt1)-2.d0*pi
2872 teta(nt)=teta(2)+2.d0*pi
2882 ronor(i,j)=ro(i,j)/ro(iplas,j)
2890 ronor(i,1)=ronor(i,nt1)
2891 ronor(i,nt)=ronor(i,2)
2899 psin(i,1)=psin(i,nt1)
2900 psin(i,nt)=psin(i,2)
2908 psi(i,j)=psip+psin(i,j)*(psim-psip)
2921 include
'double.inc'
2922 include
'parevo.inc'
2923 parameter(nkp=njlim)
2925 include
'compol.inc'
2926 include
'compol_add.inc'
2940 rob(j)=sqrt(drx**2+dzx**2)
2943 tetp=dacos(drx/rob(j))
2944 if(dzx.lt.0.d0)
then
2956 if(teta(j).lt.teta(j-1))
then
2960 if(teta(j).lt.teta(j-1))
then
2965 teta(1)=teta(nt1)-2.d0*pi
2966 teta(nt)=teta(2)+2.d0*pi
2972 ro(i,j)=ro(i,j)*rob(j)/ro(nr,j)
2973 r(i,j)=rm+ro(i,j)*cos(teta(j))
2974 z(i,j)=zm+ro(i,j)*sin(teta(j))
2978 if(ngav/10*10.ne.ngav)
then
2979 ro(iplas,jrolim)=rolim
2980 r(iplas,jrolim)=rm+ro(iplas,jrolim)*cos(teta(jrolim))
2981 z(iplas,jrolim)=zm+ro(iplas,jrolim)*sin(teta(jrolim))
2992 include
'double.inc'
2993 include
'parevo.inc'
2994 parameter(nkp=njlim)
2996 include
'compol.inc'
2997 include
'compol_add.inc'
2999 sqrt(arg)=dsqrt(arg)
3006 ro0=sqrt(dr0**2+dz0**2)
3009 if(dz0.lt.0.d0)
then
3015 if(tet0.lt.teta(1)) tet0=tet0+2.d0*pi
3016 if(tet0.gt.teta(nt)) tet0=tet0-2.d0*pi
3020 if(tet0.ge.teta(j) .AND. tet0.lt.teta(j+1)) jc=j
3028 ropl2=ro(iplas,jc+1)
3033 rob12=(rob1*(tet2-tet0)+rob2*(tet0-tet1))/(tet2-tet1)
3034 ropl12=(ropl1*(tet2-tet0)+ropl2*(tet0-tet1))/(tet2-tet1)
3036 if(ro0.lt.rob12)
then
3043 ro12=(ro1*(tet2-tet0)+ro2*(tet0-tet1))/(tet2-tet1)
3045 if(ro0.lt.ro12) ic=i-1
3051 if(ic.gt.iplas)
then
3052 do i=ic+1,iplas-1,-1
3053 der_psi=psi(i,jc)-psi(i-1,jc)
3054 if(der_psi.gt.0.d0)
then
3061 if(i_rlmp.eq.1)
then
3074 * tet1,tet2,ro1,ro2,ro3,ro4,u1,u2,u3,u4)
3093 call
bint(rr,zz,r0,z0,r1,z1,fint,1)
3095 psidf=psidf-fint*(dgdn(j)+dgdn(j+1))*0.5d0
3113 include
'double.inc'
3114 include
'parevo.inc'
3115 parameter(nkp=njlim)
3117 parameter(ntp4=ntp+4,ntp6=ntp4*6)
3118 common /com_sp3/ rrksp(ntp4),ccksp(ntp4)
3119 include
'compol.inc'
3120 include
'compol_add.inc'
3130 CALL
e01baf(nt,teta,robb,rrksp,ccksp,nt+4,wrk,6*nt+16,ifail)
3138 include
'double.inc'
3139 include
'parrc1.inc'
3140 include
'comrec.inc'
3142 dimension rxb(nbndp2),zxb(nbndp2)
3146 real*8 roxb(nbndp2),tetxb(nbndp2)
3148 real*8 rrk(nbndp4),cck(nbndp4),wrk(nbndp6)
3150 real*8 cwk(4),tetpol(1),ro0(1)
3152 xzer(x1,x2,v1,v2) = (x1*v2-x2*v1)/(v2-v1)
3165 if(xm.le.x(i+1) .AND. xm.gt.x(i)) icell=i
3169 if(ym.le.y(j+1) .AND. ym.gt.y(j)) jcell=j
3180 ut(ii,jj)=un(ii,jj)-u0
3191 if(ut(i,j)*ut(i+1,j).le.0.)
then
3196 rxb(ig)=xzer(x(i+1),x(i),ut(i+1,j),ut(i,j))
3203 write(6,*)
'loop95: first point was not find'
3220 if(ut(i+1,j)*ut(i,j).le.0. .AND. lin.ne.1)
then
3227 rxb(ig)=xzer(x(i+1),x(i),ut(i+1,j),ut(i,j))
3230 elseif(ut(i+1,j+1)*ut(i+1,j).le.0..AND. lin.ne.2)
then
3238 zxb(ig)=xzer(y(j+1),y(j),ut(i+1,j+1),ut(i+1,j))
3240 elseif(ut(i+1,j+1)*ut(i,j+1).le.0. .AND. lin.ne.3)
then
3247 rxb(ig)=xzer(x(i+1),x(i),ut(i+1,j+1),ut(i,j+1))
3250 elseif(ut(i,j+1)*ut(i,j).le.0..AND. lin.ne.4)
then
3258 zxb(ig)=xzer(y(j+1),y(j),ut(i,j+1),ut(i,j))
3262 c
write(6,*)
'loop:ic,jc',ic,jc,ig
3264 if(jc.eq.jc1 .AND. ic.eq.ic1)
then
3287 if(drx.lt.0.d0) tetp=tetp+pi
3288 deltet=tetp-tetxb(ig-1)
3289 if(deltet.lt.0.d0) tetp=tetp+2.d0*pi
3294 roxb(ig)=dsqrt(drx**2+dzx**2)
3296 c
write(6,*)
'ig,ro,tet',ig,roxb(ig),tetxb(ig)
3301 CALL
e01baf(nxb,tetxb,roxb,rrk,cck,nxb+4,wrk,6*nxb+16,ifail)
3303 c
write(6,*)
'ifail=',ifail
3307 if(tetp.lt.tetxb(1))
then
3309 elseif(tetp.gt.tetxb(nxb))
then
3312 CALL
e02bcf(nxb+4,rrk,cck,tetp ,0,cwk,ifail)
3314 c
write(6,*)
'ifail=',ifail,j
subroutine e02bcf(NCAP7, K, C, X, LEFT, S, IFAIL)
real *8 function blin_tr(tet0, ro0,
subroutine fdefln(psidf, rgv, zgv)
subroutine f_regrid0(erro)
subroutine f_loop95(tetpol, ntet, ro0, u0)
subroutine f_prgrid(imax, jmax, erro)
subroutine bint(X, Y, R0, Z0, r1, z1, F, I)
subroutine f_remesh(erro)
subroutine e01baf(M, X, Y, K, C, LCK, WRK, LWRK, IFAIL)
subroutine deriv5(X, Y, F, M, N, U)
subroutine f_grid(igdf, nstep)
subroutine axdef(rma, zma, psima, dpm)
subroutine f_regrid(erro)
REAL *8 function cpr(H, NP, S)
subroutine regrid0_(erro)
subroutine f_xpoint(rx, zx, ix, jx, psx, tet0, kodex)