-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprefft.f90
executable file
·87 lines (79 loc) · 1.55 KB
/
prefft.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
module mod_prefft
use mod_var
use mod_cons
use decomp_2d
implicit none
private
public init_tri,initsolver
contains
!
subroutine init_tri
integer :: k
!
! Generate tridiagonal matrix
! l is k-1, m is k, r is k+1
do k=1,kmax
tri1_l(k) = dzi*dzi
tri2_l(k) = dzi*dzi
tri1_r(k) = dzi*dzi
tri2_r(k) = dzi*dzi
tri1_m(k) = -(tri1_l(k) + tri1_r(k))
tri2_m(k) = -(tri2_l(k) + tri2_r(k))
enddo
!
! Neumann boundary condition, wall at both top and bottom
! a is k-1, b is k, c is k+1
tri1_m(1) = tri1_m(1) + tri1_l(1)
tri1_m(kmax) = tri1_m(kmax) + tri1_r(kmax)
tri1_l(1) = 0.
tri1_r(kmax) = 0.
! outlet at top and wall at bottom
tri2_m(1) = tri2_m(1) + tri2_l(1)
tri2_m(kmax) = tri2_m(kmax)
tri2_l(1) = 0.
tri2_r(kmax) = 0.
!end select
end subroutine init_tri
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
subroutine initsolver
integer :: i,j,iv,jv
real :: xrt(itot), yrt(jtot)
! set lookup tables.
!
call vrffti(itot,wi)
call vrffti(jtot,wj)
!
! generate eigenvalues ( xrt and yrt ).
!
!
! x direction
!
do i=3,itot,2
xrt(i-1) = -4.*dxi*dxi*(sin(float((i-1))*pi/(2.*itot)))**2
xrt(i) = xrt(i-1)
enddo
xrt(1 ) = 0.
xrt(itot) = -4.*dxi*dxi
!
! y direction
!
do j=3,jtot,2
yrt(j-1) = -4.*dyi*dyi*(sin(float((j-1))*pi/(2.*jtot)))**2
yrt(j ) = yrt(j-1)
enddo
yrt(1 ) = 0.
yrt(jtot) = -4.*dyi*dyi
!
do j=1,jmax
jv = j + zstart(2) - 1
do i=1,imax
iv = i + zstart(1) - 1
xyrt(i,j) = xrt(iv)+yrt(jv)
enddo
enddo
!
return
end subroutine initsolver
!
end module mod_prefft