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 integer(kind=kint),
dimension(:),
allocatable :: idxbfgs
44 real(kind=
kreal),
dimension(:) ,
allocatable :: vecr,workpc,tmpvecbfgs,rho,alpha
45 real(kind=
kreal),
dimension(:,:),
allocatable :: u,c,uin,cin,sbfgs,ybfgs
47 integer(kind=kint ) :: maxit, nrest,nbfgs
49 real (kind=
kreal) :: tol
51 real (kind=
kreal) zero, one
52 parameter( zero = 0.0d+0, one = 1.0d+0 )
54 integer(kind=kint ) :: i,k,kk,iorth,idx,tmpidx,ibfgs
55 real (kind=
kreal) :: s_time,e_time,s1_time,e1_time
56 real (kind=
kreal) :: bnrm2,dnrm2
57 real (kind=
kreal) :: commtime,comptime, coef,coef2
58 integer(kind=kint ) :: estcond
59 real (kind=
kreal) :: t_max,t_min,t_avg,t_sd
70 my_rank = hecmesh%my_rank
84 allocate (vecr(ndof*np))
85 allocate (workpc(ndof*np))
86 allocate (u(ndof*np,nrest))
87 allocate (c(ndof*np,nrest))
88 allocate (uin(ndof*np,nrest))
89 allocate (cin(ndof*np,nrest))
92 allocate (tmpvecbfgs(ndof*np))
93 allocate (sbfgs(ndof*np,nbfgs))
94 allocate (ybfgs(ndof*np,nbfgs))
95 allocate (idxbfgs(nbfgs))
97 allocate (alpha(nbfgs))
133 if (bnrm2.eq.0.d0)
then
141 if (timelog.eq.2)
then
143 t_max, t_min, t_avg, t_sd)
144 if (hecmesh%my_rank.eq.0)
then
145 write(*,*)
'Time solver setup'
146 write(*,*)
' Max :',t_max
147 write(*,*)
' Min :',t_min
148 write(*,*)
' Avg :',t_avg
149 write(*,*)
' Std Dev :',t_sd
153 tset = e_time - s_time
176 rho(k) = 1.0d0 / coef
178 alpha(k) = rho(k)*coef2
179 call hecmw_axpy_r(nndof, -alpha(k), ybfgs(:,idx), tmpvecbfgs)
185 coef2 = rho(k) * coef
186 call hecmw_axpy_r(nndof, alpha(k)-coef2, sbfgs(:,idx), uin(:,1))
190 call hecmw_matvec(hecmesh, hecmat, uin(:,1), cin(:,1), tcomm)
196 call hecmw_axpyz_r(nndof, -coef, c(:,iorth), cin(:,iorth), cin(:,iorth+1))
197 call hecmw_axpyz_r(nndof, -coef, u(:,iorth), uin(:,iorth), uin(:,iorth+1))
200 coef = 1.0d0 / dsqrt(coef)
210 if (ibfgs == nbfgs+1)
then
213 idxbfgs(kk) = idxbfgs(kk+1)
215 idxbfgs(nbfgs) = tmpidx
218 call hecmw_axpby_r(nndof, coef, 0.0d0, c(:,i), ybfgs(:,idxbfgs(ibfgs)))
219 call hecmw_axpby_r(nndof, coef, 0.0d0, u(:,i), sbfgs(:,idxbfgs(ibfgs)))
224 resid= dsqrt(dnrm2/bnrm2)
227 if (my_rank.eq.0.and.iterlog.eq.1)
write (*,
'(i7, 1pe16.6)') iter, resid
230 if ( resid.le.tol )
exit outer
231 if ( iter.gt.maxit )
then
248 tcomm = tcomm + e_time - s_time
265 if (timelog.eq.2)
then
267 t_max, t_min, t_avg, t_sd)
268 if (hecmesh%my_rank.eq.0)
then
269 write(*,*)
'Time solver iterations'
270 write(*,*)
' Max :',t_max
271 write(*,*)
' Min :',t_min
272 write(*,*)
' Avg :',t_avg
273 write(*,*)
' Std Dev :',t_sd
277 tsol = e1_time - s1_time
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_nbfgs(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_clear(hecMAT)
subroutine, public hecmw_precond_setup(hecMAT, hecMESH, sym)
subroutine, public hecmw_precond_apply(hecMESH, hecMAT, R, Z, ZP, COMMtime)
subroutine, public hecmw_solve_gmresr(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_axpyz_r(n, alpha, X, Y, Z)
subroutine hecmw_innerproduct_r(hecMESH, ndof, X, Y, sum, COMMtime)
subroutine hecmw_axpby_r(n, alpha, beta, X, Y)
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_noconv_maxit