35 integer(kind=kint ),
intent(inout):: iter, error
36 real (kind=
kreal),
intent(inout):: resid, tset, tsol, tcomm
38 integer(kind=kint ) :: n, np, ndof, nndof
39 integer(kind=kint ) :: my_rank
40 integer(kind=kint ) :: iterlog, timelog
41 real(kind=
kreal),
pointer :: b(:), x(:)
43 real(kind=
kreal),
dimension(:,:),
allocatable :: ww
45 integer(kind=kint ) :: maxit, nrest
47 real (kind=
kreal) :: tol
49 real (kind=
kreal),
dimension(:),
allocatable :: ss
50 real (kind=
kreal),
dimension(:,:),
allocatable :: h
52 integer(kind=kint ) :: cs, sn
54 real (kind=
kreal) zero, one
55 parameter( zero = 0.0d+0, one = 1.0d+0 )
57 integer(kind=kint ) :: nrk,i,k,kk,jj,info,ik
58 integer(kind=kint ) :: irow
59 real (kind=
kreal) :: s_time,e_time,s1_time,e1_time
60 real (kind=
kreal) :: ldh,ldw,bnrm2,dnrm2,rnorm
61 real (kind=
kreal) :: commtime,comptime, coef,val,vcs,vsn,dtemp,aa,bb,r0,scale,rr
62 integer(kind=kint ) :: estcond
63 real (kind=
kreal) :: t_max,t_min,t_avg,t_sd
65 integer(kind=kint),
parameter :: r = 1
66 integer(kind=kint),
parameter :: zp = r + 1
67 integer(kind=kint),
parameter :: zq = r + 2
68 integer(kind=kint),
parameter :: s = r + 3
69 integer(kind=kint),
parameter :: w = s + 1
70 integer(kind=kint),
parameter :: y = w
71 integer(kind=kint),
parameter :: av = y + 1
72 integer(kind=kint),
parameter :: v = av + 1
82 my_rank = hecmesh%my_rank
93 if (nrest >= ndof*np-1) nrest = ndof*np-2
99 allocate (ww(ndof*np,nrk))
147 if (bnrm2.eq.0.d0)
then
155 if (timelog.eq.2)
then
157 t_max, t_min, t_avg, t_sd)
158 if (hecmesh%my_rank.eq.0)
then
159 write(*,*)
'Time solver setup'
160 write(*,*)
' Max :',t_max
161 write(*,*)
' Min :',t_min
162 write(*,*)
' Avg :',t_avg
163 write(*,*)
' Std Dev :',t_sd
167 tset = e_time - s_time
187 if (dnrm2 == 0.d0)
exit
214 call hecmw_matvec(hecmesh, hecmat, ww(:,zq), ww(:,w), tcomm)
232 if (val == 0.d0)
exit
236 call hecmw_axpby_r(nndof, coef, 0.d0, ww(:,w), ww(:,v+i+1-1))
250 dtemp = vcs*h(k ,i) + vsn*h(k+1,i)
251 h(k+1,i)= vcs*h(k+1,i) - vsn*h(k ,i)
260 if (dabs(aa).gt.dabs(bb)) r0= aa
261 scale= dabs(aa) + dabs(bb)
263 if (scale.ne.0.d0)
then
264 rr= scale * dsqrt((aa/scale)**2+(bb/scale)**2)
265 rr= dsign(1.d0,r0)*rr
278 dtemp = vcs*h(i ,i) + vsn*h(i+1,i)
279 h(i+1,i)= vcs*h(i+1,i) - vsn*h(i ,i)
282 dtemp = vcs*ww(i ,s) + vsn*ww(i+1,s)
283 ww(i+1,s)= vcs*ww(i+1,s) - vsn*ww(i ,s)
286 resid = dabs( ww(i+1,s))/dsqrt(bnrm2)
288 if (my_rank.eq.0 .and. iterlog.eq.1) &
289 &
write (*,
'(2i8, 1pe16.6)') iter,i+1, resid
291 if (estcond /= 0 .and. hecmesh%my_rank == 0)
then
295 if ( resid.le.tol )
then
301 ww(irow,y)= ss(irow) / h(irow,irow)
304 do jj= irow, kk+1, -1
305 ss(kk)= ss(kk) - h(kk,jj)*ww(jj,y)
307 ww(kk,y)= ss(kk) / h(kk,kk)
315 call hecmw_axpy_r(nndof, ww(jj,y), ww(:,v+jj-1), ww(:,av))
325 if ( iter.gt.maxit )
then
343 ww(irow,y)= ss(irow) / h(irow,irow)
346 do jj= irow, kk+1, -1
347 ss(kk)= ss(kk) - h(kk,jj)*ww(jj,y)
349 ww(kk,y)= ss(kk) / h(kk,kk)
357 call hecmw_axpy_r(nndof, ww(jj,y), ww(:,v+jj-1), ww(:,av))
370 ww(i+1,s)= dsqrt(dnrm2/bnrm2)
373 if ( resid.le.tol )
exit outer
374 if ( iter .gt.maxit )
then
393 ww(irow,y)= ss(irow) / h(irow,irow)
396 do jj= irow, kk+1, -1
397 ss(kk)= ss(kk) - h(kk,jj)*ww(jj,y)
399 ww(kk,y)= ss(kk) / h(kk,kk)
407 call hecmw_axpy_r(nndof, ww(jj,y), ww(:,v+jj-1), ww(:,av))
417 if (estcond /= 0 .and. hecmesh%my_rank == 0)
then
425 tcomm = tcomm + e_time - s_time
427 deallocate (h, ww, ss)
436 if (timelog.eq.2)
then
438 t_max, t_min, t_avg, t_sd)
439 if (hecmesh%my_rank.eq.0)
then
440 write(*,*)
'Time solver iterations'
441 write(*,*)
' Max :',t_max
442 write(*,*)
' Min :',t_min
443 write(*,*)
' Avg :',t_avg
444 write(*,*)
' Std Dev :',t_sd
448 tsol = e1_time - s1_time
subroutine, public hecmw_estimate_condition_gmres(I, H)
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.
integer(kind=kint) function, public hecmw_mat_get_nrest(hecMAT)
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_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_gmres(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_innerproduct_r(hecMESH, ndof, X, Y, sum, COMMtime)
subroutine hecmw_scale_r(n, alpha, X)
subroutine hecmw_axpby_r(n, alpha, beta, X, Y)
subroutine hecmw_axpy_r(n, alpha, 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_noconv_maxit