Guest User

Untitled

a guest
Mar 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. program exporttest
  2.  
  3. implicit none
  4.  
  5. integer(8), parameter :: Stot= 2
  6. integer(8), dimension(:), allocatable :: Nfp, Nf, Nfvp, Nfv
  7. integer(4) :: rank, s
  8. character(10) :: rankstring, sstring
  9. character(*), parameter :: datadir= '/Users/robertalbarran/Desktop/DISSERTATION/DSMCDATA/'
  10. character(50) :: NfTfile
  11.  
  12. type Specietype
  13. integer(8), dimension(:), allocatable :: NfT, NfvT
  14. end type Specietype
  15. type(Specietype), dimension(:), allocatable :: SpecieT
  16.  
  17. allocate(SpecieT(Stot))
  18. allocate(Nfp(Stot), Nfvp(Stot))
  19. allocate(SpecieT(Stot)%NfT(1), SpecieT(Stot)%NfvT(1))
  20. rank= 0
  21.  
  22. ! import data
  23.  
  24. do s= 1, Stot, 1
  25. write(sstring, '(I5)') s
  26. allocate(Nf(1))
  27.  
  28. open (unit= 0, file= datadir // adjustl(adjustr(sstring) // ':' // 'Nfmat.bin'), &
  29. status= 'old', form= 'unformatted', access= 'stream')
  30. read(0) Nfp(s)
  31. close(0)
  32.  
  33. Nf(1)= Nfp(s)
  34. SpecieT(s)%NfT= Nf
  35.  
  36. deallocate(Nf)
  37. end do
  38. deallocate(Nfp)
  39.  
  40. write(*, *) 'NfT s1= ', SpecieT(1)%NfT(1)
  41. write(*, *) 'NfT s2= ', SpecieT(2)%NfT(1)
  42.  
  43. ! export data
  44.  
  45. write(rankstring, '(i10)') rank
  46.  
  47. do s= 1, Stot, 1
  48. write(sstring, '(I5)') s
  49.  
  50. NfTfile= &
  51. datadir // adjustl(adjustr(rankstring) // ':' // &
  52. adjustl(adjustr(sstring) // ':' // 'NfTfort.bin'))
  53. open(unit= 0, status= 'replace', file= NfTfile, form= 'unformatted', &
  54. access= 'stream')
  55. write(0) SpecieT(s)%NfT
  56. close(0)
  57.  
  58. end do
  59.  
  60. ! import exported data
  61.  
  62. do s= 1, Stot, 1
  63. write(sstring, '(I5)') s
  64. allocate(Nfv(1))
  65.  
  66. open (unit= 0, file= datadir // adjustl(adjustr(rankstring) // ':' // &
  67. adjustl(adjustr(sstring) // ':' // 'NfTfort.bin')), &
  68. status= 'old', form= 'unformatted', access= 'stream')
  69. read(0) Nfvp(s)
  70. close(0)
  71.  
  72. Nfv(1)= Nfvp(s)
  73. SpecieT(s)%NfvT= Nfv
  74.  
  75. deallocate(Nfv)
  76. end do
  77. deallocate(Nfvp)
  78.  
  79. write(*, *) 'NfvT s1= ', SpecieT(1)%NfvT(1)
  80. write(*, *) 'NfvT s2= ', SpecieT(2)%NfvT(1)
  81.  
  82. end program exporttest
  83.  
  84. NfT s1= 1
  85. NfT s2= 1
  86. At line 68 of file exporttest.f90
  87. Fortran runtime error: Cannot open file '/Users/robertalbarran/Desktop/DISSERTATION/DSMCDATA/0:1:NfTfort.bin': No such file or directory
  88.  
  89. Error termination. Backtrace:
  90. #0 0x1052bee46
  91. #1 0x1052bf718
  92. #2 0x1052bfd7c
  93. #3 0x10534005a
  94. #4 0x1053406e3
  95. #5 0x1050c59de
  96. #6 0x1050c5c5e
Add Comment
Please, Sign In to add comment