-
Notifications
You must be signed in to change notification settings - Fork 4
/
RANS_getdis.f90
64 lines (51 loc) · 2.49 KB
/
RANS_getdis.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
!-----------------------------------------------------------------------------------!
!
! PROGRAM : RANS_getdis.f90
!
! PURPOSE : Get dis(dissipation) using k-e model relation
!
! 2016.11.20 K.Noh
!
!-----------------------------------------------------------------------------------!
SUBROUTINE GETDIS
USE RANS_module, &
ONLY : Ny, dy, nu, Se, Ce1, Ce2, alpha, beta
USE RANS_module, &
ONLY : k_new, dis, dis_new, U_new, nu_T, prod
IMPLICIT NONE
INTEGER :: i,j
REAL(KIND=8),DIMENSION(:),ALLOCATABLE :: a,b,c,r,x
ALLOCATE ( a(0:Ny), b(0:Ny), c(0:Ny), r(0:Ny), x(0:Ny))
!-----------------------------------------------------------!
! Set TDMA constants
!-----------------------------------------------------------!
DO j = 1,Ny-1
a(j) = Se*2*nu + nu_T(j-1) + nu_T(j)
b(j) = -(Se*4*nu + nu_T(j+1) + 2*nu_T(j) + nu_T(j-1))
c(j) = Se*2*nu + nu_T(j+1) + nu_T(j)
r(j) = 2*dy**2*Se* ( Ce2*dis(j)**2/k_new(j) &
- Ce1*dis(j)/k_new(j)*prod(j) )
END DO
x(0:Ny) = dis(0:Ny)
!-----------------------------------------------------------!
! Boundary conditions
!-----------------------------------------------------------!
b(0) = 1
b(Ny) = 1
a(Ny) = 0
c(0) = 0
r(0) = 2*nu*k_new(1)/(dy**2)
r(Ny) = 2*nu*k_new(Ny-1)/(dy**2)
r(0:Ny) = r(0:Ny) + b(0:Ny) * dis(0:Ny)*(1-alpha)/alpha
b(0:Ny) = b(0:Ny) / alpha
!-----------------------------------------------------------!
! Calculate TDMA
!-----------------------------------------------------------!
CALL TDMA_Solver(a,b,c,r,x,Ny)
!-----------------------------------------------------------!
! Relaxation & Update
!-----------------------------------------------------------!
dis_new(0:Ny) = beta * x(0:Ny) + (1-beta) * dis(0:Ny)
dis(0:Ny) = dis_new(0:Ny)
DEALLOCATE(a,b,c,r,x)
END SUBROUTINE GETDIS