coil_2d.f90 1.92 KB
 Serhiy Mochalskyy committed Apr 18, 2016 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ``````! ---------------------------------------------------------------------- subroutine coil_2d(xc,yc,zc,nc,cur,xb,yb,zb,phib) ! ---------------------------------------------------------------------- ! ! purpose: ! ! ! ---------------------------------------------------------------------- implicit none real,dimension ( nc ,2) :: xc ,yc ,zc real,dimension (2*nc-2,3) :: xb, yb ,zb, phib real :: cur,dist integer :: j,k,k1,nc ! -------- -------------------------------------------------------------- dist = (xc(nc,1)-xc(1,1))**2+(yc(nc,1)-yc(1,1))**2 & +(zc(nc,1)-zc(1,1))**2+(xc(nc,2)-xc(1,2))**2 & +(yc(nc,2)-yc(1,2))**2+(zc(nc,2)-zc(1,2))**2 if(dist.gt.1.e-6) then `````` Serhiy Mochalskyy committed Jun 13, 2016 19 20 21 22 23 24 25 `````` write(6,*) dist, xc(nc,1)-xc(1,1),yc(nc,1)-yc(1,1) & ,zc(nc,1)-zc(1,1) write(6,*) write(6,*) dist, xc(nc,2)-xc(1,2),yc(nc,2)-yc(1,2) & ,zc(nc,2)-zc(1,2) write(6,*) 'coil_2d is not closed: stop' stop `````` Serhiy Mochalskyy committed Apr 18, 2016 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 `````` endif j=0 do k = 1, nc-1 k1 = k+1 j = j+1 xb(j,1) = xc(k ,2) yb(j,1) = yc(k ,2) zb(j,1) = zc(k ,2) xb(j,2) = xc(k1,2) yb(j,2) = yc(k1,2) zb(j,2) = zc(k1,2) xb(j,3) = xc(k ,1) yb(j,3) = yc(k ,1) zb(j,3) = zc(k ,1) phib(j,1)= cur phib(j,2)= cur phib(j,3)= 0. j=j+1 xb(j,1) = xc(k1,1) yb(j,1) = yc(k1,1) zb(j,1) = zc(k1,1) xb(j,2) = xc(k ,1) yb(j,2) = yc(k ,1) zb(j,2) = zc(k ,1) xb(j,3) = xc(k1,2) yb(j,3) = yc(k1,2) zb(j,3) = zc(k1,2) phib(j,1)= 0. phib(j,2)= 0. phib(j,3)= cur enddo end subroutine coil_2d``````