c This is my first attempt to convert xyz (Cartesian) to .obj format,
c initially aimed at reproducing a duct

       program main
       integer i,j,k,l,m,n,ij,nx,nth,nv
       parameter(nx=60,nth=32,nv=nx*nth)
       real*8 a,b,c,d,e,x(nv),y(nv),z(nv)

c       nv=nx*nth   ! number of vertices (more or less)

       open(7,file='soln1lowres.sol')
       open(8,file='soln1.obj')
       do i=1,nx
         do j=1,nth
          ij=(i-1)*nth + j          ! Should range from 1,...,nv
          read(7,*)x(ij),y(ij),z(ij)!read in vertex coords
         end do
       end do

c Now try to write out .obj file:     
       do i=1,nx
         do j=1,nth
          ij=(i-1)*nth + j                 
          write(8,*)'v  ',x(ij),y(ij),z(ij) ! Vertex coords are easy 
         end do
       end do 

       do i=2,nx                  ! Now try to write out face coords
         do j=2,nth               ! and ignore lines for now
          ij=(i-1)*nth + j        
          write(8,*)'f ',ij, ij+1, ij+1-nth, ij-nth  
         end do
       end do 

       end
