24 public :: matrix_solver_tridiagonal
26 interface matrix_solver_tridiagonal
27 module procedure matrix_solver_tridiagonal_1d
28 module procedure matrix_solver_tridiagonal_3d
29 end interface matrix_solver_tridiagonal
47 subroutine matrix_solver_tridiagonal_1d( &
56 integer,
intent(in) :: ka
57 real(RP),
intent(in) :: ud(ka)
58 real(RP),
intent(in) :: md(ka)
59 real(RP),
intent(in) :: ld(ka)
60 real(RP),
intent(in) :: iv(ka)
61 real(RP),
intent(out) :: ov(ka)
73 c(k) = ud(k) / ( md(k) - ld(k) * c(k-1) )
74 d(k) = ( iv(k) - ld(k) * d(k-1) ) / ( md(k) - ld(k) * c(k-1) )
80 ov(k) = d(k) - c(k) * ov(k+1)
84 end subroutine matrix_solver_tridiagonal_1d
88 subroutine matrix_solver_tridiagonal_3d( &
99 integer,
intent(in) :: ka
100 integer,
intent(in) :: ia, is, ie
101 integer,
intent(in) :: ja, js, je
102 real(RP),
intent(in) :: ud(ka,ia,ja)
103 real(RP),
intent(in) :: md(ka,ia,ja)
104 real(RP),
intent(in) :: ld(ka,ia,ja)
105 real(RP),
intent(in) :: iv(ka,ia,ja)
106 real(RP),
intent(out) :: ov(ka,ia,ja)
108 real(RP) :: c(ka,ia,ja)
109 real(RP) :: d(ka,ia,ja)
117 c(1,i,j) = ud(1,i,j) / md(1,i,j)
118 d(1,i,j) = iv(1,i,j) / md(1,i,j)
125 c(k,i,j) = ud(k,i,j) &
126 / ( md(k,i,j) - ld(k,i,j) * c(k-1,i,j) )
127 d(k,i,j) = ( iv(k,i,j) - ld(k,i,j) * d(k-1,i,j) ) &
128 / ( md(k,i,j) - ld(k,i,j) * c(k-1,i,j) )
136 ov(ka,i,j) = d(ka,i,j)
143 ov(k,i,j) = d(k,i,j) - c(k,i,j) * ov(k+1,i,j)
149 end subroutine matrix_solver_tridiagonal_3d