24 include
'compol_add.inc'
32 dlr(i,j)=sqrt( (r(i+1,j)-r(i,j))**2+(z(i+1,j)-z(i,j))**2 )
33 st(i,j)=dlr(i,j)*(r(i+1,j)+r(i,j))*0.5d0
41 dlt(i,j)=sqrt( (r(i,j+1)-r(i,j))**2+(z(i,j+1)-z(i,j))**2 )
42 sr(i,j)=dlt(i,j)*(r(i,j+1)+r(i,j))*0.5d0
55 r0=(r1+
r2+r3+r4)*0.25d0
67 z0=(z1+z2+z3+z4)*0.25d0
74 sq1(i,j)=
funsq(r1,r12,r0,r14,z1,z12,z0,z14)
75 sq2(i,j)=
funsq(
r2,r23,r0,r12,z2,z23,z0,z12)
76 sq3(i,j)=
funsq(r3,r34,r0,r23,z3,z34,z0,z23)
77 sq4(i,j)=
funsq(r4,r14,r0,r34,z4,z14,z0,z34)
79 s(i,j)=
funsq(r1,
r2,r3,r4,z1,z2,z3,z4)
81 vol1(i,j)=
funsq(r1,
r2,r4,r4,z1,z2,z4,z4)*(r1+
r2+r4)/6.d0
82 vol2(i,j)=
funsq(r1,
r2,r3,r3,z1,z2,z3,z3)*(r1+
r2+r3)/6.d0
83 vol3(i,j)=
funsq(
r2,r3,r4,r4,z2,z3,z4,z4)*(
r2+r3+r4)/6.d0
84 vol4(i,j)=
funsq(r1,r3,r4,r4,z1,z3,z4,z4)*(r1+r3+r4)/6.d0
92 vol(i,j)=(vol1(i,j)+vol2(i,j)+vol3(i,j)+vol4(i,j))
96 dl12= (dr12**2+dz12**2)
100 dl14= (dr14**2+dz14**2)
104 dl23= (dr23**2+dz23**2)
108 dl34= (dr34**2+dz34**2)
110 cos2(i,j)=(dr12*dr23+dz12*dz23)/sqrt(dl12*dl23)
111 sin2(i,j)=1.d0-cos2(i,j)**2
113 cos3(i,j)=(dr34*dr23+dz34*dz23)/sqrt(dl34*dl23)
114 sin3(i,j)=1.d0-cos3(i,j)**2
118 cos4(i,j)=(dr34*dr14+dz34*dz14)/sqrt(dl34*dl14)
119 sin4(i,j)=1.d0-cos4(i,j)**2
121 cos1(i,j)=(dr12*dr14+dz12*dz14)/sqrt(dl12*dl14)
122 sin1(i,j)=1.d0-cos1(i,j)**2
156 include
'compol_add.inc'
164 dlr(i,j)=sqrt( (r(i+1,j)-r(i,j))**2+(z(i+1,j)-z(i,j))**2 )
173 dlt(i,j)=sqrt( (r(i,j+1)-r(i,j))**2+(z(i,j+1)-z(i,j))**2 )
187 r0=(r1+
r2+r3+r4)*0.25d0
199 z0=(z1+z2+z3+z4)*0.25d0
206 sq1(i,j)=
funsq(r1,r12,r0,r14,z1,z12,z0,z14)
207 sq2(i,j)=
funsq(
r2,r23,r0,r12,z2,z23,z0,z12)
208 sq3(i,j)=
funsq(r3,r34,r0,r23,z3,z34,z0,z23)
209 sq4(i,j)=
funsq(r4,r14,r0,r34,z4,z14,z0,z34)
211 s(i,j)=
funsq(r1,
r2,r3,r4,z1,z2,z3,z4)
213 vol1(i,j)=
funsq(r1,
r2,r4,r4,z1,z2,z4,z4)*(rm+rm+rm)/6.
214 vol2(i,j)=
funsq(r1,
r2,r3,r3,z1,z2,z3,z3)*(rm+rm+rm)/6.
215 vol3(i,j)=
funsq(
r2,r3,r4,r4,z2,z3,z4,z4)*(rm+rm+rm)/6.
216 vol4(i,j)=
funsq(r1,r3,r4,r4,z1,z3,z4,z4)*(rm+rm+rm)/6.
218 vol(i,j)=(vol1(i,j)+vol2(i,j)+vol3(i,j)+vol4(i,j))
222 dl12= (dr12**2+dz12**2)
226 dl14= (dr14**2+dz14**2)
230 dl23= (dr23**2+dz23**2)
234 dl34= (dr34**2+dz34**2)
236 cos2(i,j)=(dr12*dr23+dz12*dz23)/sqrt(dl12*dl23)
237 sin2(i,j)=1.-cos2(i,j)**2
239 cos3(i,j)=(dr34*dr23+dz34*dz23)/sqrt(dl34*dl23)
240 sin3(i,j)=1.-cos3(i,j)**2
244 cos4(i,j)=(dr34*dr14+dz34*dz14)/sqrt(dl34*dl14)
245 sin4(i,j)=1.-cos4(i,j)**2
247 cos1(i,j)=(dr12*dr14+dz12*dz14)/sqrt(dl12*dl14)
248 sin1(i,j)=1.-cos1(i,j)**2
286 include
'compol_add.inc'
288 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
289 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
302 a12(i,j)=( (-1.d0/s12+cos1(i,j)/s14)*vol1(i,j)/sin1(i,j) +
303 + (-1.d0/s12-cos2(i,j)/s23)*vol2(i,j)/sin2(i,j) )/s12
305 a23(i,j)=( (-1.d0/s23-cos2(i,j)/s12)*vol2(i,j)/sin2(i,j) +
306 + (-1.d0/s23+cos3(i,j)/s34)*vol3(i,j)/sin3(i,j) )/s23
308 a34(i,j)=( (-1.d0/s34+cos3(i,j)/s23)*vol3(i,j)/sin3(i,j) +
309 + (-1.d0/s34-cos4(i,j)/s14)*vol4(i,j)/sin4(i,j) )/s34
311 a14(i,j)=( (-1.d0/s14+cos1(i,j)/s12)*vol1(i,j)/sin1(i,j) +
312 + (-1.d0/s14-cos4(i,j)/s34)*vol4(i,j)/sin4(i,j) )/s14
314 a13(i,j)= (cos2(i,j)/(s12*s23))*vol2(i,j)/sin2(i,j) +
315 + (cos4(i,j)/(s34*s14))*vol4(i,j)/sin4(i,j)
317 a24(i,j)= (-cos1(i,j)/(s12*s14))*vol1(i,j)/sin1(i,j) +
318 + (-cos3(i,j)/(s34*s23))*vol3(i,j)/sin3(i,j)
322 a12(i,j)=( (-1.d0/s12-cos2(i,j)/s23)*vol2(i,j)/sin2(i,j) )/s12
324 a23(i,j)=( (-1.d0/s23-cos2(i,j)/s12)*vol2(i,j)/sin2(i,j) +
325 + (-1.d0/s23+cos3(i,j)/s34)*vol3(i,j)/sin3(i,j) )/s23
327 a34(i,j)=( (-1.d0/s34+cos3(i,j)/s23)*vol3(i,j)/sin3(i,j) )/s34
330 a13(i,j)= (cos2(i,j)/(s12*s23))*vol2(i,j)/sin2(i,j)
332 a24(i,j)= (-cos3(i,j)/(s34*s23))*vol3(i,j)/sin3(i,j)
356 include
'compol_add.inc'
358 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
359 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
377 a(im)=a12(1,j)+a24(1,j)+a34(1,j-1)+a13(1,j-1)
393 a2=a34(i-1,j-1)+a12(i-1,j)
395 a4=a23(i-1,j-1)+a14(i,j-1)
396 a6=a14(i,j)+a23(i-1,j)
398 a8=a34(i,j-1)+a12(i,j)
401 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
413 ja(im)=
numlin(i-1,j,nr,nt)
419 ja(im)=
numlin(i-1,j+1,nr,nt)
425 ja(im)=
numlin(i-1,j-1,nr,nt)
437 ja(im)=
numlin(i,j+1,nr,nt)
443 ja(im)=
numlin(i,j-1,nr,nt)
445 if(i.eq.nr1) go to 71
451 ja(im)=
numlin(i+1,j,nr,nt)
457 ja(im)=
numlin(i+1,j+1,nr,nt)
463 ja(im)=
numlin(i+1,j-1,nr,nt)
487 ja(im)=
numlin(2,j+1,nr,nt)
493 ja(im)=
numlin(2,j-1,nr,nt)
505 ja(im)=
numlin(3,j+1,nr,nt)
511 ja(im)=
numlin(3,j-1,nr,nt)
520 a2=a34(i-1,j-1)+a12(i-1,j)
522 a4=a23(i-1,j-1)+a14(i,j-1)
523 a6=a14(i,j)+a23(i-1,j)
525 a8=a34(i,j-1)+a12(i,j)
528 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
540 ja(im)=
numlin(i-1,j-1,nr,nt)
546 ja(im)=
numlin(i-1,j,nr,nt)
552 ja(im)=
numlin(i-1,j+1,nr,nt)
558 ja(im)=
numlin(i,j-1,nr,nt)
570 ja(im)=
numlin(i,j+1,nr,nt)
578 ja(im)=
numlin(i+1,j-1,nr,nt)
584 ja(im)=
numlin(i+1,j,nr,nt)
590 ja(im)=
numlin(i+1,j+1,nr,nt)
608 ja(im)=
numlin(2,j-1,nr,nt)
620 ja(im)=
numlin(2,j+1,nr,nt)
626 ja(im)=
numlin(3,j-1,nr,nt)
638 ja(im)=
numlin(3,j+1,nr,nt)
652 a2=a34(i-1,j-1)+a12(i-1,j)
654 a4=a23(i-1,j-1)+a14(i,j-1)
655 a6=a14(i,j)+a23(i-1,j)
657 a8=a34(i,j-1)+a12(i,j)
660 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
672 ja(im)=
numlin(i-1,j+1,nr,nt)
678 ja(im)=
numlin(i-1,j-1,nr,nt)
684 ja(im)=
numlin(i-1,j,nr,nt)
690 ja(im)=
numlin(i,j+1,nr,nt)
696 ja(im)=
numlin(i,j-1,nr,nt)
704 if(i.eq.nr1) go to 72
710 ja(im)=
numlin(i+1,j+1,nr,nt)
716 ja(im)=
numlin(i+1,j-1,nr,nt)
722 ja(im)=
numlin(i+1,j,nr,nt)
740 ja(im)=
numlin(2,j+1,nr,nt)
746 ja(im)=
numlin(2,j-1,nr,nt)
758 ja(im)=
numlin(3,j+1,nr,nt)
764 ja(im)=
numlin(3,j-1,nr,nt)
791 c
open(1,file=
'matr')
798 c
write(1,*)
'il=',kl
799 c
write(1,*) (ja(km),km=ic1,ic2)
800 c
write(1,*) (a(km),km=ic1,ic2)
805 if( (itin/nitdel*nitdel+nitbeg) .EQ. itin )
then
815 elseif(itin.gt.nitbeg)
then
819 daop(km)=a(km)-aop0(km)
843 include
'compol_add.inc'
850 call
cof_bon(cps_bon,bps_bon,dps_bon)
851 psi_bon=psi_eav+pspl_av
860 elseif(ngav.eq.2)
then
862 elseif(ngav.eq.-10 .AND. erru.lt.5.d-3)
then
863 call
promat_j(iplas,dfdpsi,
dpdpsi,f,flx_fi,psia,q,rm,psipla,itin,
864 * kstep,fvac,psi_eav,pspl_av,psibon0,cur_mu )
865 elseif(ngav.eq.-1 .AND. erru.lt.5.d-3)
then
866 call
promat(iplas,dfdpsi,
dpdpsi,f,flx_fi,psia,q,rm,psipla,itin,
867 * kstep,fvac,psi_eav,pspl_av,psibon0,cur_mu )
868 elseif(ngav.eq.-2 .AND. erru.lt.5.d-2)
then
869 call
promat(iplas,dfdpsi,
dpdpsi,f,flx_fi,psia,q,rm,psipla,itin,
870 * kstep,fvac,psi_eav,pspl_av,psibon0,cur_mu )
871 elseif(ngav.eq.-3 .AND. erru.lt.5.d-3)
then
872 call
promat_i(iplas,dfdpsi,
dpdpsi,f,flx_fi,psia,q,rm,psipla,itin,
873 * kstep,fvac,psi_eav,pspl_av,psibon0,tok_mu )
889 include
'compol_add.inc'
891 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
892 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
894 common/compsf/ psf,sqtor
896 dimension amn(nrp),a0(nrp),apl(nrp),capp(nrp)
897 dimension avrc(nrp),delsc(nrp),avrk(nrp),delsk(nrp),delv(nrp)
898 dimension bmn(nrp),b0(nrp),bpl(nrp),wrk1(nrp),wrk2(nrp)
899 dimension psf(nrp),rhs(nrp),sqtor(nrp)
915 r0=(r1+
r2+r3+r4)*0.25d0
918 zavrc=zavrc+s(i,j)/r0
929 sqtor(i)=sqtor(i-1)+delsc(i-1)
942 sqk=sq1(i,j)+sq2(i-1,j)+sq3(i-1,j-1)+sq4(i,j-1)
945 sqk=sq2(i-1,j)+sq3(i-1,j-1)
946 r0=(3.d0*r(i,j)+r(i-1,j))*0.25d0
973 a2=a34(i-1,j-1)+a12(i-1,j)
975 a4=a23(i-1,j-1)+a14(i,j-1)
976 a6=a14(i,j)+a23(i-1,j)
978 a8=a34(i,j-1)+a12(i,j)
980 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
992 qmn=-q(i-1)/(avrc(i-1)*delsc(i-1))
993 qpl=-q(i) / (avrc(i)*delsc(i))
996 afmn=qk*qmn*avrk(i)*delsk(i)
997 afpl=qk*qpl*avrk(i)*delsk(i)
1005 capp(i)=sapl*delsc(i)
1007 if(i.eq.iplas-1)
then
1009 capmn=samn*delsc(i-1)
1033 rhs(i)=-
dpdpsi(i+1)*delv(i+1)+rhs(i)
1037 rhs(1)=rhs(1)+amn(2)*psimx
1038 rhs(npro)=rhs(npro)+apl(iplas-1)*psip
1042 call
prog1d(npro,psf(2),bpl,bmn,b0,rhs,wrk1,wrk2)
1051 f(i)=-q(i)*(psf(i+1)-psf(i))/(delsc(i)*avrc(i))
1059 qmn=-q(i-1)/(avrc(i-1)*delsc(i-1))
1060 qpl=-q(i)/(avrc(i)*delsc(i))
1063 dfdpsi(i)=qk*(f(i)-f(i-1))
1074 acj=a12(1,j)+a24(1,j)+a34(1,j-1)+a13(1,j-1)
1077 skcen=skcen+sq1(1,j)+sq4(1,j-1)
1084 dfdpsi(1)=((ac0*(psimx-psf(2)) )/skcen-rm*
dpdpsi(1))*rm
1096 a2=a34(i-1,j-1)+a12(i-1,j)
1109 call
extrpc( sqtor(i),capp(i),
1110 * sqtor(i),sqtor(i-1),sqtor(i-2),sqtor(i-3),
1111 * capp(i-1) ,capp(i-2) ,capp(i-3) )
1125 * samn*(psip-psf(i-1))+avrk(i)*delsk(i)*dfdpsi(i)
1129 f(i)=sqrt( f(i-1)**2+dfdpsi(i)*(psip-psf(i-1)) )
1131 q(i)=-f(i)*avrk(i)/dpsids
1132 write(*,*)
'q(iplas)=',q(i)
1140 qmn=-q(i-1)/avrc(i-1)
1143 q14=-0.5d0*(q(i)+q(i-1))
1149 f(i)=(samn*(psip-psf(i-1))+delv(i)*
dpdpsi(i)-q14*f(i-1))
1153 dfdpsi(i)=(q14/avr14)*(f(i)-f(i-1))/delsk(i)
1156 psiai=psia(i)-0.25d0*(psia(i)- psia(i-1))
1158 call
extrp2( psiai,dfdpsi(i),
1159 * psia(i-3),psia(i-2),psia(i-1),
1160 * dfdpsi(i-3) ,dfdpsi(i-2) ,dfdpsi(i-1) )
1162 f(i)=dsqrt(f(i-1)**2+dfdpsi(i)*(psip- psf(i-1)))
1186 include
'double.inc'
1187 include
'parevo.inc'
1188 parameter(nkp=njlim)
1190 include
'compol.inc'
1191 include
'compol_add.inc'
1193 common/comaaa/ a12(nrp,ntp),a23(nrp,ntp),a34(nrp,ntp),
1194 + a14(nrp,ntp),a13(nrp,ntp),a24(nrp,ntp)
1196 common/compsf/ psf(nrp),sqtor(nrp)
1198 dimension amn(nrp),a0(nrp),apl(nrp),qcapp(nrp)
1199 dimension avrc(nrp),delsc(nrp),avrk(nrp),delsk(nrp),delv(nrp)
1200 dimension bmn(nrp),b0(nrp),bpl(nrp),wrk1(nrp),wrk2(nrp)
1202 dimension dfdpsn(nrp),vw(nrp)
1208 psf(i)=psia(i)*(psim-psip)+psip
1224 r0=(r1+
r2+r3+r4)*0.25d0
1226 zdelsc=zdelsc+s(i,j)
1227 zavrc=zavrc+s(i,j)/r0
1231 avrc(i)=zavrc/zdelsc
1240 sqtor(i)=sqtor(i-1)+delsc(i-1)
1255 sqk=sq1(i,j)+sq2(i-1,j)+sq3(i-1,j-1)+sq4(i,j-1)
1258 sqk=sq2(i-1,j)+sq3(i-1,j-1)
1259 r0=(3.d0*r(i,j)+r(i-1,j))*0.25d0
1268 avrk(i)=zavrk/zdelsk
1285 a2=a34(i-1,j-1)+a12(i-1,j)
1287 a4=a23(i-1,j-1)+a14(i,j-1)
1288 a6=a14(i,j)+a23(i-1,j)
1290 a8=a34(i,j-1)+a12(i,j)
1292 a5=-(a1+a2+a3+a4+a6+a7+a8+a9)
1304 qmn=-q(i-1)/(avrc(i-1)*delsc(i-1))
1305 qpl=-q(i) / (avrc(i)*delsc(i))
1306 qk=(qmn*dpsda(i-1)+qpl*dpsda(i))/(dpsda(i-1)+dpsda(i))
1308 afmn=qk*qmn*avrk(i)*delsk(i)
1309 afpl=qk*qpl*avrk(i)*delsk(i)
1319 if(i.eq.iplas-1)
then
1338 zff=amn(i)*psf(i-1)+a0(i)*psf(i)+apl(i)*psf(i+1)
1340 zdfdps=( zff-
dpdpsi(i)*delv(i) )/(avrk(i)*delsk(i))
1343 deldf=dabs(zdfdps-dfdpsn(i))
1347 errdf=dmax1(deldf,errdf)
1394 f2n1=(tok*qcapp(iplas-1))**2
1395 f(iplas-1)=dsqrt(f2n1)
1398 f(i-1)=dsqrt( f(i)**2-dfdpsi(i)*(psf(i+1)-psf(i-1)) )
1404 dftor=f(i)*delsc(i)*avrc(i)
1406 psf(i)=psf(i+1)+delpsi
1415 zff=amn(i)*psf(i-1)+a0(i)*psf(i)+apl(i)*psf(i+1)
1417 dfdpsi(i)=( zff-
dpdpsi(i)*delv(i) )/(avrk(i)*delsk(i))
1418 deldf=dabs(dfdpsi(i)-dfdpsn(i))
1421 errdf=dmax1(deldf,errdf)
1428 if(errdf.gt.1.d-7) go to 736
1432 call
extrp2( psia(i),dfdpsi(i),
1433 * psia(i-3),psia(i-2),psia(i-1),
1434 * dfdpsi(i-3) ,dfdpsi(i-2) ,dfdpsi(i-1) )
1448 acj=a12(1,j)+a24(1,j)+a34(1,j-1)+a13(1,j-1)
1451 skcen=skcen+sq1(1,j)+sq4(1,j-1)
1456 dfdpsi(1)=( ac0*(psf(1)-psf(2))/skcen-rm*
dpdpsi(1))*rm
subroutine extrpc(X, F, X0, X1, X2, X3, F1, F2, F3)
REAL *8 function funsq(R1, R2, R3, R4, Z1, Z2, Z3, Z4)
subroutine cof_bon(cps_bon, bps_bon, dps_bon)
subroutine f_procof_i(icq)
subroutine prog1d(M, U, A, B, C, F, ALF, BET)
subroutine promat(n, dfdpsi, dpdpsi, f, flx_fi, psia, q, rm, psim, iter, kstep, fvac, psi_eav, pspl_av, psibon0, cur_mu)
real(r8) function dpdpsi(psi_n)
function numlin(i, j, nr, nt)
subroutine extrp2(X, F, X1, X2, X3, F1, F2, F3)
subroutine f_psib_ext(psex_av)
real(r8) function r2(a, x, xr, xs, yr, ys, psi, psir, F_dia)
subroutine promat_i(n, dfdpsi, dpdpsi, f, flx_fi, psia, q, rm, psim, iter, kstep, fvac, psi_eav, pspl_av, psibon0, tok)
subroutine f_procof_fl(icq)
subroutine promat_j(n, dfdpsi, dpdpsi, f, flx_fi, psia, q, rm, psim, iter, kstep, fvac, psi_eav, pspl_av, psibon0, cur_mu)
subroutine f_psib_pla(pspl_av)
subroutine f_procof(icq, cur_mu)