-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavg_tempslice_window.f90
61 lines (45 loc) · 1.33 KB
/
avg_tempslice_window.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
program
implicit none
integer, parameter :: nx = 512, ny = 512
integer :: x, y, sn
real*8 :: T(1:nx, 1:ny), T_mean(1:nx,1:ny)
character*80 :: fn1, fn2, fn3, fn4
character*8 :: nfile, nfile1
sn = 15 ! snapshot number for slicing window
wl = 5 ! length of window
if (mod(wl,2) .eq. 0) then
imin = sn-wl/2
imax = sn+wl/2-1
else
imin = sn-(wl-1)/2
imax = sn+(wl-1)/2
endif
T_mean(:,:) = 0.0
cnt1 = 0
do sn1 = imin, imax
write(nfile, '(I3.3)') sn1
print*, nfile
fn1 = 'temp_z.dat_'//nfile
open(11, file = fn1, form = 'unformatted', access = 'stream')
do y = 1, ny
do x = 1, nx
read(11) T(x,y)
enddo
enddo
T_mean(:,:) = T_mean(:,:) + T(:,:)
close(11)
cnt1 = cnt1+1
enddo
print*, cnt1
T_mean(:,:) = T_mean(:,:)/cnt1
write(nfile1, '(I3.3)') sn
fn2 = 'mean_temp_z.dat_'//nfile1
open(12, file = fn2, form = 'unformatted', access = 'stream')
do y = 1, ny
do x = 1, nx
write(12) T_mean(x,y)
enddo
enddo
print*, ' Done'
stop
end program