2 #include "sll_working_precision.h"
47 self%solver_k => solver_k
48 self%operator_l => operator_l
49 self%operator_lt => operator_lt
51 self%n_total0 = operator_l%n_global_cols
52 self%n_total1 = operator_l%n_global_rows
54 self%n_rows = solver_k%n_rows
55 self%n_cols = solver_k%n_cols
57 allocate(self%x_0(self%n_total0))
66 self%solver_k => null()
67 self%operator_l => null()
68 self%operator_lt => null()
75 sll_real64,
intent( in ) :: rhs(:)
76 sll_real64,
intent( out ) :: unknown(:)
78 sll_real64 :: rhs1(self%n_total1)
79 sll_real64 :: x0(self%n_total0)
85 call self%operator_l%dot(x0, rhs1)
87 call self%solver_k%solve(rhs1, unknown)
93 call self%check_convergence( i_iteration=itr_used, &
102 sll_real64,
intent(inout) :: x1(:)
103 sll_real64,
intent(inout) :: x0(:)
104 sll_int32,
intent(out) :: niterx
105 sll_real64,
intent(out) :: res
108 sll_real64 :: alpha, beta
109 sll_real64 :: a0(self%n_total0), p0(self%n_total0), r0(self%n_total0)
110 sll_real64 :: a1(self%n_total1), p1(self%n_total1)
113 call self%operator_lt%dot(x1, r0)
116 do k = 1, self%n_maxiter
119 call self%operator_l%dot(p0, a1)
120 call self%solver_k%solve(a1, p1)
121 call self%operator_lt%dot(p1, a0)
123 alpha = sum(p0*a0)/sum(p0*r0)
129 res = sqrt(sum(r0*r0)/real(self%n_total0,f64))
130 if(self%verbose) print*,
'residuum', res
131 if( res <= self%atol )
exit
133 if(sqrt(sum(p0*p0)/real(self%n_total0,f64)) < self%atol)
then
134 print*,
'error uzawa iterator: search direction too small '
136 beta = sum(r0*a0)/sum(p0*a0)
151 print *,
">>>> uzawa_iterator"
152 print *,
"* verbose : ", self%verbose
153 print *,
"* atol : ", self%atol
154 print *,
"* n_maxiter : ", self%n_maxiter
161 sll_real64,
dimension(:),
intent(in) :: x_0
171 sll_int32,
intent(in) :: i_iteration
172 logical,
intent(inout) :: flag
173 sll_real64,
optional,
intent(in) :: r_err
174 sll_real64,
dimension(:),
optional,
intent(in) :: arr_err
177 if (self%verbose)
then
178 if (
present(r_err))
then
179 if (i_iteration <= self%n_maxiter)
then
180 print*,
'* uzawa_iterator: convergence after', i_iteration,
'iterations. Error ', r_err
182 print *,
'* uzawa_iterator: Warning - max iterations', self%n_maxiter,
'achieved without convergence. Error', r_err
192 character(len=*) ,
intent(in) :: filename
198 logical ,
intent(in) :: verbose
200 call self%set_verbose_abstract(verbose)
module for abstract linear operator
module for abstract linear solver
module for abstract iterative linear solvers
subroutine solve_uzawa_iterator(self, rhs, unknown)
subroutine set_verbose_uzawa_iterator(self, verbose)
subroutine set_guess_uzawa_iterator(self, x_0)
subroutine read_from_file_uzawa_iterator(self, filename)
subroutine uzawa_iterator(self, x1, x0, niterx, res)
subroutine free_uzawa_iterator(self)
subroutine print_info_uzawa_iterator(self)
subroutine check_convergence_uzawa_iterator(self, i_iteration, flag, r_err, arr_err)
subroutine create_uzawa_iterator(self, solver_k, operator_l, operator_lt)
class for abstract linear operator
class for abstract linear solver
class for abstract iterative linear solver