37 integer(kind=kint ),
intent(inout):: iter, error
38 real (kind=
kreal),
intent(inout):: resid, tset, tsol, tcomm
40 integer(kind=kint ) :: n, np, ndof, nndof
41 integer(kind=kint ) :: my_rank
42 integer(kind=kint ) :: iterlog, timelog
43 real(kind=
kreal),
pointer :: b(:), x(:)
45 real(kind=
kreal),
dimension(:,:),
allocatable :: ww
47 integer(kind=kint),
parameter :: r= 1
48 integer(kind=kint),
parameter :: z= 2
49 integer(kind=kint),
parameter :: q= 2
50 integer(kind=kint),
parameter :: p= 3
51 integer(kind=kint),
parameter :: wk= 4
53 integer(kind=kint ) :: maxit
56 real (kind=
kreal) :: tol
57 real (kind=
kreal)::s_time,s1_time,e_time,e1_time, start_time, end_time
58 real (kind=
kreal)::bnrm2
59 real (kind=
kreal)::rho,rho1,beta,c1,alpha,dnrm2
60 real (kind=
kreal)::t_max,t_min,t_avg,t_sd
61 integer(kind=kint) ::estcond
62 real (kind=
kreal),
allocatable::d(:),e(:)
63 real (kind=
kreal)::alpha1
64 integer(kind=kint) :: n_indef_precond
66 integer(kind=kint) :: n_iter_recompute_r
67 integer(kind=kint),
parameter :: n_iter_recompute_r_default= 50
81 my_rank = hecmesh%my_rank
92 if (n_iter_recompute_r == 0) n_iter_recompute_r = n_iter_recompute_r_default
94 if (n_iter_recompute_r < 0) n_iter_recompute_r = maxit + 1
102 allocate (ww(ndof*np, 4))
122 if (estcond /= 0 .and. hecmesh%my_rank == 0)
then
123 allocate(d(maxit),e(maxit-1))
141 if (bnrm2.eq.0.d0)
then
149 if (timelog.eq.2)
then
151 t_max, t_min, t_avg, t_sd)
152 if (hecmesh%my_rank.eq.0)
then
153 write(*,*)
'Time solver setup'
154 write(*,*)
' Max :',t_max
155 write(*,*)
' Min :',t_min
156 write(*,*)
' Avg :',t_avg
157 write(*,*)
' Std Dev :',t_sd
161 tset = e_time - s_time
187 if (rho == 0.d0)
then
190 elseif (iter > 1 .and. rho*rho1 <= 0)
then
191 n_indef_precond = n_indef_precond + 1
192 if (n_indef_precond >= 10)
then
197 elseif (rho /= rho)
then
210 if ( iter.eq.1 )
then
222 call hecmw_matvec(hecmesh, hecmat, ww(:,p), ww(:,q), tcomm)
235 elseif (c1 /= c1)
then
250 if ( mod(iter,n_iter_recompute_r)==0 )
then
258 resid= dsqrt(dnrm2/bnrm2)
261 if (my_rank.eq.0.and.iterlog.eq.1)
write (*,
'(i7, 1pe16.6)') iter, resid
264 if (estcond /= 0 .and. hecmesh%my_rank == 0)
then
268 d(iter) = 1.d0 / alpha + beta / alpha1
269 e(iter-1) = sqrt(beta) / alpha1
275 if ( resid.le.tol )
then
276 if ( mod(iter,n_iter_recompute_r)==0 )
exit
280 resid= dsqrt(dnrm2/bnrm2)
281 if ( resid.le.tol )
exit
298 tcomm = tcomm + end_time - start_time
308 if (estcond /= 0 .and. error == 0 .and. hecmesh%my_rank == 0)
then
314 if (timelog.eq.2)
then
316 t_max, t_min, t_avg, t_sd)
317 if (hecmesh%my_rank.eq.0)
then
318 write(*,*)
'Time solver iterations'
319 write(*,*)
' Max :',t_max
320 write(*,*)
' Min :',t_min
321 write(*,*)
' Avg :',t_avg
322 write(*,*)
' Std Dev :',t_sd
326 tsol = e1_time - s1_time
subroutine, public hecmw_estimate_condition_cg(ITER, D, E)
Jagged Diagonal Matrix storage for vector processors. Original code was provided by JAMSTEC.
subroutine, public hecmw_jad_init(hecMAT)
subroutine, public hecmw_jad_finalize(hecMAT)
subroutine, public hecmw_mat_integrate(hecMAT)
Integrate matrix components into a single array for efficient access.
real(kind=kreal) function, public hecmw_mat_get_resid(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_iterlog(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_timelog(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_recompute_residual(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_estcond(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_usejad(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_iter(hecMAT)
subroutine, public hecmw_precond_setup(hecMAT, hecMESH, sym)
subroutine, public hecmw_precond_apply(hecMESH, hecMAT, R, Z, ZP, COMMtime)
subroutine, public hecmw_solve_cg(hecMESH, hecMAT, ITER, RESID, error, Tset, Tsol, Tcomm)
subroutine, public hecmw_matvec_teardown(hecMAT)
subroutine, public hecmw_matvec_setup(hecMESH, hecMAT)
subroutine, public hecmw_matresid(hecMESH, hecMAT, X, B, R, COMMtime)
subroutine, public hecmw_matvec(hecMESH, hecMAT, X, Y, COMMtime)
subroutine hecmw_xpay_r(n, alpha, X, Y)
subroutine hecmw_innerproduct_r(hecMESH, ndof, X, Y, sum, COMMtime)
subroutine hecmw_axpy_r(n, alpha, X, Y)
subroutine hecmw_copy_r(n, X, Y)
subroutine hecmw_time_statistics(hecMESH, time, t_max, t_min, t_avg, t_sd)
subroutine, public hecmw_solver_scaling_fw(hecMESH, hecMAT, COMMtime)
subroutine, public hecmw_solver_scaling_bk(hecMAT)
integer(kind=4), parameter kreal
real(kind=kreal) function hecmw_wtime()
subroutine hecmw_update_r(hecMESH, val, n, m)
subroutine hecmw_barrier(hecMESH)
integer(kind=kint), parameter hecmw_solver_error_diverge_pc
integer(kind=kint), parameter hecmw_solver_error_diverge_nan
integer(kind=kint), parameter hecmw_solver_error_noconv_maxit
integer(kind=kint), parameter hecmw_solver_error_diverge_mat