-
Notifications
You must be signed in to change notification settings - Fork 39
/
SolveImpEqnUpdate_X.F90
67 lines (58 loc) · 1.95 KB
/
SolveImpEqnUpdate_X.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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! !
! FILE: SolveImpEqnUpdate_X.F90 !
! CONTAINS: subroutine SolveImpEqnUpdate_X !
! !
! PURPOSE: Inverts the implicit equation for velocity !
! in any the vertical direction, and updates it to !
! time t+dt !
! !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine SolveImpEqnUpdate_X
use param
use local_arrays, only : vx,rhs
use decomp_2d, only: xstart,xend
implicit none
real, dimension(nx) :: amkl,apkl,ackl
real :: amkT(nx-1),apkT(nx-1)
real :: appk(nx-2)
real :: ackT(nx)
integer :: jc,kc,info,ic,nrhs
integer :: ipkv(nx)
real :: betadx,ackl_b
betadx=beta*al
amkl(1)=0.d0
apkl(1)=0.d0
ackl(1)=1.d0
do kc=2,nxm
ackl_b=1.0d0/(1.0d0-ac3ck(kc)*betadx)
amkl(kc)=-am3ssk(kc)*betadx*ackl_b
ackl(kc)=1.0d0
apkl(kc)=-ap3ssk(kc)*betadx*ackl_b
enddo
amkl(nx)=0.d0
apkl(nx)=0.d0
ackl(nx)=1.d0
amkT=amkl(2:nx)
apkT=apkl(1:(nx-1))
ackT=ackl(1:nx)
call dgttrf(nx,amkT,ackT,apkT,appk,ipkv,info)
nrhs=(xend(3)-xstart(3)+1)*(xend(2)-xstart(2)+1)
do ic=xstart(3),xend(3)
do jc=xstart(2),xend(2)
do kc=2,nxm
ackl_b=1.0/(1.0-ac3ck(kc)*betadx)
rhs(kc,jc,ic)=rhs(kc,jc,ic)*ackl_b
end do
end do
end do
call dgttrs('N',nx,nrhs,amkT,ackT,apkT,appk,ipkv,rhs,nx,info)
do ic=xstart(3),xend(3)
do jc=xstart(2),xend(2)
do kc=2,nxm
vx(kc,jc,ic)=vx(kc,jc,ic) + rhs(kc,jc,ic)
end do
end do
end do
return
end