Skip to content

Commit eac03e4

Browse files
Merge pull request #19 from mathrack/hack_doconcurrent
Add some comments for the Thomas algorithm.
2 parents ce85d62 + 048d8c0 commit eac03e4

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/thomas.f90

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,17 @@ subroutine zthomas_12(tt, ff, fs, fw, nx, ny, nz)
202202

203203
end subroutine zthomas_12
204204

205-
! Thomas algorithm for a 1D vector
206-
subroutine thomas1d(tt, ff, fs, fw, nn)
205+
!
206+
! Thomas algorithm for a 1D vector (solve My = x with tri-diagonal M)
207+
! See comments in the subroutine prepare (x3d_operator_1d.f90)
208+
!
209+
! tt, inout, vector x and y
210+
! ff, in, upper diagonal of the tri-diagonal matrix
211+
! fs, in, used during the forward step
212+
! fw, in, used during the backward step
213+
! nn, in, size of the vector
214+
!
215+
pure subroutine thomas1d(tt, ff, fs, fw, nn)
207216

208217
implicit none
209218

src/x3d_operator_1d.f90

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,21 @@ subroutine finalize(x3dop)
308308

309309
end subroutine finalize
310310

311+
!
312+
! Prepare Thomas algorithm for a tri-diagonal matrix M
313+
! See https://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm#Method
314+
! Here :
315+
! ( c(1) f(1) 0 0 0 ...
316+
! M = ( b(1) c(2) f(2) 0 0 ...
317+
! ( 0 b(2) c(3) f(3) 0 ...
318+
!
319+
! b, in, lower diagonal
320+
! c, in, diagonal coefficient
321+
! f, in, upper diagonal
322+
! s, out, vector for the forward step of the Thomas algo.
323+
! w, out, vector for the backward step of the Thomas algo.
324+
! n, in, size of the problem
325+
!
311326
subroutine prepare(b, c, f, s, w, n)
312327

313328
use decomp_2d, only: mytype

0 commit comments

Comments
 (0)