47 subroutine sor_sprs(lgs_a_value, lgs_a_index, lgs_a_diag_index, lgs_a_ptr, &
49 nnz, nmax, omega, eps_sor, lgs_x_value, ierr)
53 integer(i4b),
intent(in) :: nnz, nmax
54 real(dp),
intent(in) :: omega, eps_sor
55 integer(i4b),
dimension(nmax+1),
intent(in) :: lgs_a_ptr
56 integer(i4b),
dimension(nnz),
intent(in) :: lgs_a_index
57 integer(i4b),
dimension(nmax),
intent(in) :: lgs_a_diag_index
58 real(dp),
dimension(nnz),
intent(in) :: lgs_a_value
59 real(dp),
dimension(nmax),
intent(in) :: lgs_b_value
61 integer(i4b),
intent(out) :: ierr
62 real(dp),
dimension(nmax),
intent(inout) :: lgs_x_value
66 real(dp),
allocatable,
dimension(:) :: lgs_x_value_prev
68 logical :: flag_convergence
70 allocate(lgs_x_value_prev(nmax))
72 iter_loop :
do iter=1, 1000
74 lgs_x_value_prev = lgs_x_value
80 do k=lgs_a_ptr(nr), lgs_a_ptr(nr+1)-1
81 b_nr = b_nr + lgs_a_value(k)*lgs_x_value(lgs_a_index(k))
84 lgs_x_value(nr) = lgs_x_value(nr) &
85 -omega*(b_nr-lgs_b_value(nr)) &
86 /lgs_a_value(lgs_a_diag_index(nr))
90 flag_convergence = .true.
92 if (abs(lgs_x_value(nr)-lgs_x_value_prev(nr)) > eps_sor)
then
93 flag_convergence = .false.
98 if (flag_convergence)
then
99 write(6,
'(11x,a,i5)')
'sor_sprs: iter = ', iter
101 deallocate(lgs_x_value_prev)
107 write(6,
'(a,i5)')
'sor_sprs: iter = ', iter
109 deallocate(lgs_x_value_prev)
126 integer(i4b),
intent(in) :: nrows
127 real(dp),
dimension(0:*),
intent(in) :: a0, a2
128 real(dp),
dimension(0:*),
intent(inout) :: a1, b
130 real(dp),
dimension(0:*),
intent(out) :: x
132 real(dp),
allocatable,
dimension(:) :: help_x
139 a1(n) = a1(n) - a0(n)/a1(n-1)*a2(n-1)
143 b(n) = b(n) - a0(n)/a1(n-1)*b(n-1)
156 allocate(help_x(0:nrows))
158 help_x(0) = b(nrows)/a1(nrows)
161 help_x(n) = b(nrows-n)/a1(nrows-n) &
162 -a2(nrows-n)/a1(nrows-n)*help_x(n-1)
166 x(n) = help_x(nrows-n)
subroutine tri_sle(a0, a1, a2, x, b, nrows)
Solution of a system of linear equations Ax=b with tridiagonal matrix A.
Declarations of kind types for SICOPOLIS.
subroutine sor_sprs(lgs_a_value, lgs_a_index, lgs_a_diag_index, lgs_a_ptr, lgs_b_value, nnz, nmax, omega, eps_sor, lgs_x_value, ierr)
SOR solver for a system of linear equations lgs_a*lgs_x=lgs_b [matrix storage: compressed sparse row ...
Solvers for systems of linear equations used by SICOPOLIS.