Changeset 18 in PSPA for parmelaPSPA/trunk
- Timestamp:
- Sep 24, 2012, 4:31:45 PM (12 years ago)
- Location:
- parmelaPSPA/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
parmelaPSPA/trunk/cread.f
r12 r18 27 27 6 'WIGGLER','ALPHAM','STAT','POISSON','SEXTUPOLE'/ 28 28 data lfnr,nextr/0,1/ ! lfnr look for next run (or end) 29 29 30 if (jj.eq.100) lfnr=1 30 31 10 continue -
parmelaPSPA/trunk/distrir.f
r12 r18 18 18 pas=xmax/nbin 19 19 ntot=0 20 c------- 20 21 c------- correction Guy Le Meur 24-09-2012 22 do 10 i=1,nbin 23 n(i)=0 24 10 continue 25 21 26 do 20 i=1,nbin 22 27 if(fac.lt.0.5) then … … 33 38 n(i)=int(const2*exp(-((i-0.5)*pas)**2/(2*sigsq)) 34 39 1 *(i-0.5)*pas*pas+0.5) 35 ntot=ntot+n(i) 40 41 ntot=ntot+n(i) 36 42 if(ntot.gt.npoints) then 37 43 n(i)=n(i)-ntot+npoints -
parmelaPSPA/trunk/input.f
r12 r18 100 100 * .4987,.4990,.4993,.4995,.4997,.49975,.4998,.49985,.4999,.49995, 101 101 * .5/ 102 102 103 do 1 i=1,imaa ! mcd 103 104 zcath(i)=0. ! mcd … … 598 599 c 599 600 c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 601 600 602 if (nn.lt.10) then 601 603 write(nnout,10001)nn … … 692 694 10007 format (' gun cavity length =',t40,1pg12.3,' cm') 693 695 endif 696 697 694 698 c----- 695 699 c … … 707 711 c----------------------------- ran = 1 ---- 708 712 if(vv(10).eq.1) then 709 do 10008 i = np1,npoints710 c 711 10009 continue712 call rannor(u,v)713 if (abs(u).gt.tfac) go to 10009714 phase = u*sigdeg713 do 10008 i = np1,npoints 714 c choose time (phase) of generation, relative to center of the pulse 715 10009 continue 716 call rannor(u,v) 717 if (abs(u).gt.tfac) go to 10009 718 phase = u*sigdeg 715 719 c choose intial energy at cathode 716 10010 continue717 call rannor(u,v)718 e = ecath + u*decath719 if (e.le.0.) go to 10010720 betcat = sqrt(2.*e/erest)721 gamma = 1./sqrt(1. - betcat**2)722 c 723 cose = sandom(d)724 sine = sqrt(1. - cose**2)725 phi = twopi*sandom(d)726 bx = betcat*sine*cos(phi)727 by = betcat*sine*sin(phi)728 bz = betcat*cose729 cor(2,i) = gamma*bx730 cor(4,i) = gamma*by731 cor(6,i) = gamma*bz732 c 733 10011 continue734 call rannor(u,v)735 x0 = u*rsig736 y0 = v*rsig737 rsq = x0**2 + y0**2738 if (rsq.gt.rmaxsq) go to 10011720 10010 continue 721 call rannor(u,v) 722 e = ecath + u*decath 723 if (e.le.0.) go to 10010 724 betcat = sqrt(2.*e/erest) 725 gamma = 1./sqrt(1. - betcat**2) 726 c choose initial momentum, isotropic, but betaz > 0 727 cose = sandom(d) 728 sine = sqrt(1. - cose**2) 729 phi = twopi*sandom(d) 730 bx = betcat*sine*cos(phi) 731 by = betcat*sine*sin(phi) 732 bz = betcat*cose 733 cor(2,i) = gamma*bx 734 cor(4,i) = gamma*by 735 cor(6,i) = gamma*bz 736 c choose (x,y,z) 737 10011 continue 738 call rannor(u,v) 739 x0 = u*rsig 740 y0 = v*rsig 741 rsq = x0**2 + y0**2 742 if (rsq.gt.rmaxsq) go to 10011 739 743 c---------------------------------- 740 if((spota.eq.0.).or.(spotd.eq.0)) go to 10021741 anglex10 = atan(x0/spotd)742 delta = spotd*(1-(cos(spota)/cos(spota+(anglex10))))743 delta = delta*360./wavel744 x0= spotd*sin(anglex10)/cos(anglex10+spota)745 phase=phase+delta746 10021 continue744 if((spota.eq.0.).or.(spotd.eq.0)) go to 10021 745 anglex10 = atan(x0/spotd) 746 delta = spotd*(1-(cos(spota)/cos(spota+(anglex10)))) 747 delta = delta*360./wavel 748 x0= spotd*sin(anglex10)/cos(anglex10+spota) 749 phase=phase+delta 750 10021 continue 747 751 c--------------------------------------- 748 uph(i)=phase749 if(uph(i).gt.uphmax)uphmax=uph(i)750 if(uph(i).lt.uphmin)uphmin=uph(i)752 uph(i)=phase 753 if(uph(i).gt.uphmax)uphmax=uph(i) 754 if(uph(i).lt.uphmin)uphmin=uph(i) 751 755 c--------------------------------------- 752 ux0(i)=x0753 if(ux0(i).gt.ux0max)ux0max=ux0(i)754 if(ux0(i).lt.ux0min)ux0min=ux0(i)755 vy0(i)=y0756 if(vy0(i).gt.vy0max)vy0max=vy0(i)757 if(vy0(i).lt.vy0min)vy0min=vy0(i)756 ux0(i)=x0 757 if(ux0(i).gt.ux0max)ux0max=ux0(i) 758 if(ux0(i).lt.ux0min)ux0min=ux0(i) 759 vy0(i)=y0 760 if(vy0(i).gt.vy0max)vy0max=vy0(i) 761 if(vy0(i).lt.vy0min)vy0min=vy0(i) 758 762 c----- 759 z0 = 0.760 if (ajones.gt.0.) then761 c 762 z0 = cathod(rsq)763 zcath(i) = z0764 endif763 z0 = 0. 764 if (ajones.gt.0.) then 765 c calculate the shape of the cathode surface 766 z0 = cathod(rsq) 767 zcath(i) = z0 768 endif 765 769 c----- 766 c 767 c 768 toff = (wtstep + phase)*wavel/360.769 cor(1,i) = x0 - toff*bx770 cor(3,i) = y0 - toff*by771 cor(5,i) = z0 - toff*bz772 10008 continue773 else ! vv(10).ne.1774 c---- 775 call distriphase(degmax,sigdeg,npoints-1)776 call distrir(rmax,rsig,npoints-1)777 c---- 778 do 10012 i = np1,npoints779 c 780 c---- 781 u=distp(i-1)782 c---- 783 phase=u784 c---- 785 c 786 10013 continue787 call rannor(u,v)788 c---- 789 e = ecath + u*decath790 if (e.le.0.) go to 10013791 betcat = sqrt(2.*e/erest)792 gamma = 1./sqrt(1. - betcat**2)793 c 794 cose = sandom(d)795 sine = sqrt(1. - cose**2)796 phi = twopi*sandom(d)797 bx = betcat*sine*cos(phi)798 by = betcat*sine*sin(phi)799 bz = betcat*cose800 cor(2,i) = gamma*bx801 cor(4,i) = gamma*by802 cor(6,i) = gamma*bz803 c 804 c---- 805 c---- 806 if(vv(10).eq.2) then807 10014 continue808 call rannor(u,v)809 x0=u*rsig810 y0=v*rsig811 rsq=x0**2+y0**2812 if(rsq.gt.rmaxsq) go to 10014813 else! vv(10) .ne.2814 x0 = xr(i-1)815 y0 = yr(i-1)816 endif! vv(10) .eq. 2770 c shift initial (x,y,z) so that the particle will emerge from 771 c the photocathode at (x0,y0,z0) at time = phase 772 toff = (wtstep + phase)*wavel/360. 773 cor(1,i) = x0 - toff*bx 774 cor(3,i) = y0 - toff*by 775 cor(5,i) = z0 - toff*bz 776 10008 continue 777 else ! vv(10).ne.1 778 c---- 779 call distriphase(degmax,sigdeg,npoints-1) 780 call distrir(rmax,rsig,npoints-1) 781 c---- 782 do 10012 i = np1,npoints 783 c choose time (phase) of generation, relative to center of the pulse 784 c---- 785 u=distp(i-1) 786 c---- 787 phase=u 788 c---- 789 c choose intial energy at cathode 790 10013 continue 791 call rannor(u,v) 792 c---- 793 e = ecath + u*decath 794 if (e.le.0.) go to 10013 795 betcat = sqrt(2.*e/erest) 796 gamma = 1./sqrt(1. - betcat**2) 797 c choose initial momentum, isotropic, but betaz > 0 798 cose = sandom(d) 799 sine = sqrt(1. - cose**2) 800 phi = twopi*sandom(d) 801 bx = betcat*sine*cos(phi) 802 by = betcat*sine*sin(phi) 803 bz = betcat*cose 804 cor(2,i) = gamma*bx 805 cor(4,i) = gamma*by 806 cor(6,i) = gamma*bz 807 c choose (x,y,z) 808 c---- 809 c---- 810 if(vv(10).eq.2) then 811 10014 continue 812 call rannor(u,v) 813 x0=u*rsig 814 y0=v*rsig 815 rsq=x0**2+y0**2 816 if(rsq.gt.rmaxsq) go to 10014 817 else ! vv(10) .ne.2 818 x0 = xr(i-1) 819 y0 = yr(i-1) 820 endif ! vv(10) .eq. 2 817 821 c---------------------------------- 818 if((spota.eq.0.).or.(spotd.eq.0)) go to 10022819 anglex10 = atan(x0/spotd)820 delta = spotd*(1-(cos(spota)/cos(spota+(anglex10))))821 delta = delta*360./wavel822 x0= spotd*sin(anglex10)/cos(anglex10+spota)823 phase=phase+delta824 10022 continue822 if((spota.eq.0.).or.(spotd.eq.0)) go to 10022 823 anglex10 = atan(x0/spotd) 824 delta = spotd*(1-(cos(spota)/cos(spota+(anglex10)))) 825 delta = delta*360./wavel 826 x0= spotd*sin(anglex10)/cos(anglex10+spota) 827 phase=phase+delta 828 10022 continue 825 829 c--------------------------------------- 826 uph(i)=phase 827 if(uph(i).gt.uphmax)uphmax=uph(i) 828 if(uph(i).lt.uphmin)uphmin=uph(i) 829 c---- 830 ux0(i)=x0 831 if(ux0(i).gt.ux0max)ux0max=ux0(i) 832 if(ux0(i).lt.ux0min)ux0min=ux0(i) 833 vy0(i)=y0 834 if(vy0(i).gt.vy0max)vy0max=vy0(i) 835 if(vy0(i).lt.vy0min)vy0min=vy0(i) 836 c---- 837 z0 = 0. 838 if (ajones.gt.0.) then 839 rsq = x0**2 + y0**2 840 c calculate the shape of the cathode surface 841 z0 = cathod(rsq) 842 zcath(i) = z0 843 endif 844 c shift initial (x,y,z) so that the particle will emerge from 845 c the photocathode at (x0,y0,z0) at time = phase 846 toff = (wtstep + phase)*wavel/360. 847 cor(1,i) = x0 - toff*bx 848 cor(3,i) = y0 - toff*by 849 cor(5,i) = z0 - toff*bz 850 10012 continue 830 uph(i)=phase 831 if(uph(i).gt.uphmax)uphmax=uph(i) 832 if(uph(i).lt.uphmin)uphmin=uph(i) 833 c---- 834 ux0(i)=x0 835 if(ux0(i).gt.ux0max)ux0max=ux0(i) 836 if(ux0(i).lt.ux0min)ux0min=ux0(i) 837 vy0(i)=y0 838 if(vy0(i).gt.vy0max)vy0max=vy0(i) 839 if(vy0(i).lt.vy0min)vy0min=vy0(i) 840 c---- 841 z0 = 0. 842 if (ajones.gt.0.) then 843 rsq = x0**2 + y0**2 844 c calculate the shape of the cathode surface 845 z0 = cathod(rsq) 846 zcath(i) = z0 847 endif 848 c shift initial (x,y,z) so that the particle will emerge from 849 c the photocathode at (x0,y0,z0) at time = phase 850 toff = (wtstep + phase)*wavel/360. 851 cor(1,i) = x0 - toff*bx 852 cor(3,i) = y0 - toff*by 853 cor(5,i) = z0 - toff*bz 854 10012 continue 855 851 856 c---------- 852 endif ! vv(1).eq.1857 endif ! vv(1).eq.1 853 858 c---------- 859 854 860 if(ip.eq.2) then 855 861 open(unit=ninput,file='input10',status='unknown') -
parmelaPSPA/trunk/parmelamainv503.f
r12 r18 346 346 open(unit=nin,file='parmin',status='old', 347 347 * access='sequential',form='formatted') 348 open(unit=nnout,file='parmdebug',status=' new',348 open(unit=nnout,file='parmdebug',status='unknown', 349 349 * access='sequential',form='formatted') 350 350 call ouvrir
Note: See TracChangeset
for help on using the changeset viewer.