2 c---------------------------------------------------------------------
3 c---------------------------------------------------------------------
7 c---------------------------------------------------------------------
8 c---------------------------------------------------------------------
13 character*(128) newfilenm
16 if (node.eq.root) record_length = 40/fortran_rec_sz
17 call mpi_bcast(record_length, 1, MPI_INTEGER,
18 > root, comm_setup, ierr)
20 open (unit=99, file=filenm,
21 $ form='unformatted', access='direct',
34 c---------------------------------------------------------------------
35 c---------------------------------------------------------------------
37 subroutine output_timestep
39 c---------------------------------------------------------------------
40 c---------------------------------------------------------------------
44 integer ix, jio, kio, cio
47 do kio=0, cell_size(3,cio)-1
48 do jio=0, cell_size(2,cio)-1
49 iseek=(cell_low(1,cio) +
50 $ PROBLEM_SIZE*((cell_low(2,cio)+jio) +
51 $ PROBLEM_SIZE*((cell_low(3,cio)+kio) +
52 $ PROBLEM_SIZE*idump_sub)))
54 do ix=0,cell_size(1,cio)-1
55 write(99, rec=iseek+ix+1)
56 $ u(1,ix, jio,kio,cio),
57 $ u(2,ix, jio,kio,cio),
58 $ u(3,ix, jio,kio,cio),
59 $ u(4,ix, jio,kio,cio),
60 $ u(5,ix, jio,kio,cio)
66 idump_sub = idump_sub + 1
67 if (rd_interval .gt. 0) then
68 if (idump_sub .ge. rd_interval) then
70 call acc_sub_norms(idump+1)
79 c---------------------------------------------------------------------
80 c---------------------------------------------------------------------
82 subroutine acc_sub_norms(idump_cur)
89 integer ix, jio, kio, cio, ii, m, ichunk
90 double precision xce_single(5)
92 ichunk = idump_cur - idump_sub + 1
95 do kio=0, cell_size(3,cio)-1
96 do jio=0, cell_size(2,cio)-1
97 iseek=(cell_low(1,cio) +
98 $ PROBLEM_SIZE*((cell_low(2,cio)+jio) +
99 $ PROBLEM_SIZE*((cell_low(3,cio)+kio) +
103 do ix=0,cell_size(1,cio)-1
104 read(99, rec=iseek+ix+1)
105 $ u(1,ix, jio,kio,cio),
106 $ u(2,ix, jio,kio,cio),
107 $ u(3,ix, jio,kio,cio),
108 $ u(4,ix, jio,kio,cio),
109 $ u(5,ix, jio,kio,cio)
115 if (node .eq. root) print *, 'Reading data set ', ii+ichunk
117 call error_norm(xce_single)
119 xce_sub(m) = xce_sub(m) + xce_single(m)
126 c---------------------------------------------------------------------
127 c---------------------------------------------------------------------
129 subroutine btio_cleanup
131 c---------------------------------------------------------------------
132 c---------------------------------------------------------------------
139 c---------------------------------------------------------------------
140 c---------------------------------------------------------------------
142 subroutine accumulate_norms(xce_acc)
144 c---------------------------------------------------------------------
145 c---------------------------------------------------------------------
149 double precision xce_acc(5)
152 if (rd_interval .gt. 0) goto 20
154 open (unit=99, file=filenm,
155 $ form='unformatted', access='direct',
156 $ recl=record_length)
158 c clear the last time step
162 c read back the time steps and accumulate norms
164 call acc_sub_norms(idump)
170 xce_acc(m) = xce_sub(m) / dble(idump)