14 common /cprint/ ifprint
16 real res (lx2*ly2*lz2*lelv)
17 real h1 (lx1,ly1,lz1,lelv)
18 real h2 (lx1,ly1,lz1,lelv)
19 real h2inv(lx1,ly1,lz1,lelv)
21 common /scrmg/ wp(lx2,ly2,lz2,lelv)
23 common /ctmp0/ wk1(lgmres),wk2(lgmres)
24 common /cgmres1/ y(lgmres)
41 norm_fac = 1./sqrt(volvm2)
51 if (param(21).gt.0.and.tolps.gt.abs(param(21)))
52 $ tolps = abs(param(21))
54 if (istep.eq.0) tolps = 1.e-4
57 ntot2 = lx2*ly2*lz2*nelv
60 call rzero(x_gmres,ntot2)
62 do while(iconv.eq.0.and.iter.lt.100)
66 call col3(r_gmres,ml_gmres,res,ntot2)
70 call copy(r_gmres,res,ntot2)
71 call cdabdtp(w_gmres,x_gmres,h1,h2,h2inv,intype)
72 call add2s2(r_gmres,w_gmres,-1.,ntot2)
74 call col2(r_gmres,ml_gmres,ntot2)
77 gamma_gmres(1) = sqrt(
glsc2(r_gmres,r_gmres,ntot2))
80 div0 = gamma_gmres(1)*norm_fac
81 if (param(21).lt.0) tolpss=abs(param(21))*div0
86 if(gamma_gmres(1) .eq. 0.)
goto 9000
87 temp = 1./gamma_gmres(1)
88 call cmult2(v_gmres(1,1),r_gmres,temp,ntot2)
93 call col3(w_gmres,mu_gmres,v_gmres(1,j),ntot2)
97 if(param(43).eq.1)
then
98 call uzprec(z_gmres(1,j),w_gmres,h1,h2,intype,wp)
105 call cdabdtp(w_gmres,z_gmres(1,j),
106 $ h1,h2,h2inv,intype)
109 call col2(w_gmres,ml_gmres,ntot2)
122 h_gmres(i,j)=
vlsc2(w_gmres,v_gmres(1,i),ntot2)
125 call gop(h_gmres(1,j),wk1,
'+ ',j)
128 call add2s2(w_gmres,v_gmres(1,i),-h_gmres(i,j),ntot2)
149 h_gmres(i ,j)= c_gmres(i)*temp
150 $ + s_gmres(i)*h_gmres(i+1,j)
151 h_gmres(i+1,j)= -s_gmres(i)*temp
152 $ + c_gmres(i)*h_gmres(i+1,j)
155 alpha = sqrt(
glsc2(w_gmres,w_gmres,ntot2))
157 if(alpha.eq.0.)
goto 900
158 l = sqrt(h_gmres(j,j)*h_gmres(j,j)+alpha*alpha)
160 c_gmres(j) = h_gmres(j,j) * temp
161 s_gmres(j) = alpha * temp
163 gamma_gmres(j+1) = -s_gmres(j) * gamma_gmres(j)
164 gamma_gmres(j) = c_gmres(j) * gamma_gmres(j)
168 rnorm = abs(gamma_gmres(j+1))*norm_fac
170 if (ifprint.and.nio.eq.0)
171 $
write (6,66) iter,tolpss,rnorm,div0,ratio,istep
172 66
format(i5,1p4e12.5,i8,
' Divergence')
175 if (rnorm .lt. tolpss)
goto 900
177 if (iter.gt.param(151)-1)
goto 900
179 if (j.eq.m)
goto 1000
182 call cmult2(v_gmres(1,j+1),w_gmres,temp,ntot2)
191 temp = gamma_gmres(k)
193 temp = temp - h_gmres(k,i)*c_gmres(i)
195 c_gmres(k) = temp/h_gmres(k,k)
199 call add2s2(x_gmres,z_gmres(1,i),c_gmres(i),ntot2)
224 call copy(res,x_gmres,ntot2)
229 if (nio.eq.0)
write(6,9999) istep,
' U-PRES gmres ',
230 & iter,divex,div0,tolpss,etime_p,etime1
232 9999
format(i11,a,i6,1p5e13.4)
241 real l(n),u(n),b(n),binv(n)
246 if(abs(u(i)*l(i)-1.0).gt.1e-13) print *, i, u(i)*l(i)
254 real l(n),u(n),b(n),binv(n)
284 subroutine ax(w,x,h1,h2,n)
293 real w(n),x(n),h1(n),h2(n)
297 call axhelm (w,x,h1,h2,imsh,isd)
298 call dssum (w,lx1,ly1,lz1)
299 call col2 (w,pmask,n)
314 common /ctolpr/ divex
315 common /cprint/ ifprint
317 real res (lx1*ly1*lz1*lelv)
318 real h1 (lx1,ly1,lz1,lelv)
319 real h2 (lx1,ly1,lz1,lelv)
320 real wt (lx1,ly1,lz1,lelv)
322 common /scrcg/ d(lx1*ly1*lz1*lelv),wk(lx1*ly1*lz1*lelv)
324 common /cgmres1/ y(lgmres)
325 common /ctmp0/ wk1(lgmres),wk2(lgmres)
332 data iflag,if_hyb /.false. , .false. /
352 norm_fac = 1./sqrt(volvm1)
357 call chktcg1(tolps,res,h1,h2,pmask,vmult,1,1)
358 if (param(21).gt.0.and.tolps.gt.abs(param(21)))
359 $ tolps = abs(param(21))
360 if (istep.eq.0) tolps = 1.e-4
364 call rzero(x_gmres,n)
367 do while (iconv.eq.0)
372 call col3(r_gmres,ml_gmres,res,n)
376 call copy (r_gmres,res,n)
377 call ax (w_gmres,x_gmres,h1,h2,n)
378 call add2s2(r_gmres,w_gmres,-1.,n)
380 call col2(r_gmres,ml_gmres,n)
383 gamma_gmres(1) = sqrt(
glsc3(r_gmres,r_gmres,wt,n))
386 div0 = gamma_gmres(1)*norm_fac
387 if (param(21).lt.0) tolpss=abs(param(21))*div0
392 if(gamma_gmres(1) .eq. 0.)
goto 9000
393 temp = 1./gamma_gmres(1)
394 call cmult2(v_gmres(1,1),r_gmres,temp,n)
399 call col3(w_gmres,mu_gmres,v_gmres(1,j),n)
408 if (param(40).ge.0 .and. param(40).le.2)
then
410 else if (param(40).eq.3)
then
415 if (param(100).eq.2)
then
419 $ (z_gmres(1,j),w_gmres,d,pmask,vmult,nelv,
420 $ ktype(1,1,kfldfdm),wk)
423 call add2 (z_gmres(1,j),wk,n)
427 call ortho (z_gmres(1,j))
432 call ax (w_gmres,z_gmres(1,j),h1,h2,n)
436 call col2(w_gmres,ml_gmres,n)
450 h_gmres(i,j)=
vlsc3(w_gmres,v_gmres(1,i),wt,n)
453 call gop(h_gmres(1,j),wk1,
'+ ',j)
456 call add2s2(w_gmres,v_gmres(1,i),-h_gmres(i,j),n)
476 h_gmres(i ,j)= c_gmres(i)*temp
477 $ + s_gmres(i)*h_gmres(i+1,j)
478 h_gmres(i+1,j)= -s_gmres(i)*temp
479 $ + c_gmres(i)*h_gmres(i+1,j)
482 alpha = sqrt(
glsc3(w_gmres,w_gmres,wt,n))
484 if(alpha.eq.0.)
goto 900
485 l = sqrt(h_gmres(j,j)*h_gmres(j,j)+alpha*alpha)
487 c_gmres(j) = h_gmres(j,j) * temp
488 s_gmres(j) = alpha * temp
490 gamma_gmres(j+1) = -s_gmres(j) * gamma_gmres(j)
491 gamma_gmres(j) = c_gmres(j) * gamma_gmres(j)
493 rnorm = abs(gamma_gmres(j+1))*norm_fac
495 if (ifprint.and.nio.eq.0)
496 $
write (6,66) iter,tolpss,rnorm,div0,ratio,istep
497 66
format(i5,1p4e12.5,i8,
' Divergence')
500 if (iter+1.gt.maxit)
goto 900
501 if (rnorm .lt. tolpss)
goto 900
503 if (iter.gt.param(151)-1)
goto 900
505 if (j.eq.m)
goto 1000
508 call cmult2(v_gmres(1,j+1),w_gmres,temp,n)
517 temp = gamma_gmres(k)
519 temp = temp - h_gmres(k,i)*c_gmres(i)
521 c_gmres(k) = temp/h_gmres(k,k)
525 call add2s2(x_gmres,z_gmres(1,i),c_gmres(i),n)
532 call copy(res,x_gmres,n)
537 if (nio.eq.0)
write(6,9999) istep,iter,divex,div0,tolpss,etime_p,
540 9999
format(4x,i7,
' PRES gmres ',4x,i5,1p5e13.4,1x,l4)
542 if (outer.le.2) if_hyb = .false.
554 common /c_is1/ glo_num(lxs*lys*lzs*lelv)
556 common /ivrtx/ vertex((2**ldim)*lelt)
557 common /handle/ gsh_dd
558 integer vertex,gsh_dd
579 common /cwork1/ v1(lxs,lys,lzs,lelt)
580 common /handle/ gsh_dd
583 real u(lx1,lx1,lz1,1),v(1),mask(1)
586 n = lx1*ly1*lz1*nelfld(ifield)
592 do ie=1,nelfld(ifield)
596 u(ix,iy,iz,ie) = v1(ix+1,iy+1,iz+iz1,ie)
602 call dssum (u,lx1,ly1,lz1)
614 common /work1/ w1(lxs,lys,lzs)
618 real v1(lxs,lys,lzs,lelt)
619 real v0(lx1,ly1,lz1,lelt)
630 m = (lx1+2)*(ly1+2)*(lz1+2*mz)*nelv
641 call fgslib_gs_op(gsh_dd,v1,1,1,0)
651 call fgslib_gs_op (gsh_dd,v1,1,1,0)
669 parameter(lxss=lxs*lxs)
670 common /fastg/ sr(lxss,2,lelv),ss(lxss,2,lelv),st(lxss,2,lelv)
671 $ , df(lxs*lys*lzs,lelv)
673 common /ctmpf/ lr(2*lx1+4),ls(2*lx1+4),lt(2*lx1+4)
674 $ , llr(lelt),lls(lelt),llt(lelt)
675 $ , lmr(lelt),lms(lelt),lmt(lelt)
676 $ , lrr(lelt),lrs(lelt),lrt(lelt)
682 integer lbr,rbr,lbs,rbs,lbt,rbt
691 call get_fast_bc(lbr,rbr,lbs,rbs,lbt,rbt,ie,3,ierr)
696 $ ,llr(ie),lmr(ie),lrr(ie),ie)
698 $ ,lls(ie),lms(ie),lrs(ie),ie)
701 $ ,llt(ie),lmt(ie),lrt(ie),ie)
707 eps = 1.e-5 * (
vlmax(lr(2),nr-2)
713 diag = lr(i) + ls(j) + lt(k)
714 if (diag.gt.eps)
then
727 eps = 1.e-5*(
vlmax(lr(2),nr-2) +
vlmax(ls(2),ns-2))
733 if (diag.gt.eps)
then
758 parameter(lr3=2*lxs*lxs)
759 common /fast1dsem/ g(lr3),w(lr3)
762 real s(1),lam(1),ll,lm,lr
765 integer bb0,bb1,eb0,eb1,n,n1
770 if(lbc.eq.2 .or. lbc.eq.3)
then
777 if(rbc.eq.2 .or. rbc.eq.3)
then
829 real g(0:lx1+1,0:lx1+1)
830 real ah(0:lx1-1,0:lx1-1)
847 call rzero(g,(n+3)*(n+3))
850 g(i,j) = ah(i-1,j-1)*bm
855 g(0,0) = g(0,0) + bl*ah(n-1,n-1)
856 g(0,1) = g(0,1) + bl*ah(n-1,n )
857 g(1,0) = g(1,0) + bl*ah(n ,n-1)
858 g(1,1) = g(1,1) + bl*ah(n ,n )
859 elseif (b0.eq.0)
then
871 g(n+1,n+1) = g(n+1,n+1) + br*ah(0,0)
872 g(n+1,n+2) = g(n+1,n+2) + br*ah(0,1)
873 g(n+2,n+1) = g(n+2,n+1) + br*ah(0,1)
874 g(n+2,n+2) = g(n+2,n+2) + br*ah(1,1)
875 elseif (b1.eq.n)
then
911 real g(0:lx1+1,0:lx1+1)
928 call rzero(g,(n+3)*(n+3))
934 g(0,0) = g(0,0) + bl*bh(n-1)
935 g(1,1) = g(1,1) + bl*bh(n )
936 elseif (b0.eq.0)
then
948 g(n+1,n+1) = g(n+1,n+1) + br*bh(0)
949 g(n+2,n+2) = g(n+2,n+2) + br*bh(1)
950 elseif (b1.eq.n)
then
966 real v1(nx+2,nx+2,nz+2*iz1,nel)
967 real v (nx ,nx ,nz ,nel)
975 v1(ix+1,iy+1,iz+iz1,e) = v(ix,iy,iz,e)
996 x(ix,1 ,iz,e) = x(ix, 1+t,iz,e)
997 x(ix,ny,iz,e) = x(ix,ny-t,iz,e)
1003 x(1 ,iy,iz,e) = x( 1+t,iy,iz,e)
1004 x(nx,iy,iz,e) = x(nx-t,iy,iz,e)
1010 x(ix,iy,1 ,e) = x(ix,iy, 1+t,e)
1011 x(ix,iy,nz,e) = x(ix,iy,nz-t,e)
1016 x(ix,1 ,1,e) = x(ix, 1+t,1,e)
1017 x(ix,ny,1,e) = x(ix,ny-t,1,e)
1020 x(1 ,iy,1,e) = x( 1+t,iy,1,e)
1021 x(nx,iy,1,e) = x(nx-t,iy,1,e)
1043 x(ix,1 ,iz,e) = x(ix,1 ,iz,e) + c*x(ix, 1+t,iz,e)
1044 x(ix,ny,iz,e) = x(ix,ny,iz,e) + c*x(ix,ny-t,iz,e)
1050 x(1 ,iy,iz,e) = x(1 ,iy,iz,e) + c*x( 1+t,iy,iz,e)
1051 x(nx,iy,iz,e) = x(nx,iy,iz,e) + c*x(nx-t,iy,iz,e)
1057 x(ix,iy,1 ,e) = x(ix,iy,1 ,e) + c*x(ix,iy, 1+t,e)
1058 x(ix,iy,nz,e) = x(ix,iy,nz,e) + c*x(ix,iy,nz-t,e)
1065 x(ix,1 ,1,e) = x(ix,1 ,1,e) + c*x(ix, 1+t,1,e)
1066 x(ix,ny,1,e) = x(ix,ny,1,e) + c*x(ix,ny-t,1,e)
1069 x(1 ,iy,1,e) = x(1 ,iy,1,e) + c*x( 1+t,iy,1,e)
1070 x(nx ,iy,1,e) = x(nx,iy,1,e) + c*x(nx-t,iy,1,e)
1084 parameter(lxss=lxs*lxs)
1085 common /fastg/ sr(lxss,2,lelv),ss(lxss,2,lelv),st(lxss,2,lelv)
1086 $ , df(lxs*lys*lzs,lelv)
1088 parameter(lxyz = lxs*lys*lzs)
1090 real r(1),w1(1),w2(1)
1096 call tensr3 (w1,nx,r ,nx,sr(1,2,ie),ss(1,1,ie),st(1,1,ie),w2)
1102 call col2 (w1,df(1,ie),lxyz)
1108 call tensr3 (r ,nx,w1,nx,sr(1,1,ie),ss(1,2,ie),st(1,2,ie),w2)
1129 x(ix, 1+t,iz,e) = c*x(ix,1 ,iz,e) + x(ix, 1+t,iz,e)
1130 x(ix,ny-t,iz,e) = c*x(ix,ny,iz,e) + x(ix,ny-t,iz,e)
1136 x( 1+t,iy,iz,e) = c*x(1 ,iy,iz,e) + x( 1+t,iy,iz,e)
1137 x(nx-t,iy,iz,e) = c*x(nx,iy,iz,e) + x(nx-t,iy,iz,e)
1143 x(ix,iy, 1+t,e) = c*x(ix,iy,1 ,e) + x(ix,iy, 1+t,e)
1144 x(ix,iy,nz-t,e) = c*x(ix,iy,nz,e) + x(ix,iy,nz-t,e)
1151 x(ix, 1+t,1,e) = c*x(ix,1 ,1,e) + x(ix, 1+t,1,e)
1152 x(ix,ny-t,1,e) = c*x(ix,ny,1,e) + x(ix,ny-t,1,e)
1155 x( 1+t,iy,1,e) = c*x(1 ,iy,1,e) + x( 1+t,iy,1,e)
1156 x(nx-t,iy,1,e) = c*x(nx,iy,1,e) + x(nx-t,iy,1,e)
1166 real x(nx,nx,nz,lelt)
1173 if (idum.lt.0)
return
1178 mtot = nx*ny*nz*nelv
1179 if (nx.gt.8.or.nelv.gt.16)
return
1180 xmin =
glmin(x,mtot)
1181 xmax =
glmax(x,mtot)
1185 snel = sqrt(rnel)+.1
1191 write(6,116) txt10,k,ie,xmin,xmax,istep,time,nx
1195 if (nx.eq.2)
write(6,102) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1196 if (nx.eq.3)
write(6,103) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1197 if (nx.eq.4)
write(6,104) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1198 if (nx.eq.5)
write(6,105) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1199 if (nx.eq.6)
write(6,106) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1200 if (nx.eq.7)
write(6,107) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1201 if (nx.eq.8)
write(6,118) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1206 102
FORMAT(4(2f9.5,2x))
1207 103
FORMAT(4(3f9.5,2x))
1208 104
FORMAT(4(4f7.3,2x))
1209 105
FORMAT(5f9.5,10x,5f9.5)
1210 106
FORMAT(6f7.1,5x,6f7.1,5x,6f7.1,5x,6f7.1)
1211 107
FORMAT(7f8.4,5x,7f8.4)
1212 108
FORMAT(8f8.4,4x,8f8.4)
1215 116
FORMAT( /,5x,
' ^ ',/,
1218 $ 5x,
' +----> ',
'Plane = ',i2,
'/',i2,2x,2e12.4,/,
1219 $ 5x,
' X ',
'Step =',i9,f15.5,i2)
1222 if (ichk.eq.1.and.idum.gt.0)
call checkit(idum)
1229 integer x(nx,nx,nz,lelt)
1232 integer idum,e,xmin,xmax
1236 if (idum.lt.0)
return
1241 mtot = nx*ny*nz*nelv
1242 if (nx.gt.8.or.nelv.gt.16)
return
1248 snel = sqrt(rnel)+.1
1254 write(6,116) txt10,k,ie,xmin,xmax,istep,time,nx
1258 if (nx.eq.2)
write(6,102) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1259 if (nx.eq.3)
write(6,103) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1260 if (nx.eq.4)
write(6,104) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1261 if (nx.eq.5)
write(6,105) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1262 if (nx.eq.6)
write(6,106) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1263 if (nx.eq.7)
write(6,107) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1264 if (nx.eq.8)
write(6,118) ((x(i,j,k,e+l),i=1,nx),e=1,4)
1269 102
FORMAT(4(2i9,2x))
1270 103
FORMAT(4(3i9,2x))
1271 104
FORMAT(4(4i7,2x))
1272 105
FORMAT(5i9,10x,5i9)
1273 106
FORMAT(6i7,5x,6i7,5x,6i7,5x,6i7)
1274 107
FORMAT(7i8,5x,7i8)
1275 108
FORMAT(8i8,4x,8i8)
1278 116
FORMAT( /,5x,
' ^ ',/,
1281 $ 5x,
' +----> ',
'Plane = ',i2,
'/',i2,2x,2i12,/,
1282 $ 5x,
' X ',
'Step =',i9,f15.5,i2)
1285 if (ichk.eq.1.and.idum.gt.0)
call checkit(idum)
1294 integer gs_h,vertex(1),e
1295 integer*8 ngv,glo_num(nx,ny,nz,nel)
1298 common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
1301 call set_vert(glo_num,ngv,nx,nel,vertex,.false.)
1309 glo_num(i,j,k,e) = 0
1319 call fgslib_gs_setup(gs_h,glo_num,ntot,nekcomm,mp)
1327 write(6,1) et,nx,nel,ntot,ngv,gs_h
1328 1
format(
' gs_init time',1pe11.4,
' seconds ',i3,4i10)
subroutine gop(x, w, op, n)
real *8 function dnekclock()
subroutine dssum(u, nx, ny, nz)
subroutine row_zero(a, m, n, e)
subroutine load_semhat_weighted
subroutine get_fast_bc(lbr, rbr, lbs, rbs, lbt, rbt, e, bsym, ierr)
subroutine tensr3(v, nv, u, nu, A, Bt, Ct, w)
subroutine fill_interior_g(v1, v, e, nx, nz, iz1, nel)
subroutine set_up_fast_1d_sem_op_b(g, b0, b1, l, r, ll, lm, lr, bh)
subroutine dface_ext_g(x, t, e, nx, nz)
subroutine h1_overlap_2(u, v, mask)
subroutine outfldr_g(x, txt10, nx, nz, ichk)
subroutine hmh_gmres(res, h1, h2, wt, iter)
subroutine dface_add1si_g(x, c, t, e, nx, nz)
subroutine s_face_to_int2_g(x, c, t, e, nx, nz)
subroutine rzero_g(a, e, nx, ny, nz)
subroutine dd_swap_vals(v1, v0, gsh_dd)
subroutine uzawa_gmres(res, h1, h2, h2inv, intype, iter)
subroutine uzawa_gmres_split0(l, u, b, binv, n)
subroutine setupds_no_crn(gs_h, nx, ny, nz, nel, melg, vertex, glo_num)
subroutine fastdm1_g(R, ie, w1, w2)
subroutine set_up_fast_1d_sem_op_a(g, b0, b1, l, r, ll, lm, lr, ah)
subroutine set_up_fast_1d_sem_g(s, lam, n, lbc, rbc, ll, lm, lr, ie)
subroutine ax(w, x, h1, h2, n)
subroutine uzawa_gmres_temp(a, b, n)
subroutine uzawa_gmres_split(l, u, b, binv, n)
subroutine outfldi_g(x, txt10, nx, nz, ichk)
subroutine fdm_h1(z, r, d, mask, mult, nel, kt, rr)
subroutine chktcg1(tol, res, h1, h2, mask, mult, imesh, isd)
subroutine generalev(a, b, lam, n, w)
subroutine axhelm(au, u, helm1, helm2, imesh, isd)
subroutine set_fdm_prec_h1b(d, h1, h2, nel)
subroutine h1mg_solve(z, rhs, if_hybrid)
subroutine hsmg_solve(e, r)
subroutine col3(a, b, c, n)
subroutine transpose(a, lda, b, ldb)
function glsc3(a, b, mult, n)
subroutine add2s2(a, b, c1, n)
real function vlmax(vec, n)
real function vlsc2(x, y, n)
subroutine uzprec(rpcg, rcg, h1m1, h2m1, intype, wp)
subroutine cdabdtp(ap, wp, h1, h2, h2inv, intype)
subroutine chktcg2(tol, res, iconv)
function vlsc3(X, Y, B, N)
subroutine crs_solve_h1(uf, vf)
subroutine set_vert(glo_num, ngv, nx, nel, vertex, ifcenter)
subroutine cmult2(A, B, CONST, N)