Re: phase maps

From: Jack S. Miller (miller@XXXXXX)
Date: Thu Jan 30 1997 - 17:25:34 MST


      Recently Silvia Alessio asked how to use CONREC to draw phase maps.

      Embedded in the program appended below is one approach which is
      fairly effective.

      Jack Miller
      miller@galaxy.jpl.nasa.gov
      ----------------------------------------------
      save the stuff below in a file test.f and compile with
      ncargf77 test.f
      --------------------------------------------------
      program phaze
      parameter (nn=90,mm=90)
      real z(nn,mm),wk(2*mm*nn+mm+nn)
      complex w,v
      common /CONRE1/ioffp,spval
      pi = 4.0 * atan(1.0)
      x1 = -2.0
      x2 = 2.0
      y1 = -2.0
      y2 = 2.0
      n = nn
      m = mm
      l = n
      dx = (x2 - x1) / (n - 1)
      dy = (y2 - y1) / (m - 1)
      do 10 j = 1,m
      y = y1 + (j - 1) * dy
      do 10 i = 1,n
      x = x1 + (i - 1) * dx
      v = cmplx(x,y)
      w = 1.0 / (v - 1.0) + 1.0 / (v + 1.0)
      z(i,j) = atan2(aimag(w),real(w))
  10 continue
      call opngks
c
c Here is an example of a program which plots the phase diagram of
c a function of a complex variable using conrec from ncar graphics.
c The first invocation calls conrec with no changes and the plots
c exhibit the piling up of contours in some regions.
c
      nhi = -1.0
      ndot = -585
      dt = pi /18
       FLO = -PI/2.0
       HI = PI / 2.0
       FINC = DT
       NSET = 0
       CALL CONREC (Z,L,M,N,FLO,HI,FINC,NSET,NHI,NDOT)
       call frame
c
c The piling up of contour lines is the result of severe discontinuities
c which can be seen by looking at the following srface plots of the
c same array.
c
       do 30 k = 1,8
       angx = (k - 1) * 45.0
       angxy = 45.0
       call ezsrfc(z,m,n,angx,angxy,wk)
   30 continue
c
c The type of discontinuities exhibited in the above plots are
c the sort of thing that led Riemann to invent his surfaces.
c Since conrec doesn't know about Riemann surfaces, we can give
c it some help in regions where contours get too thick by using
c the special value feature to supress the plotting of these
c crowded contours.
c
       ioffp = 1
       spval =-1.e+99
       spval =-1.367921
      do 20 j = 1,m-1
      do 20 i = 1,n-1
c dt here is the increment between contours
      if (abs(z(i,j) -z(i+1,j))+abs(z(i,j) -z(i,j+1)).gt.15.*dt)
     1 z(i,j) = spval
   20 continue
       CALL CONREC (Z,L,M,N,FLO,HI,FINC,NSET,NHI,NDOT)
       call frame
c
c I just put this in to show that we have not altered the array
c "very much".
c
       do 40 k = 1,8
       angx = (k - 1) * 45.0
       angxy = 45.0
       call ezsrfc(z,m,n,angx,angxy,wk)
   40 continue
      call clsgks
      end



This archive was generated by hypermail 2b29 : Wed Jun 28 2000 - 09:45:37 MDT