-
Notifications
You must be signed in to change notification settings - Fork 2
/
LES_Filtering_module.f90
184 lines (148 loc) · 7.93 KB
/
LES_Filtering_module.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
!------------------------------------------------------------------------------!
! !
! PROGRAM : LES_Filtering_module.f90 !
! !
! PURPOSE : Module for LES-filter the DNS data for turbulent channel flow. !
! !
! 2016.12.07 K.Noh !
! !
!------------------------------------------------------------------------------!
MODULE LES_FILTERING_module
IMPLICIT NONE
INTEGER :: N, Nx, Ny, Nz, Nx_fil, Nz_fil, &
VS_CASE, FILTER_OX, VS_ONLY, Y_ORDER
REAL(KIND=8) :: Del,dx,dz,FW,pi,tol
CHARACTER(LEN=65) :: file_name, dir_name, path_name
REAL(KIND=8),DIMENSION(:),ALLOCATABLE :: X,Y,Z,dy,YP
REAL(KIND=8),DIMENSION(:,:,:),ALLOCATABLE :: U,V,W,U_Fil,V_Fil,W_Fil, &
U_Fil_2,V_Fil_2,W_Fil_2, &
VS,Cs
REAL(KIND=8),DIMENSION(:,:,:,:,:),ALLOCATABLE :: Resi_T,S_T,S_T_Fil, &
Nu_R,O_T,O_T_Fil, &
S_T_Fil_2,L_T,M_T
CONTAINS
!------------------------------------------------------------------!
! Gaussian Filter Function !
!------------------------------------------------------------------!
FUNCTION G(Del,r)
REAL(KIND=8) :: G
REAL(KIND=8),INTENT(IN) :: Del, r
G = sqrt(6/(pi*Del**2))*exp(-6*(r**2/Del**2))
END FUNCTION G
!------------------------------------------------------------------!
! Finding Y point Function !
!------------------------------------------------------------------!
FUNCTION J_det(y_val)
INTEGER :: j, J_det
REAL(KIND=8),INTENT(IN) :: y_val
DO j = 1,Ny
IF (Y(j)>y_val) THEN
IF ( (Y(j) - y_val) < (y_val - Y(j-1))) THEN
J_det = j
ELSE
J_det = j-1
END IF
EXIT
END IF
END DO
END FUNCTION J_det
!------------------------------------------------------------------!
! U Selection !
!------------------------------------------------------------------!
FUNCTION FIND_U(i,j,k,v_i)
INTEGER,INTENT(IN) :: i,j,k,v_i
REAL(KIND=8) :: FIND_U
SELECT CASE(v_i)
CASE(1); FIND_U = U(i,j,k)
CASE(2); FIND_U = V(i,j,k)
CASE(3); FIND_U = W(i,j,k)
END SELECT
END FUNCTION FIND_U
!------------------------------------------------------------------!
! Filtered U Selection !
!------------------------------------------------------------------!
FUNCTION FIND_U_Fil(i,j,k,v_i)
INTEGER,INTENT(IN) :: i,j,k,v_i
REAL(KIND=8) :: FIND_U_Fil
SELECT CASE(v_i)
CASE(1); FIND_U_Fil = U_Fil(i,j,k)
CASE(2); FIND_U_Fil = V_Fil(i,j,k)
CASE(3); FIND_U_Fil = W_Fil(i,j,k)
END SELECT
END FUNCTION FIND_U_Fil
!------------------------------------------------------------------!
! Second Filtered U Selection !
!------------------------------------------------------------------!
FUNCTION FIND_U_Fil_2(i,j,k,v_i)
INTEGER,INTENT(IN) :: i,j,k,v_i
REAL(KIND=8) :: FIND_U_Fil_2
SELECT CASE(v_i)
CASE(1); FIND_U_Fil_2 = U_Fil_2(i,j,k)
CASE(2); FIND_U_Fil_2 = V_Fil_2(i,j,k)
CASE(3); FIND_U_Fil_2 = W_Fil_2(i,j,k)
END SELECT
END FUNCTION FIND_U_Fil_2
!------------------------------------------------------------------!
! dU Selection !
!------------------------------------------------------------------!
FUNCTION FIND_dU(i,j,k,x_i,x_j)
INTEGER,INTENT(IN) :: i,j,k,x_i,x_j
REAL(KIND=8) :: FIND_dU, U_ij(0:2,0:2,0:2)
SELECT CASE(x_i)
CASE(1); U_ij(0:2,0:2,0:2) = U(i-1:i+1,j-1:j+1,k-1:k+1)
CASE(2); U_ij(0:2,0:2,0:2) = V(i-1:i+1,j-1:j+1,k-1:k+1)
CASE(3); U_ij(0:2,0:2,0:2) = W(i-1:i+1,j-1:j+1,k-1:k+1)
END SELECT
SELECT CASE(x_j)
CASE(1); FIND_dU = (U_ij(2,1,1) - U_ij(0,1,1))
CASE(2); FIND_dU = (U_ij(1,2,1) - U_ij(1,0,1))
CASE(3); FIND_dU = (U_ij(1,1,2) - U_ij(1,1,0))
END SELECT
END FUNCTION FIND_dU
!------------------------------------------------------------------!
! dU_Fil Selection !
!------------------------------------------------------------------!
FUNCTION FIND_dU_Fil(i,j,k,x_i,x_j)
INTEGER,INTENT(IN) :: i,j,k,x_i,x_j
REAL(KIND=8) :: FIND_dU_Fil, U_ij(0:2,0:2,0:2)
SELECT CASE(x_i)
CASE(1); U_ij(0:2,0:2,0:2) = U_Fil(i-1:i+1,j-1:j+1,k-1:k+1)
CASE(2); U_ij(0:2,0:2,0:2) = V_Fil(i-1:i+1,j-1:j+1,k-1:k+1)
CASE(3); U_ij(0:2,0:2,0:2) = W_Fil(i-1:i+1,j-1:j+1,k-1:k+1)
END SELECT
SELECT CASE(x_j)
CASE(1); FIND_dU_Fil = (U_ij(2,1,1) - U_ij(0,1,1))
CASE(2); FIND_dU_Fil = (U_ij(1,2,1) - U_ij(1,0,1))
CASE(3); FIND_dU_Fil = (U_ij(1,1,2) - U_ij(1,1,0))
END SELECT
END FUNCTION FIND_dU_Fil
!------------------------------------------------------------------!
! dU_Fil_2 Selection !
!------------------------------------------------------------------!
FUNCTION FIND_dU_Fil_2(i,j,k,x_i,x_j)
INTEGER,INTENT(IN) :: i,j,k,x_i,x_j
REAL(KIND=8) :: FIND_dU_Fil_2, U_ij(0:2,0:2,0:2)
SELECT CASE(x_i)
CASE(1); U_ij(0:2,0:2,0:2) = U_Fil_2(i-1:i+1,j-1:j+1,k-1:k+1)
CASE(2); U_ij(0:2,0:2,0:2) = V_Fil_2(i-1:i+1,j-1:j+1,k-1:k+1)
CASE(3); U_ij(0:2,0:2,0:2) = W_Fil_2(i-1:i+1,j-1:j+1,k-1:k+1)
END SELECT
SELECT CASE(x_j)
CASE(1); FIND_dU_Fil_2 = (U_ij(2,1,1) - U_ij(0,1,1))
CASE(2); FIND_dU_Fil_2 = (U_ij(1,2,1) - U_ij(1,0,1))
CASE(3); FIND_dU_Fil_2 = (U_ij(1,1,2) - U_ij(1,1,0))
END SELECT
END FUNCTION FIND_dU_Fil_2
!------------------------------------------------------------------!
! dx Selection !
!------------------------------------------------------------------!
FUNCTION FIND_dx(i,j,k,x_j)
INTEGER,INTENT(IN) :: i,j,k,x_j
REAL(KIND=8) :: FIND_dx
SELECT CASE(x_j)
CASE(1); FIND_dx = 2*dx
CASE(2); FIND_dx = (dy(j)+dy(j+1))
CASE(3); FIND_dx = 2*dz
END SELECT
END FUNCTION FIND_dx
END MODULE