      program Oscillator2D ! BB Oct 30 2011.
C 2d harmonic osciallator: Data file for Lissajous curves.
      implicit real*8 (a-h,o-z)
      logical ltest
      parameter(omega1=3.0d00,omega2=1.0d00,n=500)
c     parameter(phi0=0.d00,phid0=+0.1d00,psi0=0.d00,psid0=-0.1d00)
      parameter(phi0=0.d00,phid0=+1.0d00,psi0=0.d00,psid0=-1.0d00)
      ltest=.true.
c
      write(6,'(/,"2D Oscillator Lissajous curve:",/)')
      pi=acos(-1.0d00)
      write(6,'("omega1, omega2, pi =",2F6.1,F10.6)') omega1,omega2,pi
      alpha=pi/2
      beta=0.0d00
      tmax=2*pi
      open(8,file="O2D.d",form='formatted',status='unknown')
      open(9,file="O2Dx.d",form='formatted',status='unknown')
      do i=0,n
        t=(i*tmax)/n
        th1=cos(omega1*t)
        th2=sin(omega2*t)
        write(8,'(3F14.6,I9)') th1,th2,t,i
        x1=8*th1
        x2=-4*th1+4*th2
        write(9,'(3F14.6,I9)') x1,x2,t,i
      enddo
      close(8)
      close(9)
      if(ltest) stop "Oscillator2D: ltest."
c
      stop
      end
