!--------------------------- Program parallel_io ! !--------------------------- !-------------------------------------------------- character (len=60) :: fin, fout, fil2 character (len=7) :: fmt1 character (len=8) :: ctime !-------------------------------------------------- include 'mpif.h' include 'dim.h' ! !-Factors that decide whether wake ends !-Termination time (Used on parallel code) ! real, parameter :: tend = 500. character (len=4) :: f11 character (len=12) :: fil character (len=9) :: f12 character (len=4) :: f13 character (len=25) :: fil1 character (len=9) :: output_dir !------------- !-MPI VARIABLES !------------- integer :: myid, ierr, numprocs, comm integer :: nprocs integer :: twoslice, subslice integer, dimension(nproch*nprocv,2) :: id2d integer, dimension(nproch,nprocv) :: id1d !------------------- !- Define 3-D Arrays !------------------- ! !-a) Physical space arrays: Flow variables, non-linear term estimates and ! scratch arrays real, dimension(:,:,:), allocatable :: u !-Integer Variable that raises red-flag on allocation errors integer AllocateStatus !--------------------- !- Allocate 3-D Arrays !--------------------- ! !-a) Physical Space Arrays ! allocate (u(nxpp,nypl,nzpl), > stat=AllocateStatus) if (AllocateStatus /= 0) then stop "**Not Enough Memory - Phys. Space 3D Arrays in MAIN **" end if ! !******************* !------------------ !MPI Initialization !------------------ !******************* comm = mpi_comm_world call MPI_INIT(ierr) call MPI_COMM_RANK(comm,myid,ierr) call MPI_COMM_SIZE(comm,numprocs,ierr) !-Check and see if processors specified in run_mpi script is !-consistent with number in dim.h: np = nproch*nprocv. !-Otherwise, you're in trouble ! if( myid == 0 ) then nprocs = nproch*nprocv write(*,*) ' MPI initialized with ',numprocs,' live processors >specified in run_mpi' write(*,*) ' Number of horizontal processors', nproch write(*,*) ' Number of vertical processors', nprocv write(*,*) ' Number of computational subdomains per processor', >float(nsubd)/float(nprocv) !-Does designated number of processors match that specified in run_mpi script ? if( nprocs .ne. numprocs ) then write(*,*) ' Number of live processors: ', numprocs, > ' does not match' write(*,*) ' the number specified in dim.h: ', > nprocs write(*,*) ' Check the run_mpi script and the dim.h file.' goto 999 ! shutdown MPI and exit gracefully ! call MPI_ABORT(comm,ierr) ! MPI ABORT causes problems ! endif endif !--------------------------------------------------------- ! Set Up 2-D MPI processor grid !--------------------------------------------------------- call mpi_grid_setup(myid,id1d,id2d) !-Set Dummy array to 0 u = 0. !********************** !-STARTING FROM SCRATCH !********************** !-output initial u,v,w,T field f11 = 'pout' fil2 = f11 if (myid == 0) write(*,*) 'Output to file ',fil2 call plotf(fil2,myid,comm,id1d,id2d,u) 999 if (myid == 0) write(*,*) 'PROGRAM ENDS !' !---------------------- !-Deallocate 3-D arrays !---------------------- deallocate (u, > stat=AllocateStatus) if (AllocateStatus /= 0) then stop "**Error Deallocating - 3D Arrays in MAIN **" end if call MPI_FINALIZE(ierr) end program parallel_io