program readgrid parameter (ni = 30, nj = 1, nk = 128, nblocks = 1) parameter (ni1 = ni + 1 ) parameter (nj1 = nj + 1 ) parameter (nk1 = nk + 1 ) dimension x(ni1,nj1,nk1), y(ni1,nj1,nk1), z(ni1,nj1,nk1) dimension iblk(nblocks), jblk(nblocks), kblk(nblocks) write(6,10) 10 format(5x,'The file "sphere3.g" is a plot3d grid file written in', &/'unformatted, multiblock, 3d-whole. It can be converted to ' &'a tecplot format'/'using the preplot utility as follows:'// &'preplot sphere3 -plot3d -3dw -f -m -gridonly'// &'It is best viewed using the preplot utility as follows:'// &'preplot sphere3 -plot3d -3dw -f -m -jp 1 -gridonly'/// &5x,'The file "sphere2.g" is a plot3d grid file written in', &/'unformatted, 2d. It can be converted to ' &'a tecplot format'/'using the preplot utility as follows:'// &'preplot sphere2 -plot3d -2d -f -gridonly'/) open (40, file='sphere3.g', form='unformatted', status='old' ) open (41, file='sphere2.g', form='unformatted', status='new' ) read (40) nblk read (40) (iblk(n), jblk(n), kblk(n), n = 1,nblk) write (41) (iblk(n), kblk(n), n = 1,nblk) do n=1,nblk read(40)(((x(i,j,k),i=1,iblk(n)),j=1,jblk(n)), k=1,kblk(n)), & (((y(i,j,k),i=1,iblk(n)),j=1,jblk(n)), k=1,kblk(n)), & (((z(i,j,k),i=1,iblk(n)),j=1,jblk(n)), k=1,kblk(n)) do k=1,kblk(n) do i=1,iblk(n) x(i,1,k)=sqrt(x(i,1,k)**2+y(i,1,k)**2) end do end do write(41)((x(i,1,k),i=1,iblk(n)), k=1,kblk(n)), & ((z(i,1,k),i=1,iblk(n)), k=1,kblk(n)) end do stop end