FpOutput: readpartpos.f90

File readpartpos.f90, 1.4 KB (added by pesei, 7 years ago)

Read binary particle dump (FpLimitedareaWrf)

Line 
1  program readpartpos
2 
3! read particle positions written by FpWRF 3.3.2
4! Petra Seibert, 7/2017
5
6  integer, parameter :: nspec = 2
7  integer :: ioutgrid_option
8!  integer, allocatable, dimension(:)   :: npoint,itramem
9!  real,    allocatable, dimension(:)   :: ztra1
10!  real,    allocatable, dimension(:,:) :: xmass1
11  real, dimension(nspec) :: xmass1
12  character (len=150) :: outfile, fname
13
14  open (9, file='filelist')
1510 read (9,'(a)',end=90) fname
16 
17    open (10,file=trim(fname),form='unformatted')
18    print*, 'reading ',trim(fname)
19    read (10) itime, numpart_out, ioutgrid_option
20    print*, 'simulation time:',itime, 's', itime/3600., 'hrs'
21    print*, '#particles in this file:', numpart_out !, outgrid_option
22    if (ioutgrid_option .eq. 1) then
23      print*, 'output is lat-lon grid'
24    else
25      print*, 'output is on WRF projection'
26    endif
27    print*
28    write (outfile,900) itime/3600
29  900 format ('partpos_',i2.2,'.dat')
30  !  allocate (ztra1(numpart_out), xmass1(numpart_out,nspec)) ! etc
31
32    open (20, file=trim(outfile)  )
33    do i = 1, numpart_out
34!      print*, 'reading particle #',i
35      read (10) npoint,xlon,ylat,ztra1,itramem,topo, &
36        pvi,qvi,rhoi,hmixi,tri,tti,(xmass1(j),j=1,nspec)
37      write (20,901) i,xlon,ylat,ztra1,xmass1,topo,ztra1+topo,hmixi+topo
38  901 format (i7,3f10.4,2es12.3,3f8.1)
39    enddo
40  goto 10
41 
4290 close (9)
43 
44  end
45 
hosted by ZAMG