-
Notifications
You must be signed in to change notification settings - Fork 0
/
solxk.f90
executable file
·60 lines (48 loc) · 1.44 KB
/
solxk.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
subroutine solxk(q,betadx)
use param
use local_arrays, only : rhs
use mpi_param
use mpih
implicit none
real, intent(inout) :: q(1:n1,1:n2,kstart:kend)
real, allocatable, dimension(:) :: amkl,apkl,ackl,fkl
integer :: jc,kc,ic
real :: betadx,ackl_b
real,allocatable :: rhst(:,:,:)
allocate(rhst(1:n3,1:n1,jstart:jend))
allocate(amkl(1:n3))
allocate(apkl(1:n3))
allocate(ackl(1:n3))
allocate(fkl(1:n3))
call PackZ_UnpackR(rhs(:,:,kstart:kend),rhst(:,:,jstart:jend))
do jc=jstart,jend
do ic=1,n1m
do kc=1,n3m
ackl_b=1.0d0/(1.+2.0*betadx)
amkl(kc)=-betadx*ackl_b
ackl(kc)=1.0d0
apkl(kc)=-betadx*ackl_b
fkl(kc)=rhst(kc,ic,jc)*ackl_b
end do
call tridiag_periodic(amkl,ackl,apkl,fkl,1,n3m,n3)
do kc=1,n3m
rhst(kc,ic,jc)=fkl(kc)
end do
enddo
end do
call PackR_UnpackZ(rhst(:,:,jstart:jend),rhs(:,:,kstart:kend))
! Update velocities
do kc=kstart,kend
do jc=1,n2m
do ic=1,n1m
q(ic,jc,kc) = q(ic,jc,kc) + rhs(ic,jc,kc)
enddo
enddo
enddo
if(allocated(rhst)) deallocate(rhst)
if(allocated(amkl)) deallocate(amkl)
if(allocated(ackl)) deallocate(apkl)
if(allocated(apkl)) deallocate(ackl)
if(allocated(fkl)) deallocate(fkl)
return
end