! This program uses HPF/Fortran 90 to simulate two-dimensional
! inviscid flow through a nozzle.  The numerical scheme is a finite
! volume cell centered scheme that employs a fourth stage
! runge-kutta time stepping algorithm.  Artificial viscosity
! terms are added to stabilize the scheme in areas of large
! gradients, such as shock waves.  The program reads in a mesh
! from file ft03.dat and computes needed Delta x and Delta y values.
! The initial conditions are set up as simply uniform flow everwhere.
! The inlet and outlet boundary conditions are determined from
! the information the user enters from the screen, the 
! inlet mach number, back pressure and output condition (super
! or sub sonic).  
!
! The structure of the code consistst of calls to the flux,
! artificial dissipation, and boundary condition routines
! for each stage of the
! runge-kutta algorithm.  Data is output for contour
! and line plots as needed.
!
! The code makes heavy use of FORALL statements, which
! are more succint than repeated DO loops, guarentee no
! dependencies and make conversion to HPF easier. 
! These do require more mememory that the traditional
! DO loops, but since this code could only be
! run on the maximum of eight processors that NPAC has,
! effective use of the cache is mute anyway in this sense.

      Program nozzle
      Implicit none
      Integer, Parameter :: lmax=4
      Integer, Parameter :: nx=64
      Integer, Parameter :: ny=16
      Real V(lmax,nx+2,ny+2)
      Real xloc(nx+1,ny+2),yloc(nx+1,ny+2)
      Real dnax(nx+1,ny+2),dnay(nx+1,ny+2)
      Real dnbx(nx+1,ny+2),dnby(nx+1,ny+2)
	  Real min,start,end
      Integer mx,my

!HPF$ PROCESSORS PROC(NUMBER_OF_PROCESSORS())
!HPF$ DISTRIBUTE  V (*,*,BLOCK) onto PROC
!HPF$ ALIGN (*,:) with V(*,*,:) :: xloc,yloc,dnax,dnay,dnbx,dnby
      
     
      

      mx=nx+1
      my=ny+1
      

      
      Call Mesh(V,xloc,yloc,dnax,dnay,dnbx,dnby,lmax,mx,my)
      Call Init_cons(V,lmax,min,mx,my)
      Call James(V,xloc,yloc,dnax,dnay,dnbx,dnby,
     $ min,lmax,mx,my)



       End program

	
        subroutine timer(return_time, initial_time)
         real, intent(in)  :: initial_time
        real,  intent(out) :: return_time
        integer finish,rate
        CALL system_clock( COUNT=finish,COUNT_RATE=rate)
        return_time = FLOAT(finish) / FLOAT(rate) - initial_time
	end subroutine

