SPEED
WRITE_FILEOUT_GRID.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine write_fileout_grid (file_name, file_xyz, count, proc, nv, vec
 Writes output results for Restart.
 

Function/Subroutine Documentation

◆ write_fileout_grid()

subroutine write_fileout_grid ( character*70  file_name,
character*70  file_xyz,
integer*4  count,
integer*4  proc,
integer*4  nv,
real*8, dimension(nv)  vec 
)

Writes output results for Restart.

Author
Ilario Mazzieri
Date
September, 2013
Version
1.0
Parameters
[in,out]file_namedirectory where saving files
[in]countindex for snapshot
[in]procmpi process id
[in]nvnumber of values to print
[in]vecvalues to print
[in]xx,yy,zzcoordinates of the grid nodes to print
[in]localto global numbering for nodes

Definition at line 31 of file WRITE_FILEOUT_GRID.f90.

32
33
34 character*70 :: file_name, file_xyz
35
36 integer*4 :: count,proc,nv
37
38 real*8 :: tstart
39 real*8, dimension(nv) :: vec
40
41 real*8, dimension(nv/3) :: xx,yy,zz
42 integer*4, dimension(nv/3) :: loc_n_num
43
44 character*70 :: out_file, xyz_file
45 integer*4 :: i,lname, lnamexyz
46
47 lname = len_trim(file_name)
48 lnamexyz = len_trim(file_xyz)
49
50 out_file = file_name(1:lname) // '000000_000000.out'
51 xyz_file = file_xyz(1:lname) // '000000.out'
52
53 if (proc .lt. 10) then
54 write(out_file(lname+6:lname+6),'(i1)') proc
55 if(tstart .eq. 0.d0) write(xyz_file(lname+6:lname+6),'(i1)') proc
56 else if (proc .lt. 100) then
57 write(out_file(lname+5:lname+6),'(i2)') proc
58 if(tstart .eq. 0.d0) write(xyz_file(lname+5:lname+6),'(i2)') proc
59 else if (proc .lt. 1000) then
60 write(out_file(lname+4:lname+6),'(i3)') proc
61 if(tstart .eq. 0.d0) write(xyz_file(lname+4:lname+6),'(i3)') proc
62 else if (proc .lt. 10000) then
63 write(out_file(lname+3:lname+6),'(i4)') proc
64 if(tstart .eq. 0.d0) write(xyz_file(lname+3:lname+6),'(i4)') proc
65 else if (proc .lt. 100000) then
66 write(out_file(lname+2:lname+6),'(i5)') proc
67 if(tstart .eq. 0.d0) write(xyz_file(lname+2:lname+6),'(i5)') proc
68 else
69 write(out_file(lname+1:lname+6),'(i6)') proc
70 if(tstart .eq. 0.d0) write(xyz_file(lname+1:lname+6),'(i6)') proc
71 endif
72
73 if (count .lt. 10) then
74 write(out_file(lname+13:lname+13),'(i1)') count
75 else if (count .lt. 100) then
76 write(out_file(lname+12:lname+13),'(i2)') count
77 else if (count .lt. 1000) then
78 write(out_file(lname+11:lname+13),'(i3)') count
79 else if (count .lt. 10000) then
80 write(out_file(lname+10:lname+13),'(i4)') count
81 else if (count .lt. 100000) then
82 write(out_file(lname+9:lname+13),'(i5)') count
83 else
84 write(out_file(lname+8:lname+13),'(i6)') count
85 endif
86
87 open(20+proc, file=out_file)
88 do i = 1,nv
89 write(20+proc,*) vec(i)
90 enddo
91 close(20+proc)
92
93
94! write(20+proc,*) loc_n_num(i), xx(i), yy(i), zz(i), &
95! vec(3*(i-1)+1), vec(3*(i-1)+2),vec(3*(i-1)+3)
96 open(20+proc, file=xyz_file)
97 do i = 1,nv/3
98 write(20+proc,*) loc_n_num(i), xx(i), yy(i), zz(i)
99 enddo
100 close(20+proc)
101
102
103
104 return
105