51 subroutine sor_sprs(lgs_a_value, lgs_a_index, lgs_a_diag_index, lgs_a_ptr, &
53 nnz, nmax, omega, eps_sor, lgs_x_value, ierr)
57 integer(i4b),
intent(in) :: nnz, nmax
58 real(dp),
intent(in) :: omega, eps_sor
59 integer(i4b),
dimension(nmax+1),
intent(in) :: lgs_a_ptr
60 integer(i4b),
dimension(nnz),
intent(in) :: lgs_a_index
61 integer(i4b),
dimension(nmax),
intent(in) :: lgs_a_diag_index
62 real(dp),
dimension(nnz),
intent(in) :: lgs_a_value
63 real(dp),
dimension(nmax),
intent(in) :: lgs_b_value
65 integer(i4b),
intent(out) :: ierr
66 real(dp),
dimension(nmax),
intent(inout) :: lgs_x_value
69 integer(i4b) :: iter_max
71 real(dp),
allocatable,
dimension(:) :: lgs_x_value_prev
73 logical :: flag_convergence
75 #if (ITER_MAX_SOR > 0) 76 iter_max = iter_max_sor
81 allocate(lgs_x_value_prev(nmax))
83 iter_loop :
do iter=1, iter_max
85 lgs_x_value_prev = lgs_x_value
91 do k=lgs_a_ptr(nr), lgs_a_ptr(nr+1)-1
92 b_nr = b_nr + lgs_a_value(k)*lgs_x_value(lgs_a_index(k))
95 lgs_x_value(nr) = lgs_x_value(nr) &
96 -omega*(b_nr-lgs_b_value(nr)) &
97 /lgs_a_value(lgs_a_diag_index(nr))
101 flag_convergence = .true.
103 if (abs(lgs_x_value(nr)-lgs_x_value_prev(nr)) > eps_sor)
then 104 flag_convergence = .false.
109 if (flag_convergence)
then 110 write(6,
'(10x,a,i0)')
'sor_sprs: iter = ', iter
112 deallocate(lgs_x_value_prev)
118 write(6,
'(10x,a,i0)')
'sor_sprs: iter = ', iter
120 deallocate(lgs_x_value_prev)
133 subroutine tri_sle(a0, a1, a2, x, b, nrows)
137 integer(i4b),
intent(in) :: nrows
138 real(dp),
dimension(0:*),
intent(in) :: a0, a2
139 real(dp),
dimension(0:*),
intent(inout) :: a1, b
141 real(dp),
dimension(0:*),
intent(out) :: x
143 real(dp),
allocatable,
dimension(:) :: help_x
150 a1(n) = a1(n) - a0(n)/a1(n-1)*a2(n-1)
154 b(n) = b(n) - a0(n)/a1(n-1)*b(n-1)
167 allocate(help_x(0:nrows))
169 help_x(0) = b(nrows)/a1(nrows)
172 help_x(n) = b(nrows-n)/a1(nrows-n) &
173 -a2(nrows-n)/a1(nrows-n)*help_x(n-1)
177 x(n) = help_x(nrows-n)
194 function bilinint(x1, x2, y1, y2, z11, z12, z21, z22, x, y)
198 real(dp),
intent(in) :: x1, x2, y1, y2, z11, z12, z21, z22, x, y
203 real(dp),
parameter :: I = 1.0_dp
208 bilinint = (i-t)*(i-u)*z11 + (i-t)*u*z12 + t*(i-u)*z21 + t*u*z22
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 ...
Several mathematical tools used by SICOPOLIS.
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.
real(dp) function bilinint(x1, x2, y1, y2, z11, z12, z21, z22, x, y)
Bilinear interpolation.