2 subroutine hmholtz(name,u,rhs,h1,h2,mask,mult,imsh,tli,maxit,isd)
10 REAL RHS (LX1,LY1,LZ1,1)
11 REAL H1 (LX1,LY1,LZ1,1)
12 REAL H2 (LX1,LY1,LZ1,1)
13 REAL MASK (LX1,LY1,LZ1,1)
14 REAL MULT (LX1,LY1,LZ1,1)
22 if (ifsplit) iffdm = .true.
27 if (name.ne.
'PRES')
then
33 ntot = lx1*ly1*lz1*nelfld(ifield)
34 if (imsh.eq.1) ntot = lx1*ly1*lz1*nelv
35 if (imsh.eq.2) ntot = lx1*ly1*lz1*nelt
47 if (name.eq.
'PRES') kfldfdm = ldim+1
50 call dssum (rhs,lx1,ly1,lz1)
51 call col2 (rhs,mask,ntot)
54 if (param(22).eq.0.or.istep.le.10)
55 $
call chktcg1 (tol,rhs,h1,h2,mask,mult,imsh,isd)
59 if (imsh.eq.1)
call cggo
60 $ (u,rhs,h1,h2,mask,mult,imsh,tol,maxit,isd,binvm1,name)
61 if (imsh.eq.2)
call cggo
62 $ (u,rhs,h1,h2,mask,mult,imsh,tol,maxit,isd,bintm1,name)
65 if (name.ne.
'PRES') thmhz=thmhz+(
dnekclock()-etime1)
72 subroutine axhelm (au,u,helm1,helm2,imesh,isd)
88 COMMON /fastax/ wddx(lx1,lx1),wddyt(ly1,ly1),wddzt(lz1,lz1)
89 COMMON /fastmd/ ifdfrm(lelt), iffast(lelt), ifh2, ifsolv
90 LOGICAL IFDFRM, IFFAST, IFH2, IFSOLV
92 REAL AU (LX1,LY1,LZ1,1)
94 $ , HELM1 (LX1,LY1,LZ1,1)
95 $ , HELM2 (LX1,LY1,LZ1,1)
96 COMMON /ctmp1/ dudr(lx1,ly1,lz1)
100 $ , tmp2(lx1,ly1,lz1)
101 $ , tmp3(lx1,ly1,lz1)
103 REAL TM1 (LX1,LY1,LZ1)
104 REAL TM2 (LX1,LY1,LZ1)
105 REAL TM3 (LX1,LY1,LZ1)
108 equivalence(dudr,tm1),(duds,tm2),(dudt,tm3)
116 if (imesh.eq.1) nel=nelv
124 IF (.NOT.ifsolv)
CALL setfast(helm1,helm2,imesh)
129 if (ifaxis)
call setaxdy ( ifrzer(e) )
140 call mxm (wddx,lx1,u(1,1,1,e),lx1,tm1,nyz)
141 call mxm (u(1,1,1,e),lx1,wddyt,ly1,tm2,ly1)
142 call col2 (tm1,g4m1(1,1,1,e),nxyz)
143 call col2 (tm2,g5m1(1,1,1,e),nxyz)
144 call add3 (au(1,1,1,e),tm1,tm2,nxyz)
145 call cmult (au(1,1,1,e),h1,nxyz)
150 call mxm (dxm1,lx1,u(1,1,1,e),lx1,dudr,nyz)
151 call mxm (u(1,1,1,e),lx1,dytm1,ly1,duds,ly1)
152 call col3 (tmp1,dudr,g1m1(1,1,1,e),nxyz)
153 call col3 (tmp2,duds,g2m1(1,1,1,e),nxyz)
155 call addcol3 (tmp1,duds,g4m1(1,1,1,e),nxyz)
156 call addcol3 (tmp2,dudr,g4m1(1,1,1,e),nxyz)
158 call col2 (tmp1,helm1(1,1,1,e),nxyz)
159 call col2 (tmp2,helm1(1,1,1,e),nxyz)
160 call mxm (dxtm1,lx1,tmp1,lx1,tm1,nyz)
161 call mxm (tmp2,lx1,dym1,ly1,tm2,ly1)
162 call add2 (au(1,1,1,e),tm1,nxyz)
163 call add2 (au(1,1,1,e),tm2,nxyz)
176 call mxm (wddx,lx1,u(1,1,1,e),lx1,tm1,nyz)
178 call mxm (u(1,1,iz,e),lx1,wddyt,ly1,tm2(1,1,iz),ly1)
180 call mxm (u(1,1,1,e),nxy,wddzt,lz1,tm3,lz1)
181 call col2 (tm1,g4m1(1,1,1,e),nxyz)
182 call col2 (tm2,g5m1(1,1,1,e),nxyz)
183 call col2 (tm3,g6m1(1,1,1,e),nxyz)
184 call add3 (au(1,1,1,e),tm1,tm2,nxyz)
185 call add2 (au(1,1,1,e),tm3,nxyz)
186 call cmult (au(1,1,1,e),h1,nxyz)
191 call mxm(dxm1,lx1,u(1,1,1,e),lx1,dudr,nyz)
193 call mxm(u(1,1,iz,e),lx1,dytm1,ly1,duds(1,1,iz),ly1)
195 call mxm (u(1,1,1,e),nxy,dztm1,lz1,dudt,lz1)
196 call col3 (tmp1,dudr,g1m1(1,1,1,e),nxyz)
197 call col3 (tmp2,duds,g2m1(1,1,1,e),nxyz)
198 call col3 (tmp3,dudt,g3m1(1,1,1,e),nxyz)
200 call addcol3 (tmp1,duds,g4m1(1,1,1,e),nxyz)
201 call addcol3 (tmp1,dudt,g5m1(1,1,1,e),nxyz)
202 call addcol3 (tmp2,dudr,g4m1(1,1,1,e),nxyz)
203 call addcol3 (tmp2,dudt,g6m1(1,1,1,e),nxyz)
204 call addcol3 (tmp3,dudr,g5m1(1,1,1,e),nxyz)
205 call addcol3 (tmp3,duds,g6m1(1,1,1,e),nxyz)
207 call col2 (tmp1,helm1(1,1,1,e),nxyz)
208 call col2 (tmp2,helm1(1,1,1,e),nxyz)
209 call col2 (tmp3,helm1(1,1,1,e),nxyz)
210 call mxm (dxtm1,lx1,tmp1,lx1,tm1,nyz)
212 call mxm(tmp2(1,1,iz),lx1,dym1,ly1,tm2(1,1,iz),ly1)
214 call mxm (tmp3,nxy,dzm1,lz1,tm3,lz1)
215 call add2 (au(1,1,1,e),tm1,nxyz)
216 call add2 (au(1,1,1,e),tm2,nxyz)
217 call add2 (au(1,1,1,e),tm3,nxyz)
225 if (ifh2)
call addcol4 (au,helm2,bm1,u,ntot)
229 if (ifaxis.and.(isd.eq.2))
then
233 call mxm(u(1,1,1,e),lx1,datm1,ly1,duax,1)
234 call mxm(ym1(1,1,1,e),lx1,datm1,ly1,ysm1,1)
243 $ term1 = bm1(i,j,1,e)*u(i,j,1,e)/ym1(i,j,1,e)**2
244 term2 = wxm1(i)*wam1(1)*dam1(1,j)*duax(i)
245 $ *jacm1(i,1,1,e)/ysm1(i)
247 term1 = bm1(i,j,1,e)*u(i,j,1,e)/ym1(i,j,1,e)**2
250 au(i,j,1,e) = au(i,j,1,e)
251 $ + helm1(i,j,1,e)*(term1+term2)
270 COMMON /fastmd/ ifdfrm(lelt), iffast(lelt), ifh2, ifsolv
271 LOGICAL IFDFRM, IFFAST, IFH2, IFSOLV
272 REAL HELM1(lx1,ly1,lz1,1), HELM2(lx1,ly1,lz1,1)
274 IF (imesh.EQ.1) nel=nelv
275 IF (imesh.EQ.2) nel=nelt
283 IF (diff.EQ.0.0) epsm = 1.e-6
284 IF (diff.GT.0.0) epsm = 1.e-13
288 IF (ifdfrm(ie).OR.ifaxis)
THEN
291 h1min =
vlmin(helm1(1,1,1,ie),nxyz)
292 h1max =
vlmax(helm1(1,1,1,ie),nxyz)
293 den = abs(h1max)+abs(h1min)
295 testh1 = abs((h1max-h1min)/(h1max+h1min))
296 IF (testh1.LT.epsm) iffast(ie) = .true.
304 testh2 =
vlamax(helm2,ntot)
305 IF (testh2.GT.0.) ifh2 = .true.
321 COMMON /fastax/ wddx(lx1,ly1),wddyt(ly1,ly1),wddzt(lz1,lz1)
322 COMMON /fastmd/ ifdfrm(lelt), iffast(lelt), ifh2, ifsolv
323 LOGICAL IFDFRM, IFFAST, IFH2, IFSOLV
334 wddx(i,j) = wddx(i,j) + wxm1(ip)*dxm1(ip,i)*dxm1(ip,j)
337 CALL rzero(wddyt,nyy)
341 wddyt(j,i) = wddyt(j,i) + wym1(ip)*dym1(ip,i)*dym1(ip,j)
344 CALL rzero(wddzt,nzz)
348 wddzt(j,i) = wddzt(j,i) + wzm1(ip)*dzm1(ip,i)*dzm1(ip,j)
355 IF (.NOT.ifdfrm(ie))
THEN
359 g4m1(ix,iy,iz,ie)=g1m1(ix,iy,iz,ie)/wxm1(ix)
360 g5m1(ix,iy,iz,ie)=g2m1(ix,iy,iz,ie)/wym1(iy)
361 g6m1(ix,iy,iz,ie)=g3m1(ix,iy,iz,ie)/wzm1(iz)
367 IF (.NOT.ifdfrm(ie))
THEN
370 g4m1(ix,iy,1,ie)=g1m1(ix,iy,1,ie)/wxm1(ix)
371 g5m1(ix,iy,1,ie)=g2m1(ix,iy,1,ie)/wym1(iy)
380 subroutine setprec (dpcm1,helm1,helm2,imsh,isd)
393 REAL DPCM1 (LX1,LY1,LZ1,1)
394 COMMON /fastmd/ ifdfrm(lelt), iffast(lelt), ifh2, ifsolv
395 LOGICAL IFDFRM, IFFAST, IFH2, IFSOLV
396 REAL HELM1(lx1,ly1,lz1,1), HELM2(lx1,ly1,lz1,1)
400 if (imsh.eq.1) nel=nelv
402 ntot = nel*lx1*ly1*lz1
410 CALL rzero(dpcm1,ntot)
413 IF (ifaxis)
CALL setaxdy ( ifrzer(ie) )
419 dpcm1(ix,iy,iz,ie) = dpcm1(ix,iy,iz,ie) +
420 $ g1m1(iq,iy,iz,ie) * dxtm1(ix,iq)**2
426 dpcm1(ix,iy,iz,ie) = dpcm1(ix,iy,iz,ie) +
427 $ g2m1(ix,iq,iz,ie) * dytm1(iy,iq)**2
434 dpcm1(ix,iy,iz,ie) = dpcm1(ix,iy,iz,ie) +
435 $ g3m1(ix,iy,iq,ie) * dztm1(iz,iq)**2
441 DO 600 iy=1,ly1,ly1-1
442 DO 600 iz=1,lz1,max(1,lz1-1)
443 dpcm1(1,iy,iz,ie) = dpcm1(1,iy,iz,ie)
444 $ + g4m1(1,iy,iz,ie) * dxtm1(1,1)*dytm1(iy,iy)
445 $ + g5m1(1,iy,iz,ie) * dxtm1(1,1)*dztm1(iz,iz)
446 dpcm1(lx1,iy,iz,ie) = dpcm1(lx1,iy,iz,ie)
447 $ + g4m1(lx1,iy,iz,ie) * dxtm1(lx1,lx1)*dytm1(iy,iy)
448 $ + g5m1(lx1,iy,iz,ie) * dxtm1(lx1,lx1)*dztm1(iz,iz)
450 DO 700 ix=1,lx1,lx1-1
451 DO 700 iz=1,lz1,max(1,lz1-1)
452 dpcm1(ix,1,iz,ie) = dpcm1(ix,1,iz,ie)
453 $ + g4m1(ix,1,iz,ie) * dytm1(1,1)*dxtm1(ix,ix)
454 $ + g6m1(ix,1,iz,ie) * dytm1(1,1)*dztm1(iz,iz)
455 dpcm1(ix,ly1,iz,ie) = dpcm1(ix,ly1,iz,ie)
456 $ + g4m1(ix,ly1,iz,ie) * dytm1(ly1,ly1)*dxtm1(ix,ix)
457 $ + g6m1(ix,ly1,iz,ie) * dytm1(ly1,ly1)*dztm1(iz,iz)
459 DO 800 ix=1,lx1,lx1-1
460 DO 800 iy=1,ly1,ly1-1
461 dpcm1(ix,iy,1,ie) = dpcm1(ix,iy,1,ie)
462 $ + g5m1(ix,iy,1,ie) * dztm1(1,1)*dxtm1(ix,ix)
463 $ + g6m1(ix,iy,1,ie) * dztm1(1,1)*dytm1(iy,iy)
464 dpcm1(ix,iy,lz1,ie) = dpcm1(ix,iy,lz1,ie)
465 $ + g5m1(ix,iy,lz1,ie) * dztm1(lz1,lz1)*dxtm1(ix,ix)
466 $ + g6m1(ix,iy,lz1,ie) * dztm1(lz1,lz1)*dytm1(iy,iy)
474 DO 602 iy=1,ly1,ly1-1
475 dpcm1(1,iy,iz,ie) = dpcm1(1,iy,iz,ie)
476 $ + g4m1(1,iy,iz,ie) * dxtm1(1,1)*dytm1(iy,iy)
477 dpcm1(lx1,iy,iz,ie) = dpcm1(lx1,iy,iz,ie)
478 $ + g4m1(lx1,iy,iz,ie) * dxtm1(lx1,lx1)*dytm1(iy,iy)
480 DO 702 ix=1,lx1,lx1-1
481 dpcm1(ix,1,iz,ie) = dpcm1(ix,1,iz,ie)
482 $ + g4m1(ix,1,iz,ie) * dytm1(1,1)*dxtm1(ix,ix)
483 dpcm1(ix,ly1,iz,ie) = dpcm1(ix,ly1,iz,ie)
484 $ + g4m1(ix,ly1,iz,ie) * dytm1(ly1,ly1)*dxtm1(ix,ix)
491 CALL col2 (dpcm1,helm1,ntot)
492 CALL addcol3 (dpcm1,helm2,bm1,ntot)
496 IF (ifaxis.AND.(isd.EQ.2))
THEN
499 IF (ifrzer(iel))
THEN
500 CALL mxm(ym1(1,1,1,iel),lx1,datm1,ly1,ysm1,1)
505 IF (ym1(i,j,1,iel).NE.0.)
THEN
506 term1 = bm1(i,j,1,iel)/ym1(i,j,1,iel)**2
507 IF (ifrzer(iel))
THEN
508 term2 = wxm1(i)*wam1(1)*dam1(1,j)
509 $ *jacm1(i,1,1,iel)/ysm1(i)
513 dpcm1(i,j,1,iel) = dpcm1(i,j,1,iel)
514 $ + helm1(i,j,1,iel)*(term1+term2)
520 CALL dssum (dpcm1,lx1,ly1,lz1)
527 subroutine chktcg1 (tol,res,h1,h2,mask,mult,imesh,isd)
539 COMMON /cprint/ ifprint
541 COMMON /ctmp0/ w1(lx1,ly1,lz1,lelt)
542 $ , w2(lx1,ly1,lz1,lelt)
543 REAL RES (LX1,LY1,LZ1,1)
544 REAL H1 (LX1,LY1,LZ1,1)
545 REAL H2 (LX1,LY1,LZ1,1)
546 REAL MULT (LX1,LY1,LZ1,1)
547 REAL MASK (LX1,LY1,LZ1,1)
549 IF (eigaa.NE.0.)
THEN
550 acondno = eigga/eigaa
561 IF (diff.EQ.0.) eps = 1.e-6
562 IF (diff.GT.0.) eps = 1.e-13
567 ELSEIF (imesh.EQ.2)
THEN
571 ntot1 = lx1*ly1*lz1*nl
572 CALL copy (w1,res,ntot1)
575 CALL col3 (w2,binvm1,w1,ntot1)
576 rinit = sqrt(
glsc3(w2,w1,mult,ntot1)/volvm1)
578 CALL col3 (w2,bintm1,w1,ntot1)
579 rinit = sqrt(
glsc3(w2,w1,mult,ntot1)/voltm1)
582 IF (tol.LT.rmin)
THEN
583 IF (nio.EQ.0.AND.ifprint)
584 $
WRITE (6,*)
'New CG1-tolerance (RINIT*epsm) = ',rmin,tol
589 bcneu1 =
glsc3(w1,mask,mult,ntot1)
590 bcneu2 =
glsc3(w1,w1 ,mult,ntot1)
591 bctest = abs(bcneu1-bcneu2)
593 CALL axhelm (w2,w1,h1,h2,imesh,isd)
594 CALL col2 (w2,w2,ntot1)
595 CALL col2 (w2,bm1,ntot1)
596 bcrob = sqrt(
glsum(w2,ntot1)/vol)
598 IF ((bctest .LT. .1).AND.(bcrob.LT.(eps*acondno)))
THEN
600 tolmin = rinit*eps*10.
601 IF (tol .LT. tolmin)
THEN
603 IF (nio.EQ.0.AND.ifprint)
604 $
WRITE(6,*)
'New CG1-tolerance (Neumann) = ',tolmin
611 subroutine cggo(x,f,h1,h2,mask,mult,imsh,tin,maxit,isd,binv,name)
623 COMMON /cprint/ ifprint, ifhzpc
624 LOGICAL IFPRINT, IFHZPC
626 common /fastmd/ ifdfrm(lelt), iffast(lelt), ifh2, ifsolv
627 logical ifdfrm, iffast, ifh2, ifsolv
629 logical ifmcor,ifprint_hmh
631 real x(1),f(1),h1(1),h2(1),mask(1),mult(1),binv(1)
632 parameter(lg=lx1*ly1*lz1*lelt)
633 COMMON /scrcg/ d(lg) , scalar(2)
634 common /scrmg/ r(lg) , w(lg) , p(lg) , z(lg)
637 common /tdarray/ diagt(maxcg),upper(maxcg)
638 common /iterhm/ niterhm
641 if (ifsplit.and.name.eq.
'PRES')
then
642 if (param(42).eq.0)
then
649 elseif(param(42).eq.2)
then
660 call rzero(diagt,maxcg)
661 call rzero(upper,maxcg)
669 IF (imsh.EQ.2) nel=nelt
670 IF (imsh.EQ.2) vol=voltm1
676 if (restol(ifield).ne.0) tol=restol(ifield)
677 if (name.eq.
'PRES'.and.param(21).ne.0) tol=abs(param(21))
679 if (tin.lt.0) tol=abs(tin)
680 niter = min(maxit,maxcg)
682 if (.not.ifsolv)
then
689 if (kfldfdm.lt.0)
then
691 elseif(param(100).ne.2)
then
700 if (fmax.eq.0.0)
return
706 skmin =
glmin(mask,n)
707 if (skmin.gt.0.and.h2max.eq.0) ifmcor = .true.
709 if (name.eq.
'PRES')
then
713 smean = -1./
glsum(bm1,n)
714 rmean = smean*
glsc2(r,mult,n)
716 call dssum(x,lx1,ly1,lz1)
727 if (kfldfdm.lt.0)
then
731 if (name.eq.
'PRES'.and.param(100).eq.2)
then
736 call fdm_h1(z,r,d,mask,mult,nel,ktype(1,1,kfldfdm),w)
737 if (name.eq.
'PRES')
then
744 if (name.eq.
'PRES')
then
747 rmean = smean*
glsc2(z,bm1,n)
753 scalar(1)=
vlsc3(z,r,mult,n)
754 if(param(18).eq.1)
then
755 scalar(2)=
vlsc3(r,r,mult,n)
757 scalar(2)=
vlsc32(r,mult,binv,n)
759 call gop(scalar,w,
'+ ',2)
761 rbn2=sqrt(scalar(2)/vol)
762 if (iter.eq.1) rbn0 = rbn2
763 if (param(22).lt.0) tol=abs(param(22))*rbn0
764 if (tin.lt.0) tol=abs(tin)*rbn0
766 ifprint_hmh = .false.
767 if (nio.eq.0.and.ifprint.and.param(74).ne.0) ifprint_hmh=.true.
768 if (nio.eq.0.and.istep.eq.1) ifprint_hmh=.true.
771 &
write(6,3002) istep,
' Hmholtz ' // name,
772 & iter,rbn2,h1(1),tol,h2(1),ifmcor
777 IF (rbn2.LE.tol.and.(iter.gt.1 .or. istep.le.5))
THEN
779 iter_max = param(150)
780 if (name.eq.
'PRES') iter_max = param(151)
781 if (iter.gt.iter_max)
then
787 &
write(6,3000) istep,
' Hmholtz ' // name,
788 & niter,rbn2,rbn0,tol
793 if (iter.eq.1) beta=0.0
795 call axhelm (w,p,h1,h2,imsh,isd)
796 call dssum (w,lx1,ly1,lz1)
800 rho =
glsc3(w,p,mult,n)
809 diagt(iter) = rho/rtz1
810 elseif (iter.le.maxcg)
then
812 diagt(iter) = (beta**2 * rho0 + rho ) / rtz1
813 upper(iter-1) = -beta * rho0 / sqrt(rtz2 * rtz1)
818 if (nio.eq.0)
write (6,3001) istep,
' Error Hmholtz ' // name,
819 & niter,rbn2,rbn0,tol
822 3000
format(i11,a,1x,i7,1p4e13.4)
823 3001
format(i11,a,1x,i7,1p4e13.4)
824 3002
format(i11,a,1x,i7,1p4e13.4,l4)
851 s = s + b(i)*m(i)*r(i)*r(i)
857 subroutine calc (diag,upper,d,e,n,dmax,dmin)
859 dimension diag(n),upper(n)
862 call copy (d,diag ,n)
863 call copy (e,upper,n)
869 dd = abs( d(m) ) + abs( d(m+1) )
870 if ( abs(e(m)) + dd .eq. dd )
goto 2
874 2
if ( m .ne. l )
then
876 if ( iter .eq. 30 )
then
877 write (6,*)
'too many iterations'
882 g = ( d(l+1) - d(l) ) / ( 2.0 * e(l) )
883 r = sqrt( g**2 + 1.0 )
887 g = d(m) - d(l) + e(l)/(g+sign(r,g))
895 if ( abs(f) .ge. abs(g) )
then
897 r = sqrt( c**2 + 1.0 )
903 r = sqrt( s**2 + 1.0 )
910 r = ( d(i) - g ) * s + 2.0 * c * b
929 dmax = abs( max( d(i) , dmax ) )
930 dmin = abs( min( d(i) , dmin ) )
936 subroutine fdm_h1(z,r,d,mask,mult,nel,kt,rr)
940 common /ctmp0/ w(lx1,ly1,lz1)
946 real z(lx1,ly1,lz1,1)
947 real r(lx1,ly1,lz1,1)
948 real d(lx1,ly1,lz1,1)
949 real mask(lx1,ly1,lz1,1)
950 real mult(lx1,ly1,lz1,1)
951 real rr(lx1,ly1,lz1,1)
962 ntot = lx1*ly1*lz1*nel
965 call col3(rr,r,bhalf,ntot)
977 call mxm(fdst(1,kt(ie,1)),n1,rr(1,1,1,ie),n1,w,n2)
979 call mxm(w(1,1,iz),n1,fds(1,kt(ie,2)),n1,z(1,1,iz,ie),n1)
981 call mxm(z(1,1,1,ie),n2,fds(1,kt(ie,3)),n1,w,n1)
985 call col2(w,d(1,1,1,ie),n3)
989 call mxm(w,n2,fdst(1,kt(ie,3)),n1,z(1,1,1,ie),n1)
991 call mxm(z(1,1,iz,ie),n1,fdst(1,kt(ie,2)),n1,w(1,1,iz),n1)
993 call mxm(fds(1,kt(ie,1)),n1,w,n1,z(1,1,1,ie),n2)
997 call mxm(fdst(1,kt(ie,1)),n1,rr(1,1,1,ie),n1,w,n1)
998 call mxm(w,n1,fds(1,kt(ie,2)),n1,z(1,1,1,ie),n1)
1002 call col2(z(1,1,1,ie),d(1,1,1,ie),n2)
1006 call mxm(z(1,1,1,ie),n1,fdst(1,kt(ie,2)),n1,w,n1)
1007 call mxm(fds(1,kt(ie,1)),n1,w,n1,z(1,1,1,ie),n1)
1018 if (ifbhalf)
call col2(z,bhalf,ntot)
1021 call dssum(z,lx1,ly1,lz1)
1022 call col2 (z,mask,ntot)
1037 COMMON /ctmp0/ w(lx1,lx1),aa(lx1,lx1),bb(lx1,lx1)
1051 delta = abs( zgm1(2,1) - zgm1(1,1) )
1067 call mxm(bb,n,dxm1 ,n,w,n)
1068 call mxm(dxtm1,n,w,n,aa,n)
1071 bb(1,1) = bb(1,1) + bbh
1072 aa(1,1) = aa(1,1) + aah
1073 elseif (left.eq.2)
then
1083 if (right.eq.1)
then
1085 bb(n,n) = bb(n,n) + bbh
1086 aa(n,n) = aa(n,n) + aah
1087 elseif (right.eq.2)
then
1107 call copy(fds(1,l),aa,n*n)
1112 ntot = lx1*ly1*lz1*nelv
1113 if (ifbhalf)
call copy (bhalf,binvm1,ntot)
1114 if (ifbhalf)
call vsqrt(bhalf,ntot)
1130 COMMON /ctmp0/ w(lx1,lx1),aa(lx1,lx1),bb(lx1,lx1)
1131 $ , mask(lx1,ly1,lz1,lelt)
1143 ntot = lx1*ly1*lz1*nelt
1147 if (ifflow) kf1 = ldim
1148 if (ifsplit) kf1 = ldim+1
1151 if (kfld.eq.0) ifld = 2
1153 if (kfld.eq.0)
call copy(mask, tmask,ntot)
1154 if (kfld.eq.1)
call copy(mask,v1mask,ntot)
1155 if (kfld.eq.2)
call copy(mask,v2mask,ntot)
1156 if (kfld.eq.3)
call copy(mask,v3mask,ntot)
1157 if (kfld.eq.ldim+1)
call copy(mask, pmask,ntot)
1160 do ifacedim = 1,ldim
1169 if (ifacedim.eq.1) ii = 1
1170 if (ifacedim.eq.2) jj = 1
1171 if (ifacedim.eq.3) kk = 1
1173 if (if3d) k1 = ii+lx1*(jj-1) + lx1*lx1*(kk-1)
1175 if (ifacedim.eq.1) ii = lx1
1176 if (ifacedim.eq.2) jj = lx1
1177 if (ifacedim.eq.3) kk = lx1
1179 if (if3d) k2 = ii+lx1*(jj-1) + lx1*lx1*(kk-1)
1182 iface = 2*ifacedim-1
1186 iface = eface(iface)
1187 jface = eface(jface)
1191 cb = cbc(iface,ie,ifld)
1192 if (cb.eq.
'E '.or.cb.eq.
'P '.or.cb.eq.
'p ')
then
1195 elseif (mask(k1,1,1,ie).eq.0)
then
1206 cb = cbc(jface,ie,ifld)
1207 if (cb.eq.
'E '.or.cb.eq.
'P '.or.cb.eq.
'p ')
then
1210 elseif (mask(k2,1,1,ie).eq.0)
then
1219 ijc = ic1 + 3*(jc1-1)
1220 ktype(ie,ifacedim,kfld) = ijc
1234 if (idim.eq.3.or.ldim.eq.2) k2=1
1244 jump = (lx1-1)*lx1**(idim-1)
1252 dl2 = (xm1(i+jump,j,k,ie)-xm1(i,j,k,ie))**2
1253 $ + (ym1(i+jump,j,k,ie)-ym1(i,j,k,ie))**2
1254 $ + (zm1(i+jump,j,k,ie)-zm1(i,j,k,ie))**2
1255 dlm = dlm + dl2*wxm1(i)*wxm1(j)*wxm1(k)
1256 wgt = wgt + wxm1(i)*wxm1(j)*wxm1(k)
1263 elsize(idim,ie) = dlm/2.
1268 1
format(i8,a8,1p3e15.4)
1278 real d (lx1,ly1,lz1,1)
1279 real h1(lx1,ly1,lz1,1)
1280 real h2(lx1,ly1,lz1,1)
1287 h1b =
vlsum(h1(1,1,1,ie),nxyz)/nxyz
1288 h2b =
vlsum(h2(1,1,1,ie),nxyz)/nxyz
1289 k1 = ktype(ie,1,kfldfdm)
1290 k2 = ktype(ie,2,kfldfdm)
1291 k3 = ktype(ie,3,kfldfdm)
1292 vol = elsize(1,ie)*elsize(2,ie)*elsize(3,ie)
1293 vl1 = elsize(2,ie)*elsize(3,ie)/elsize(1,ie)
1294 vl2 = elsize(1,ie)*elsize(3,ie)/elsize(2,ie)
1295 vl3 = elsize(1,ie)*elsize(2,ie)/elsize(3,ie)
1299 den = h1b*(vl1*dd(i1,k1) + vl2*dd(i2,k2) + vl3*dd(i3,k3))
1301 if (ifbhalf) den = den/vol
1303 d(i1,i2,i3,ie) = 1./den
1310 3
format(a4,1p4e12.4,8i8)
1320 h1b =
vlsc2(h1(1,1,1,ie),ym1(1,1,1,ie),nxyz)/nxyz
1321 h2b =
vlsc2(h2(1,1,1,ie),ym1(1,1,1,ie),nxyz)/nxyz
1323 h1b =
vlsum(h1(1,1,1,ie),nxyz)/nxyz
1324 h2b =
vlsum(h2(1,1,1,ie),nxyz)/nxyz
1326 k1 = ktype(ie,1,kfldfdm)
1327 k2 = ktype(ie,2,kfldfdm)
1328 vol = elsize(1,ie)*elsize(2,ie)
1329 vl1 = elsize(2,ie)/elsize(1,ie)
1330 vl2 = elsize(1,ie)/elsize(2,ie)
1334 den = h1b*( vl1*dd(i1,k1) + vl2*dd(i2,k2) )
1336 if (ifbhalf) den = den/vol
1338 d(i1,i2,i3,ie) = 1./den
1347 2
format(a4,1p3e12.4,8i8)
1382 real a(n,n),b(n,n),lam(n),w(n,n)
1383 real aa(100),bb(100)
1385 parameter(lbw=4*lx1*ly1*lz1*lelv)
1386 common /bigw/ bw(lbw)
1397 call dsygv(1,
'V',
'U',n,a,n,b,n,lam,bw,lbw,info)
1408 call outmat2(lam,1,n,n,
'Deig')
1412 write(6,*)
'Error in generalev, info=',info,n,ninf
1425 write(6,2) nid,name,m,n,k
1427 write(6,1) nid,name,(a(i,j),j=1,n2)
1430 1
format(i3,1x,a4,1p8e14.5)
1431 2
format(/,
'Matrix: ',i3,1x,a4,3i8)
1436 real a(n,n),b(n,n),w(n)
1446 w(i) = 1./sqrt(b(i,i))
1451 a(i,j) = a(i,j)*w(i)*w(j)
1471 real u (lx1,ly1,lz1,1)
1472 real rhs (lx1,ly1,lz1,1)
1473 real h1 (lx1,ly1,lz1,1)
1474 real h2 (lx1,ly1,lz1,1)
1475 real mask (lx1,ly1,lz1,1)
1481 if (ifield.eq.2)
then
1482 call cggo_dg (u,rhs,h1,h2,bintm1,mask,name,tol,maxit)
1484 call cggo_dg (u,rhs,h1,h2,binvm1,mask,name,tol,maxit)
1493 subroutine cggo_dg(x,f,h1,h2,binv,mask,name,tin,maxit)
1505 real x(1),f(1),h1(1),h2(1),binv(1),mask(1)
1506 parameter(lg=lx1*ly1*lz1*lelt)
1507 common /scrcg/ d(lg) , scalar(2)
1508 common /scrmg/ r(lg) , w(lg) , p(lg) , z(lg)
1510 parameter(maxcg=900)
1511 common /tdarray/ diagt(maxcg),upper(maxcg)
1512 common /iterhm/ niterhm
1515 common /fastmd/ ifdfrm(lelt), iffast(lelt), ifh2, ifsolv
1516 logical ifdfrm, iffast, ifh2, ifsolv
1518 common /cprint/ ifprint, ifhzpc
1519 logical ifprint, ifhzpc
1525 call rzero(diagt,maxcg)
1526 call rzero(upper,maxcg)
1533 if (ifield.eq.2) nel=nelt
1534 if (ifield.eq.2) vol=voltm1
1538 if (param(22).ne.0) tol=abs(param(22))
1539 niter = min(maxit,maxcg)
1552 h2max =
glmax(h2 ,n)
1553 skmin =
glmin(mask,n)
1554 if (skmin.gt.0.and.h2max.eq.0) ifmcor = .true.
1558 call cadd(r,rmean,n)
1564 do 1000 iter=1,niter
1570 scalar(1)=
vlsc2(z,r,n)
1571 scalar(2)=
vlsc3(r,r,binv,n)
1572 call gop(scalar,w,
'+ ',2)
1574 rbn2=sqrt(scalar(2)/vol)
1575 if (iter.eq.1) rbn0 = rbn2
1576 if (param(22).lt.0) tol=abs(param(22))*rbn0
1578 if (ifprint.and.nid.eq.0.and.param(74).ne.0)
then
1579 write(6,3002) istep,iter,name,ifmcor,rbn2,tol,h1(1),h2(1)
1582 if (rbn2.le.tol)
then
1584 if(nid.eq.0.and.((.not.ifhzpc).or.ifprint))
1585 $
write(6,3000) istep,name,niter,rbn2,rbn0,tol
1590 if (iter.eq.1) beta=0.0
1592 call hxdg (w,p,h1,h2)
1598 call add2s2(x,p ,alpha,n)
1599 call add2s2(r,w ,alphm,n)
1604 diagt(iter) = rho/rtz1
1605 elseif (iter.le.maxcg)
then
1607 diagt(iter) = (beta**2 * rho0 + rho ) / rtz1
1608 upper(iter-1) = -beta * rho0 / sqrt(rtz2 * rtz1)
1613 if (nid.eq.0)
write (6,3001) istep,niter,name,rbn2,rbn0,tol
1614 3000
format(i9,4x,
'hmh dg ',a4,
': ',i6,1p6e13.4)
1615 3001
format(2i6,
' **ERROR**: Failed in hmh_dg: ',a4,1p6e13.4)
1616 3002
format(i3,i6,
' HMH dg ',a4,1x,l4,
':',1p6e13.4)
1645 write(6,*) ie,
' matrix: ',name6,m,n
1647 write(6,6) ie,name6,(a(i,j),j=1,n18)
1649 6
format(i3,1x,a6,18f7.2)
1660 write(6,*) ie,
' matrix: ',name6,m,n
1663 write(6,*) ie,
' matrix: ',name6,ll,k
1665 write(6,6) ie,name6,(a(ll,i,j,k),i=1,m)
1669 6
format(i3,1x,a6,18f7.2)
1675 integer a(l,m,n,nel)
1680 write(6,*) ie,
' matrix: ',name6,m,n
1683 write(6,*) ie,
' matrix: ',name6,ll,k
1685 write(6,6) ie,name6,(a(ll,i,j,k),i=1,m)
1689 6
format(i3,1x,a6,18i7)
1700 write(6,*) ie,
' matrix: ',name6,m,n
1702 if (m.eq.3)
write(6,3) ie,name6,((a(i,j,k),i=1,m),k=1,2)
1703 if (m.eq.4)
write(6,4) ie,name6,((a(i,j,k),i=1,m),k=1,2)
1704 if (m.eq.5)
write(6,5) ie,name6,((a(i,j,k),i=1,m),k=1,2)
1705 if (m.eq.6)
write(6,6) ie,name6,((a(i,j,k),i=1,m),k=1,2)
1707 3
format(i3,1x,a6,2(3i7,2x))
1708 4
format(i3,1x,a6,2(4i7,2x))
1709 5
format(i3,1x,a6,2(5i7,2x))
1710 6
format(i3,1x,a6,2(6i7,2x))
1715 subroutine gradr(ur,us,ut,u,Dr,Dst,Dtt,nr,ns,nt,if3d)
1719 real ur(nr,ns,nt),us(nr,ns,nt),ut(nr,ns,nt)
1721 real Dr(nr,nr),Dst(ns,ns),Dtt(nt,nt)
1729 call mxm(dr,nr,u,nr,ur,nst)
1731 call mxm(u(1,1,k),nr,dst,ns,us(1,1,k),nt)
1733 call mxm(u,nrs,dtt,nt,ut,nt)
1735 call mxm(dr,nr,u ,nr,ur,ns)
1736 call mxm(u ,nr,dst,ns,us,ns)
1742 subroutine gradrta(u,ur,us,ut,Drt,Ds,Dt,nr,ns,nt,if3d)
1749 real ur(nr,ns,nt),us(nr,ns,nt),ut(nr,ns,nt)
1750 real Dr(nr,nr),Dst(ns,ns),Dtt(nt,nt)
1758 call mxma(drt,nr,ur,nr,u,nst)
1760 call mxma(us(1,1,k),nr,ds,ns,u(1,1,k),nt)
1762 call mxma(ut,nrs,dt,nt,u,nt)
1764 call mxma(drt,nr,ur,nr,u,ns)
1765 call mxma(us ,nr,ds,ns,u,ns)
1778 real u(lx1*lz1*2*ldim*lelt,2)
1779 real w(lx1*lz1*2*ldim*lelt,2)
1781 n = 2*ldim*lx1*lz1*nelt
1787 call fgslib_gs_op (gsh_loc,w(1,j),1,1,0)
1790 u(i,j) = 2*u(i,j)-w(i,j)
1806 real d(lx1,ly1,lz1,1)
1807 common /fastmd/ ifdfrm(lelt), iffast(lelt), ifh2, ifsolv
1808 logical ifdfrm, iffast, ifh2, ifsolv
1809 real h1(lx1*ly1*lz1,1), h2(lx1*ly1*lz1,1)
1814 if (imsh.eq.1) nel=nelv
1816 call dsset(lx1,ly1,lz1)
1824 call rzero(d(1,1,1,e),nxyz)
1832 d(ix,iy,iz,e) = d(ix,iy,iz,e)
1833 $ + g1m1(iq,iy,iz,e) * dxm1(iq,ix)**2
1834 $ + g2m1(ix,iq,iz,e) * dxm1(iq,iy)**2
1835 $ + g3m1(ix,iy,iq,e) * dxm1(iq,iz)**2
1844 d(1,i1,i2,e) = d(1,i1,i2,e)
1845 $ + g4m1(1,i1,i2,e) * dxtm1(1,1)*dytm1(i1,i1)
1846 $ + g5m1(1,i1,i2,e) * dxtm1(1,1)*dztm1(i2,i2)
1847 d(lx1,i1,i2,e) = d(lx1,i1,i2,e)
1848 $ + g4m1(lx1,i1,i2,e) * dxtm1(lx1,lx1)*dytm1(i1,i1)
1849 $ + g5m1(lx1,i1,i2,e) * dxtm1(lx1,lx1)*dztm1(i2,i2)
1850 d(i1,1,i2,e) = d(i1,1,i2,e)
1851 $ + g4m1(i1,1,i2,e) * dytm1(1,1)*dxtm1(i1,i1)
1852 $ + g6m1(i1,1,i2,e) * dytm1(1,1)*dztm1(i2,i2)
1853 d(i1,ly1,i2,e) = d(i1,ly1,i2,e)
1854 $ + g4m1(i1,ly1,i2,e) * dytm1(ly1,ly1)*dxtm1(i1,i1)
1855 $ + g6m1(i1,ly1,i2,e) * dytm1(ly1,ly1)*dztm1(i2,i2)
1856 d(i1,i2,1,e) = d(i1,i2,1,e)
1857 $ + g5m1(i1,i2,1,e) * dztm1(1,1)*dxtm1(i1,i1)
1858 $ + g6m1(i1,i2,1,e) * dztm1(1,1)*dytm1(i2,i2)
1859 d(i1,i2,lz1,e) = d(i1,i2,lz1,e)
1860 $ + g5m1(i1,i2,lz1,e) * dztm1(lz1,lz1)*dxtm1(i1,i1)
1861 $ + g6m1(i1,i2,lz1,e) * dztm1(lz1,lz1)*dytm1(i2,i2)
1870 if (ifaxis)
call setaxdy ( ifrzer(e) )
1875 d(ix,iy,iz,e) = d(ix,iy,iz,e)
1876 $ + g1m1(iq,iy,iz,e) * dxm1(iq,ix)**2
1877 $ + g2m1(ix,iq,iz,e) * dxm1(iq,iy)**2
1884 d(1,i1,iz,e) = d(1,i1,iz,e)
1885 $ + g4m1(1,i1,iz,e) * dxm1(1,1)*dym1(i1,i1)
1886 d(lx1,i1,iz,e) = d(lx1,i1,iz,e)
1887 $ + g4m1(lx1,i1,iz,e) * dxm1(lx1,lx1)*dym1(i1,i1)
1888 d(i1,1,iz,e) = d(i1,1,iz,e)
1889 $ + g4m1(i1,1,iz,e) * dym1(1,1)*dxm1(i1,i1)
1890 d(i1,ly1,iz,e) = d(i1,ly1,iz,e)
1891 $ + g4m1(i1,ly1,iz,e) * dym1(ly1,ly1)*dxm1(i1,i1)
1903 jskip1 = skpdat(3,pf)
1906 jskip2 = skpdat(6,pf)
1909 do j2=js2,jf2,jskip2
1910 do j1=js1,jf1,jskip1
1912 d(j1,j2,1,e) = d(j1,j2,1,e) + etalph(i,f,e)
1923 d( 1,i1,i2,e)=d( 1,i1,i2,e)-2*fw(4,e)*unr(i,4,e)*dxm1( 1, 1)
1924 d(nx,i1,i2,e)=d(nx,i1,i2,e)-2*fw(2,e)*unr(i,2,e)*dxm1(nx,nx)
1925 d(i1, 1,i2,e)=d(i1, 1,i2,e)-2*fw(1,e)*uns(i,1,e)*dym1( 1, 1)
1926 d(i1,nx,i2,e)=d(i1,nx,i2,e)-2*fw(3,e)*uns(i,3,e)*dym1(nx,nx)
1927 d(i1,i2, 1,e)=d(i1,i2, 1,e)-2*fw(5,e)*unt(i,5,e)*dzm1( 1, 1)
1928 d(i1,i2,nx,e)=d(i1,i2,nx,e)-2*fw(6,e)*unt(i,6,e)*dzm1(nx,nx)
1934 d( 1,i1,1,e)=d( 1,i1,1,e)-2*fw(4,e)*unr(i,4,e)*dxm1( 1, 1)
1935 d(nx,i1,1,e)=d(nx,i1,1,e)-2*fw(2,e)*unr(i,2,e)*dxm1(nx,nx)
1936 d(i1, 1,1,e)=d(i1, 1,1,e)-2*fw(1,e)*uns(i,1,e)*dym1( 1, 1)
1937 d(i1,nx,1,e)=d(i1,nx,1,e)-2*fw(3,e)*uns(i,3,e)*dym1(nx,nx)
1942 d(i,1,1,e)=1./(d(i,1,1,e)*h1(i,e)+h2(i,e)*bm1(i,1,1,e))
1949 if (ifaxis.and.(isd.eq.2))
then
1953 if (ifrzer(e))
call mxm(ym1(1,1,1,e),lx1,datm1,ly1,ysm1,1)
1959 if (ym1(i,j,1,e).ne.0.)
then
1960 term1 = bm1(i,j,1,e)/ym1(i,j,1,e)**2
1962 term2 = wxm1(i)*wam1(1)*dam1(1,j)
1963 $ *jacm1(i,1,1,e)/ysm1(i)
1967 d(i,j,1,e) = d(i,j,1,e)
1968 $ + h1(k,e)*(term1+term2)
1987 parameter(lxyz=lx1*ly1*lz1)
1989 real au(lx1,ly1,lz1,lelt),u(lx1,ly1,lz1,lelt)
1990 real h1(lx1,ly1,lz1,lelt),h2(1)
1992 common /ytmp9/ qr(lx1,ly1,lz1),qs(lx1,ly1,lz1),qt(lx1,ly1,lz1)
1997 call dsset(lx1,ly1,lz1)
1999 n = lx1*ly1*lz1*nelfld(ifield)
2001 do e=1,nelfld(ifield)
2004 if (fw(f,e).gt.0.6) iflag=1
2006 if (iflag.gt.0)
then
2008 if (ifaxis)
call setaxdy(ifrzer(e))
2017 if (fw(f,e).gt.0.6)
then
2021 jskip1 = skpdat(3,pf)
2024 jskip2 = skpdat(6,pf)
2027 if (cbc(f,e,ifield).eq.
'O '.or.cbc(f,e,ifield).eq.
'I ')
2031 do j2=js2,jf2,jskip2
2032 do j1=js1,jf1,jskip1
2034 fwt = fwtbc * h1(j1,j2,1,e)*u(j1,j2,1,e)
2035 et1 = etalph(i,f,e)*h1(j1,j2,1,e)*u(j1,j2,1,e)
2036 qr(j1,j2,1) = qr(j1,j2,1)-fwt*unr(i,f,e)
2037 qs(j1,j2,1) = qs(j1,j2,1)-fwt*uns(i,f,e)
2038 qt(j1,j2,1) = qt(j1,j2,1)-fwt*unt(i,f,e)
2039 au(j1,j2,1,e) = au(j1,j2,1,e)+et1*fwtbc
2045 call gradrta(au(1,1,1,e),qr,qs,qt
2046 $ ,dxtm1,dym1,dzm1,lx1,ly1,lz1,if3d)
2060 parameter(lxyz=lx1*ly1*lz1)
2061 real au(lx1,ly1,lz1,1),u(lx1,ly1,lz1,1),h1(lx1,ly1,lz1,1),h2(1)
2063 common /ctmp0/ w(2*lx1*lz1*2*ldim*lelt)
2064 common /ctmp1/ ur(lx1,ly1,lz1,lelt),us(lx1,ly1,lz1,lelt)
2065 $ ,ut(lx1,ly1,lz1,lelt)
2066 common /ytmp9/ qr(lx1,ly1,lz1),qs(lx1,ly1,lz1),qt(lx1,ly1,lz1)
2067 common /ytmp0/ uf(lx1*lz1,2*ldim,lelt,2)
2071 n = lx1*ly1*lz1*nelfld(ifield)
2074 call dsset(lx1,ly1,lz1)
2076 call col4(au,h2,bm1,u,n)
2078 do e=1,nelfld(ifield)
2080 if (ifaxis)
call setaxdy(ifrzer(e))
2082 call gradr(ur(1,1,1,e),us(1,1,1,e),ut(1,1,1,e)
2083 $ ,u(1,1,1,e),dxm1,dytm1,dztm1,lx1,ly1,lz1,if3d)
2089 jskip1 = skpdat(3,pf)
2092 jskip2 = skpdat(6,pf)
2095 do j2=js2,jf2,jskip2
2096 do j1=js1,jf1,jskip1
2099 uf(i,f,e,1) = u(j1,j2,1,e)*h1(j1,j2,1,e)
2100 uf(i,f,e,2) = (unr(i,f,e)*ur(j1,j2,1,e)
2101 $ + uns(i,f,e)*us(j1,j2,1,e)
2102 $ + unt(i,f,e)*ut(j1,j2,1,e))*h1(j1,j2,1,e)
2110 do e=1,nelfld(ifield)
2111 if (ifaxis)
call setaxdy(ifrzer(e))
2113 qr(i,1,1) = (g1m1(i,1,1,e)*ur(i,1,1,e)
2114 $ +g4m1(i,1,1,e)*us(i,1,1,e)
2115 $ +g5m1(i,1,1,e)*ut(i,1,1,e))*h1(i,1,1,e)
2116 qs(i,1,1) = (g4m1(i,1,1,e)*ur(i,1,1,e)
2117 $ +g2m1(i,1,1,e)*us(i,1,1,e)
2118 $ +g6m1(i,1,1,e)*ut(i,1,1,e))*h1(i,1,1,e)
2119 qt(i,1,1) = (g5m1(i,1,1,e)*ur(i,1,1,e)
2120 $ +g6m1(i,1,1,e)*us(i,1,1,e)
2121 $ +g3m1(i,1,1,e)*ut(i,1,1,e))*h1(i,1,1,e)
2127 if (cbc(f,e,ifield).eq.
'O '.or.cbc(f,e,ifield).eq.
'I ')
2132 jskip1 = skpdat(3,pf)
2135 jskip2 = skpdat(6,pf)
2139 do j2=js2,jf2,jskip2
2140 do j1=js1,jf1,jskip1
2143 qr(j1,j2,1)=qr(j1,j2,1)-fwt*unr(i,f,e)*uf(i,f,e,1)
2144 qs(j1,j2,1)=qs(j1,j2,1)-fwt*uns(i,f,e)*uf(i,f,e,1)
2145 qt(j1,j2,1)=qt(j1,j2,1)-fwt*unt(i,f,e)*uf(i,f,e,1)
2146 au(j1,j2,1,e) = au(j1,j2,1,e)-fwt*uf(i,f,e,2)
2147 $ + etalph(i,f,e)*uf(i,f,e,1)*fwtbc
2153 call gradrta(au(1,1,1,e),qr,qs,qt
2154 $ ,dxtm1,dym1,dzm1,lx1,ly1,lz1,if3d)
2170 common /ctolpr/ divex
2171 common /cprint/ ifprint
2173 real res (lx1*ly1*lz1*lelv)
2174 real h1 (lx1,ly1,lz1,lelv)
2175 real h2 (lx1,ly1,lz1,lelv)
2176 real wt (lx1,ly1,lz1,lelv)
2178 parameter(lt=lx1*ly1*lz1*lelt)
2179 common /scrcg/ r(lt),z(lt),p(lt),w(lt)
2180 common /scrmg/ r1(lt)
2182 common /cgmres1/ y(lgmres)
2183 common /ctmp0/ wk1(lgmres),wk2(lgmres)
2187 logical iflag,if_hyb
2190 data iflag,if_hyb /.false. , .false. /
2196 n = lx1*ly1*lz1*nelv
2198 div0 = gamma_gmres(1)*norm_fac
2207 call chktcg1(tolps,res,h1,h2,pmask,vmult,1,1)
2208 if (param(21).gt.0.and.tolps.gt.abs(param(21)))
2209 $ tolps = abs(param(21))
2210 if (istep.eq.0) tolps = 1.e-4
2220 div0 = sqrt(
glsc3(r,wt,r,n)/volvm1)
2222 if (param(21).lt.0) tolpss=abs(param(21))*div0
2227 if (param(40).ge.0 .and. param(40).le.2)
then
2229 else if (param(40).eq.3)
then
2235 rho1 =
glsc3(z,wt,r,n)
2236 rho2 = -
glsc3(z,wt,r1,n)
2242 call ax(w,p,h1,h2,n)
2243 den =
glsc3(w,wt,p,n)
2247 res(i) = res(i) + alpha*p(i)
2248 r(i) = r(i) - alpha*w(i)
2249 rnorm = rnorm + r(i)*r(i)*wt(i,1,1,1)
2251 call gop(rnorm,temp,
'+ ',1)
2254 rnorm = sqrt(rnorm/volvm1)
2258 if (ifprint.and.nio.eq.0)
2259 $
write (6,66) iter,tolpss,rnorm,div0,ratio,istep
2260 66
format(i5,1p4e12.5,i8,
' Divergence')
2262 if (rnorm .lt. tolpss)
goto 900
2270 if (nio.eq.0)
write(6,9999) istep,iter,divex,div0,tolpss,etime_p,
2272 9999
format(4x,i7,
' PRES cgflex',4x,i5,1p5e13.4,1x,l4)
2274 if (outer.le.2) if_hyb = .false.
subroutine gop(x, w, op, n)
real *8 function dnekclock()
subroutine dsset(nx, ny, nz)
subroutine dssum(u, nx, ny, nz)
subroutine dsygv(ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK, LWORK, INFO)
subroutine h1_overlap_2(u, v, mask)
subroutine hmh_gmres(res, h1, h2, wt, iter)
subroutine ax(w, x, h1, h2, n)
subroutine fdm_h1(z, r, d, mask, mult, nel, kt, rr)
subroutine outmat2(a, m, n, k, name)
subroutine setfast(helm1, helm2, imesh)
subroutine chktcg1(tol, res, h1, h2, mask, mult, imesh, isd)
subroutine outmax(a, m, n, name6, ie)
subroutine hmholtz(name, u, rhs, h1, h2, mask, mult, imsh, tli, maxit, isd)
subroutine generalev(a, b, lam, n, w)
subroutine gradr(ur, us, ut, u, Dr, Dst, Dtt, nr, ns, nt, if3d)
subroutine set_fdm_prec_h1a_els
subroutine hxdg_surfa(au, u, h1, h2)
subroutine hxdg(au, u, h1, h2)
subroutine gradrta(u, ur, us, ut, Drt, Ds, Dt, nr, ns, nt, if3d)
subroutine cggo(x, f, h1, h2, mask, mult, imsh, tin, maxit, isd, binv, name)
subroutine hmh_flex_cg(res, h1, h2, wt, iter)
subroutine outmat4(a, l, m, n, nel, name6, ie)
subroutine ioutmat4(a, l, m, n, nel, name6, ie)
subroutine axhelm(au, u, helm1, helm2, imesh, isd)
function vlsc32(r, b, m, n)
subroutine cggo_dg(x, f, h1, h2, binv, mask, name, tin, maxit)
subroutine set_fdm_prec_h1b(d, h1, h2, nel)
subroutine hmholtz_dg(name, u, rhs, h1, h2, mask, tol, maxit)
subroutine face_diff(u, d, gsh_loc, w)
subroutine set_fdm_prec_h1a_gen
subroutine ioutfld(a, m, n, nel, name6, ie)
subroutine set_fdm_prec_h1a
subroutine calc(diag, upper, d, e, n, dmax, dmin)
subroutine setprec_dg(d, h1, h2, imsh, isd)
subroutine rescale_abhalf(a, b, w, n)
subroutine setprec(dpcm1, helm1, helm2, imsh, isd)
subroutine h1mg_solve(z, rhs, if_hybrid)
subroutine cadd(a, const, n)
subroutine col3(a, b, c, n)
subroutine transpose(a, lda, b, ldb)
subroutine addcol3(a, b, c, n)
function glsc3(a, b, mult, n)
real function vlamax(vec, n)
subroutine add2s2(a, b, c1, n)
real function vlmax(vec, n)
subroutine addcol4(a, b, c, d, n)
subroutine add3(a, b, c, n)
subroutine col4(a, b, c, d, n)
real function vlsum(vec, n)
real function vlsc2(x, y, n)
subroutine cmult(a, const, n)
real function glamax(a, n)
subroutine chcopy(a, b, n)
subroutine add2s1(a, b, c1, n)
real function vlmin(vec, n)
subroutine mxma(a, n1, b, n2, c, n3)
subroutine mxm(a, n1, b, n2, c, n3)
function vlsc3(X, Y, B, N)
subroutine crs_solve_h1(uf, vf)
subroutine setaxdy(ifaxdy)