-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSEM_write.f90
146 lines (129 loc) · 7.25 KB
/
SEM_write.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
!------------------------------------------------------------------------------!
! !
! PROGRAM : SEM_write.f90 !
! !
! PURPOSE : Write each variables in the RESULT folder. !
! !
! 2017.03.02 K.Noh !
! !
!------------------------------------------------------------------------------!
SUBROUTINE OUTPUT
USE SEM_module, &
ONLY : N, Ny, Nz, Nt, dt, time, file_name, dir_name, path_name
USE SEM_module, &
ONLY : Y, Z, U, V, W, T, RS, THS, &
U_INLET, V_INLET, W_INLET, T_INLET, SEM_EDDY, &
U_COMB, V_COMB, W_COMB, T_COMB, U_c, U_pr, rms_pr
IMPLICIT NONE
INTEGER :: it,j,k
REAL(KIND=8) :: time_sta, time_end, U_mean(4,1:Ny), rms_mean(8,1:Ny)
U_mean(1:4,1:Ny) = 0.0
rms_mean(1:8,1:Ny) = 0.0
! WRITE(*,*) '----------------------------------------------------'
! WRITE(*,*) ' WRITING PROCESS STARTED '
CALL CPU_TIME(time_sta)
dir_name = 'RESULT'
!----------------------------------------------------------------!
! Outputs for U Slice !
!----------------------------------------------------------------!
! file_name = '/U_ins.plt'
! path_name = TRIM(dir_name)//TRIM(file_name)
!
! OPEN(100,FILE=path_name,FORM='FORMATTED',POSITION='APPEND')
! WRITE(100,*) 'VARIABLES = Z,Y,U_ins,V_ins,W_ins'
! WRITE(100,"(2(A,I3,2X))")' ZONE I = ',Nz,' J = ',Ny
! WRITE(100,*) 'SOLUTIONTIME =',time
!
! DO j = 1,Ny
! DO k = 1,Nz
!
! WRITE(100,"(5F15.9)") Z(k),Y(j), &
! U_COMB(j,k),V_COMB(j,k),W_COMB(j,k)
!
! END DO
! END DO
! WRITE(100,*)
! CLOSE(100)
!----------------------------------------------------------------!
! Outputs for U mean profiles !
!----------------------------------------------------------------!
file_name = '/Mean_profiles.plt'
path_name = TRIM(dir_name)//TRIM(file_name)
IF ( INT(time/dt) == Nt) THEN
OPEN(100,FILE=path_name,FORM='FORMATTED',POSITION='APPEND')
WRITE(100,*)'VARIABLES = Y,U_ins,U_exac,V_ins,V_exac,W_ins,W_exac,T_ins,T_exac'
DO j = 1,Ny
DO k = 1,Nz
U_mean(1,j) = U_mean(1,j) + U(j,k)
U_mean(2,j) = U_mean(2,j) + V(j,k)
U_mean(3,j) = U_mean(3,j) + W(j,k)
U_mean(4,j) = U_mean(4,j) + T(j,k)
END DO
U_mean(1:4,j) = U_mean(1:4,j)/Nz
WRITE(100,"(9F15.9)") Y(j), U_pr(1,j), U_mean(1,j), &
U_pr(2,j), U_mean(2,j), &
U_pr(3,j), U_mean(3,j), &
U_pr(4,j), U_mean(4,j)
END DO
WRITE(100,*)
CLOSE(100)
END IF
!----------------------------------------------------------------!
! Outputs for Reynolds stress profiles !
!----------------------------------------------------------------!
file_name = '/RMS_profiles.plt'
path_name = TRIM(dir_name)//TRIM(file_name)
IF ( INT(time/dt) == Nt) THEN
OPEN(100,FILE=path_name,FORM='FORMATTED',POSITION='APPEND')
WRITE(100,*)'VARIABLES = Y,uu,uu_exac,vv,vv_exac,ww,ww_exac,tt,tt_exac,uv,uv_exac,ut,ut_exac,vt,vt_exac,wt,wt_exac'
DO j = 1,Ny
DO k = 1,Nz
rms_mean(1,j) = rms_mean(1,j) + RS(1,j,k)
rms_mean(2,j) = rms_mean(2,j) + RS(2,j,k)
rms_mean(3,j) = rms_mean(3,j) + RS(3,j,k)
rms_mean(4,j) = rms_mean(4,j) + THS(1,j,k)
rms_mean(5,j) = rms_mean(5,j) + RS(4,j,k)
rms_mean(6,j) = rms_mean(6,j) + THS(2,j,k)
rms_mean(7,j) = rms_mean(7,j) + THS(3,j,k)
rms_mean(8,j) = rms_mean(8,j) + THS(4,j,k)
END DO
rms_mean(1:8,j) = rms_mean(1:8,j)/Nz
WRITE(100,"(17F15.9)") Y(j), rms_pr(1,j), rms_mean(1,j), &
rms_pr(2,j), rms_mean(2,j), &
rms_pr(3,j), rms_mean(3,j), &
rms_pr(4,j), rms_mean(4,j), &
rms_pr(5,j), rms_mean(5,j), &
rms_pr(6,j), rms_mean(6,j), &
rms_pr(7,j), rms_mean(7,j), &
rms_pr(8,j), rms_mean(8,j)
END DO
WRITE(100,*)
CLOSE(100)
END IF
!----------------------------------------------------------------!
! Outputs for Eddy posoitions !
!----------------------------------------------------------------!
! file_name = '/EDDY_POS.plt'
! path_name = TRIM(dir_name)//TRIM(file_name)
!
! OPEN(100,FILE=path_name,FORM='FORMATTED',POSITION='APPEND')
! WRITE(100,*) 'VARIABLES = X,Y,Z'
! WRITE(100,*) 'ZONE'
! WRITE(100,*) 'SOLUTIONTIME =',time
!
! DO it = 1,N
! WRITE(100,*) SEM_EDDY(it)%X_pos*10,SEM_EDDY(it)%Y_pos, &
! SEM_EDDY(it)%Z_pos
! END DO
! WRITE(100,*)
! CLOSE(100)
CALL CPU_TIME(time_end)
! WRITE(*,*) ' WRITING PROCESS IS COMPLETED '
! WRITE(*,*) ' Total Writing time : ',time_end - time_sta,' s'
! WRITE(*,*) '----------------------------------------------------'
! WRITE(*,*) ''
IF ( INT(time/dt) == Nt) THEN
DEALLOCATE(Y,Z,U,V,W,T,RS,THS,U_INLET,V_INLET,W_INLET,T_INLET)
DEALLOCATE(SEM_EDDY,U_COMB,V_COMB,W_COMB,T_COMB,U_pr,rms_pr,U_c)
END IF
END SUBROUTINE OUTPUT