-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfastsolver.f90
executable file
·118 lines (114 loc) · 2.38 KB
/
fastsolver.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
module mod_solver
use mod_cons
use mod_var
use mod_global, only : myid
implicit none
private
public solver2d
contains
subroutine solver2d(pz,tri0_l,tri0_m,tri0_r)
use decomp_2d
implicit none
real, intent(inout), dimension(1:,1:,1:) :: pz
real, intent(in), dimension(1:kmax) :: tri0_l,tri0_m,tri0_r
real, dimension(itot/dims(1),jtot,ktot/dims(2)) :: py
real, dimension(itot,jtot/dims(1),ktot/dims(2)) :: px
real :: bb
real :: z,d(imax,jmax,kmax)
real :: di(itot),dj(jtot)
integer :: i,j,k
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
real, dimension(8) :: numbers
real :: ei(8),fi(8+15)
numbers = (/1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 /)
!
if (myid==1) then
call vrffti(8,fi)
call vrfftf(1,8,numbers(1:8),ei,1,fi)
do i=1,8
print*,i,numbers(i)
enddo
call vrfftb(1,8,numbers(1:8),ei,1,fi)
do i=1,8
print*,i,numbers(i)
enddo
endif
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
call transpose_z_to_y(pz,py)
call transpose_y_to_x(py,px)
!
do k=1,xsize(3)
do j=1,xsize(2)
call vrfftf(1,itot,px(1:itot,j,k),di,1,wi)
enddo
enddo
!
call transpose_x_to_y(px,py)
!
do k=1,ysize(3)
do i=1,ysize(1)
call vrfftf(1,jtot,py(i,1:jtot,k),dj,1,wj)
enddo
enddo
!
call transpose_y_to_z(py,pz)
!
do j=1,jmax
do i=1,imax
z = 1./(tri0_m(1)+xyrt(i,j))
d(i,j,1) = tri0_r(1)*z
pz(i,j,1) = pz(i,j,1)*z
enddo
enddo
do k=2,kmax-1
do j=1,jmax
do i=1,imax
bb = tri0_m(k)+xyrt(i,j)
z = 1./(bb-tri0_l(k)*d(i,j,k-1))
d(i,j,k) = tri0_r(k)*z
pz(i,j,k) = (pz(i,j,k)-tri0_l(k)*pz(i,j,k-1))*z
enddo
enddo
enddo
do j=1,jmax
do i=1,imax
bb = tri0_m(kmax)+xyrt(i,j)
z = bb-tri0_l(kmax)*d(i,j,kmax-1)
if(z.ne.0.) then
pz(i,j,kmax) = (pz(i,j,kmax)-tri0_l(kmax)*pz(i,j,kmax-1))/z
else
pz(i,j,kmax) =0.
endif
enddo
enddo
do k=kmax-1,1,-1
do j=1,jmax
do i=1,imax
pz(i,j,k) = pz(i,j,k)-d(i,j,k)*pz(i,j,k+1)
enddo
enddo
enddo
call transpose_z_to_y(pz,py)
do k=1,ysize(3)
do i=1,ysize(1)
call vrfftb(1,jtot,py(i,1:jtot,k),dj,1,wj)
enddo
enddo
!
call transpose_y_to_x(py,px)
!
do k=1,xsize(3)
do j=1,xsize(2)
call vrfftb(1,itot,px(1:itot,j,k),di,1,wi)
enddo
enddo
!
call transpose_x_to_y(px,py)
call transpose_y_to_z(py,pz)
!
return
end subroutine solver2d
!
end module mod_solver