subroutine hmplot2(field,title,tim,ipage,mplot,nplot) c c plots the real and imaginary mode structure of a field along the c the magnetic field, for a single mode on a single page. c title is a character string title for the plot c c Then plot the Fourier Transform of the field along B. c implicit none include 'itg.par' include 'itg.cmn' c include 'post.cmn' c arguments: complex field(lz,mz,nz) character title*(*) real tim integer mplot,nplot,ipage c local variables: real yreal(lz) real yimag(lz) real ucft(lz) real usft(lz),work(lz) complex phase,ylocal character*14 strtime character*39 strmn real rf(lz) ! k_par grid. c declare other local variables: real ymin,ymax,xmin,xmax integer isymspa,l,ifail c rotate the complex mode to make it purely real at r=0: phase=field(ld/2+1,mplot,nplot) if(cabs(phase) .gt. 1.e-30)then phase=phase/cabs(phase) else phase=(1.0,0.0) endif do l=1,ld ylocal=field(l,mplot,nplot)/phase yreal(l)=real(ylocal) yimag(l)=aimag(ylocal) c yimag(l)=-aimag(ylocal) c We used to have to take the complex conjugate to compare with Tang c (PF v. 23, p.2459, fig. 5), but now I realize that was because our c sin part was the negative of the imaginary part. enddo c debug: try a gaussian: c do 12 l=1,ld c yimag(l)=0.0 c yreal(l)=exp(-(r(l)-r(ld)/2)**2/2) c12 continue c ymin=0.0 ymax=0.0 call mnmx(ld,yreal,ymin,ymax) call mnmx(ld,yimag,ymin,ymax) xmin=r(1) xmax=r(ld) c start plot call setzer c init itext to hold up to 5 80-character lines for the legend: c idum=linest(itext,itextsiz,80) call plchlq(.5,.08,'ballooning coordinate',15.,0.,0.) call plchlq(.5,.97,title,20.,0.,0.) write(strmn,'(a,i2,a,i2)') * 'Real and Imag part vs. x, for m=', * mrr(mplot,nplot),' n=',nrr(nplot) call plchlq(.5,.93,strmn,15.,0.,0.) write(strtime,'(a,f7.2)') 'time = ',tim call plchlq(.98,.98,strtime,15.,0.,1.) call mapsm(xmin,xmax,ymin,ymax) isymspa=(ld-1)/16 call dashdb(65535) call curve(r,yreal,ld) call dashdb(21845) call curved(r,yimag,ld) call set(0.1,0.9,0.15,0.9,0.,1.,0.,1.,1) call line(.15,.1,.18,.1) call plchlq(.19,.1,'real',12.,0.,-1.) call lined(.15,.05,.18,.05) call plchlq(.19,.05,'imaginary',12.,0.,-1.) call finish(ipage) c c*************************************************************** c cc FFT phi(k) for plots: c if ((qsf.ge.0.0).and.(mrr(mplot,nplot).ne.0)) then c c F.T. of potential c do l=1,ld-1 c define the k_parallel grid: rf(l)=float(l-ldb/2)/(2*x0) c 2.*r(l)/(3.14159*(ld-1))/(mrr(mplot,nplot)/y0*abs(shr)) c Have to take the complex conjugate to exactly reproduce the previous c plots, which had an error because it didn't realize that c the sin part = - imaginary part: yimag(l)=-yimag(l) enddo rf(ld)=r(ld-1) call c06fce(yreal,yimag,ld-1,work,ifail) ! fft c shift origin to center of box do l=2,ld-1,2 yreal(l)=-yreal(l) yimag(l)=-yimag(l) enddo c c rotate phase at r=r0 phase=cmplx(yreal(1),yimag(1)) if(cabs(phase) .gt. 1.e-30)then phase=phase/cabs(phase) else phase=(1.0,0.0) endif do l=1,ld-1 ylocal=cmplx(yreal(l),yimag(l))/phase yreal(l)=real(ylocal) yimag(l)=aimag(ylocal) enddo do l=1,ld-1 if (l.le.ld/2) then ucft(l)=yreal(l+ld/2) usft(l)=yimag(l+ld/2) else ucft(l)=yreal(l-ld/2) usft(l)=yimag(l-ld/2) endif enddo ucft(ld)=0.0 usft(ld)=0.0 c call hmplot2(ucft,usft,'Fourier transform of potential', c & tim,ipage,mplot,nplot) ymin=0.0 ymax=0.0 call mnmx(ldb,ucft,ymin,ymax) call mnmx(ldb,usft,ymin,ymax) call setzer call plchlq(.5,.95,'Fourier transform of potential',20. * ,0.,0.) call plchlq(.5,.08,'k_par q R',15.,0.,0.) call mapsm(rf(1),rf(ldb),ymin,ymax) call curve(rf,ucft,ldb) call dashdb(21845) call curved(rf,usft,ldb) call finish(ipage) endif return end