6 character*3 dfsbc(ndfsbc)
20 call smoothmesh(mtyp,nouter,nlap,nopt,ndfsbc,dfsbc,idftyp,alpha,
30 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
31 parameter(nxyzc=lxc*lyc*lzc,nxyz=lx1*ly1*lz1)
33 real xmc(lxc,lyc,lzc,lelv),
34 $ ymc(lxc,lyc,lzc,lelv),
35 $ zmc(lxc,lyc,lzc,lelv),
36 $ mltc(lxc,lyc,lzc,lelv)
37 common /coarsemesh/ xmc,ymc,zmc
39 real x8(2**ldim,lelv*(2**ldim)),
40 $ y8(2**ldim,lelv*(2**ldim)),
41 $ z8(2**ldim,lelv*(2**ldim)),
42 $ nodmask(2**ldim,lelv*(2**ldim)),
43 $ dis((2**ldim)*lelv*(2**ldim)),
44 $ mlt((2**ldim)*lelv*(2**ldim))
45 common /coarsemesh8/ x8,y8,z8
47 real dx(nxyzc,lelv),dy(nxyzc,lelv),dz(nxyzc,lelv),
48 $ xbp(nxyzc,lelv),ybp(nxyzc,lelv),zbp(nxyzc,lelv)
49 common / msmbackup / dx,dy,dz,xbp,ybp,zbp
51 real dxm(nxyz,lelv),dym(nxyz,lelv),dzm(nxyz,lelv),
52 $ dxn(nxyz,lelv),dyn(nxyz,lelv),dzn(nxyz,lelv)
54 integer opt,gshl,gshlc,lapinv,optinv
55 real alpha,beta,etstart, etend,f1sav,f1,f1pre
63 if (nid.eq.0.and.loglevel.ge.5)
64 $
write(6,*)
'SMOOTHER-check original mesh'
67 call copy(dxm,xm1,lx1*ly1*lz1*nelv)
68 call copy(dym,ym1,lx1*ly1*lz1*nelv)
69 if (ldim.eq.3)
call copy(dzm,zm1,lx1*ly1*lz1*nelv)
75 call copy(dx,xmc,lxc*lyc*lzc*nelv)
76 call copy(dy,ymc,lxc*lyc*lzc*nelv)
77 if (ldim.eq.3)
call copy(dz,zmc,lxc*lyc*lzc*nelv)
79 call copy(xbp,xmc,lxc*lyc*lzc*nelt)
80 call copy(ybp,ymc,lxc*lyc*lzc*nelt)
81 if (ldim.eq.3)
call copy(zbp,zmc,lxc*lyc*lzc*nelt)
85 if (ldim.eq.3)
call xmtox8(zmc,z8)
88 call genmask(nodmask,mlt,gshl,mltc,gshlc)
91 call disfun(dis,idftyp,alpha,beta,dcbc,nbc)
95 call getglobsum(x8,y8,z8,mlt,gshl,2**ldim,1,f1sav)
97 $
write(6,
'(A,1p1e13.6)')
'SMOOTHER-initial energy',f1sav
103 if (nid.eq.0.and.loglevel.ge.2)
104 $
write(6,
'(A,I5)')
'SMOOTHER-iteration',j
107 call fastlap(nlap,nodmask,mlt,gshl,dis,lapinv,mltc,gshlc)
108 if (lapinv.eq.1) nlap = 0
112 call optcg(nopt,nodmask,mlt,gshl,dis,mtyp,optinv,mltc,gshlc)
114 if (optinv.eq.1) nopt = 0
117 call getglobsum(x8,y8,z8,mlt,gshl,2**ldim,mtyp,f1)
121 if (ldim.eq.3)
call xmtox8(zmc,z8)
125 if (nid.eq.0)
write(6,
'(A,I7,1p1e13.5)')
'SMOOTHER-energy',j,f1
126 if (nid.eq.0.and.loglevel.ge.2)
write(6,*)
'loop complete',j
127 if (f1.ge.f1pre)
goto 5001
128 if (nopt.eq.0.and.nlap.eq.0)
goto 5001
139 call opsub3(dxn,dyn,dzn,dxm,dym,dzm,xm1,ym1,zm1)
141 call opadd2(xm1,ym1,zm1,dxn,dyn,dzn)
143 call getglobsum(x8,y8,z8,mlt,gshl,2**ldim,mtyp,f1)
145 write(6,
'(A,1p1e13.6)')
'SMOOTHER-initial energy ',f1sav
146 write(6,
'(A,1p1e13.6)')
'SMOOTHER-final energy ',f1
147 write(6,
'(A,f5.2)')
'SMOOTHER-improve % ',100.*(f1sav-f1)/f1sav
148 write(6,
'(A,1p1e13.6)')
'SMOOTHER-time taken ',etend-etstart
162 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
163 real dxmc(3,3),dymc(3,3),dzmc(3,3)
164 real dxtmc(3,3),dytmc(3,3),dztmc(3,3)
165 common /coarseders/ dxmc,dymc,dzmc,dxtmc,dytmc,dztmc
166 real ixtmc3(lx1,3),ixmc3(3,lx1)
167 real ixtmf3(3,lx1),ixmf3(lx1,3)
168 common /coarseints/ ixmc3,ixtmc3,ixmf3,ixtmf3
170 real zgmf(lx1),wxmf(lx1)
174 call zwgll(zgmc,wxmc,3)
175 call zwgll(zgmf,wxmf,lx1)
177 call dgll(dxmc,dxtmc,zgmc,3,3)
178 call dgll(dymc,dytmc,zgmc,3,3)
180 call rzero(dztmc,3*3)
181 if (ldim.eq.3)
call dgll(dzmc,dztmc,zgmc,3,3)
183 call igllm (ixmc3,ixtmc3,zgmf,zgmc,nx1,3,nx1,3)
184 call igllm (ixmf3,ixtmf3,zgmc,zgmf,3,nx1,3,nx1)
196 real ixtmc3(lx1,3),ixmc3(3,lx1)
197 real ixtmf3(3,lx1),ixmf3(lx1,3)
198 common /coarseints/ ixmc3,ixtmc3,ixmf3,ixtmf3
199 real u1(n1,n1),u2(n2,n2)
202 if (lx1.gt.20)
write(6,*)
'SMOOTHER-increase size of work array
203 $ in int_fine_to_coarse and related routines '
204 if (lx1.gt.20)
call exitt
206 call mxm(ixmc3,n2,u1,n1,w,n1)
207 call mxm(w,n2,ixtmc3,n1,u2,n2)
216 real ixtmc3(lx1,3),ixmc3(3,lx1)
217 real ixtmf3(3,lx1),ixmf3(lx1,3)
218 common /coarseints/ ixmc3,ixtmc3,ixmf3,ixtmf3
219 real u1(n1,n1,n1),u2(n2,n2,n2)
223 if (lx1.gt.20)
write(6,*)
'SMOOTHER-increase size of work array
224 $ in int_fine_to_coarse and related routines '
225 if (lx1.gt.20)
call exitt
231 call mxm(ixmc3,n2,u1,n1,v ,mm)
235 call mxm(v(iv),n2,ixtmc3,n1,w(iw),n2)
239 call mxm(w,nn,ixtmc3,n1,u2,n2)
249 real ixtmc3(lx1,3),ixmc3(3,lx1)
250 real ixtmf3(3,lx1),ixmf3(lx1,3)
251 common /coarseints/ ixmc3,ixtmc3,ixmf3,ixtmf3
253 real zgmf(lx1),wxmf(lx1)
254 common /coarswz/ zgmc,wxmc,zgmf,wxmf
255 real u1(n1,n1),u2(n2,n2)
258 if (lx1.gt.20)
write(6,*)
'SMOOTHER-increase size of work array
259 $ in int_coarse_to_fine and related routines '
260 if (lx1.gt.20)
call exitt
262 call mxm(ixmf3,n1,u2,n2,w,n2)
263 call mxm(w,n1,ixtmf3,n2,u1,n1)
272 real ixtmc3(lx1,3),ixmc3(3,lx1)
273 real ixtmf3(3,lx1),ixmf3(lx1,3)
274 common /coarseints/ ixmc3,ixtmc3,ixmf3,ixtmf3
275 real u1(n1,n1,n1),u2(n2,n2,n2)
279 if (lx1.gt.20)
write(6,*)
'SMOOTHER-increase size of work array
280 $ in int_coarse_to_fine and related routines '
281 if (lx1.gt.20)
call exitt
287 call mxm(ixmf3,n1,u2,n2,v ,mm)
291 call mxm(v(iv),n1,ixtmf3,n2,w(iw),n1)
295 call mxm(w,nn,ixtmf3,n2,u1,n1)
304 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
305 real xmc(lxc,lyc,lzc,lelv),ymc(lxc,lyc,lzc,lelv),
306 $ zmc(lxc,lyc,lzc,lelv)
307 common /coarsemesh/ xmc,ymc,zmc
309 parameter(lt = lxc*lyc*lzc*lelv)
310 real dx(lt),dy(lt),dz(lt),xbp(lt),ybp(lt),zbp(lt)
311 common / msmbackup / dx,dy,dz,xbp,ybp,zbp
313 call copy(xbp,xmc,lxc*lyc*lzc*nelt)
314 call copy(ybp,ymc,lxc*lyc*lzc*nelt)
315 if (ldim.eq.3)
call copy(zbp,zmc,lxc*lyc*lzc*nelt)
323 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
324 real xmc(lxc,lyc,lzc,lelv),ymc(lxc,lyc,lzc,lelv),
325 $ zmc(lxc,lyc,lzc,lelv)
326 common /coarsemesh/ xmc,ymc,zmc
328 real x8(2,2,ldim-1,lelv*(2**ldim)),y8(2,2,ldim-1,lelv*(2**ldim))
329 real z8(2,2,ldim-1,lelv*(2**ldim))
330 common /coarsemesh8/ x8,y8,z8
332 parameter(lt = lxc*lyc*lzc*lelv)
333 real dx(lt),dy(lt),dz(lt),xbp(lt),ybp(lt),zbp(lt)
334 common / msmbackup / dx,dy,dz,xbp,ybp,zbp
336 call copy(xmc,xbp,lxc*lyc*lzc*nelt)
337 call copy(ymc,ybp,lxc*lyc*lzc*nelt)
338 if (ldim.eq.3)
call copy(zmc,zbp,lxc*lyc*lzc*nelt)
341 if (ldim.eq.3)
call xmtox8(zmc,z8)
346 subroutine optcg(itmax,nodmask,mlt,gshl,dis,opt,optinv,mltc,gshlc)
350 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
351 parameter(nxyzc=lxc*lyc*lzc,nxyz=lx1*ly1*lz1)
353 real xmc(lxc,lyc,lzc,lelv),
354 $ ymc(lxc,lyc,lzc,lelv),
355 $ zmc(lxc,lyc,lzc,lelv),
356 $ mltc(lxc,lyc,lzc,lelv)
357 common /coarsemesh/ xmc,ymc,zmc
359 real x8(2**ldim,lelv*(2**ldim)),
360 $ y8(2**ldim,lelv*(2**ldim)),
361 $ z8(2**ldim,lelv*(2**ldim)),
362 $ nodmask(2**ldim,lelv*(2**ldim)),
363 $ dis(2**ldim,lelv*(2**ldim)),
364 $ mlt(2**ldim,lelv*(2**ldim)),
365 $ dx(2**ldim,lelv*(2**ldim)),
366 $ dy(2**ldim,lelv*(2**ldim)),
367 $ dz(2**ldim,lelv*(2**ldim)),
368 $ dfdx(2**ldim,lelv*(2**ldim),ldim),
369 $ dfdxn(2**ldim,lelv*(2**ldim),ldim),
370 $ sk(2**ldim,lelv*(2**ldim),ldim)
371 common /coarsemesh8/ x8,y8,z8
373 integer iter,gshl,siz,eg,opt,optinv,kerr,gshlc
374 real f2,lambda,num,den,scale2
375 real alpha,bk,num1,den1,wrk1
376 real hval(2**ldim,lelv*(2**ldim))
380 if (nid.eq.0.and.loglevel.ge.2)
381 $
write(6,*)
'Optimization loop started'
383 if (opt.eq.1) siz = 2**ldim
384 if (opt.eq.2) siz = 4+8*(ldim-2)
386 n2 = nelv*(2**ldim)*n1
392 call gradf(f2,dfdx,x8,y8,z8,mlt,gshl,siz,opt,hval)
394 call copy(sk(1,1,i),dfdx(1,1,i),n2)
395 call cmult(sk(1,1,i),-1.,n2)
401 $
dolsalpha(x8,y8,z8,sk,alpha,siz,opt,mlt,gshl,nodmask,iter)
403 if (alpha.eq.0)
goto 5002
405 call col4(dx,sk(1,1,1),nodmask,dis,n2)
406 call col4(dy,sk(1,1,2),nodmask,dis,n2)
407 if (ldim.eq.3)
call col4(dz,sk(1,1,ldim),nodmask,dis,n2)
409 call add2s2(x8,dx,alpha,n2)
410 call add2s2(y8,dy,alpha,n2)
411 if (ldim.eq.3)
call add2s2(z8,dz,alpha,n2)
414 call gradf(f2,dfdxn,x8,y8,z8,mlt,gshl,siz,opt,hval)
420 do j=1,nelv*(2**ldim)
422 num1 = dfdxn(i,j,k)*mlt(i,j)*dfdxn(i,j,k) + num1
423 den1 = dfdx(i,j,k)*mlt(i,j)*dfdx(i,j,k) + den1
427 call gop(num1,wrk1,
'+ ',1)
428 call gop(den1,wrk1,
'+ ',1)
432 do j=1,nelv*(2**ldim)
434 sk(i,j,k) = -dfdxn(i,j,k) + bk*sk(i,j,k)
435 dfdx(i,j,k) = dfdxn(i,j,k)
440 if (mod(iter,5).eq.0.or.iter.eq.itmax)
then
443 if (ldim.eq.3)
call x8toxm(zmc,z8)
447 if (ldim.eq.3)
call xmtox8(zmc,z8)
456 if (ldim.eq.3)
call x8toxm(zmc,z8)
460 if (ldim.eq.3)
call xmtox8(zmc,z8)
466 if (nid.eq.0)
write(6,*)
'Terminating optimizer'
475 $
dolsalpha(xe,ye,ze,sk,alpha,siz,opt,mlt,gshl,nodmask,iter)
478 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
479 real xmc(lxc,lyc,lzc,lelv),
480 $ ymc(lxc,lyc,lzc,lelv),
481 $ zmc(lxc,lyc,lzc,lelv)
482 common /coarsemesh/ xmc,ymc,zmc
483 real xe(2**ldim,lelv*(2**ldim)),
484 $ ye(2**ldim,lelv*(2**ldim)),
485 $ ze(2**ldim,lelv*(2**ldim)),
486 $ dx(2**ldim,lelv*(2**ldim)),
487 $ dy(2**ldim,lelv*(2**ldim)),
488 $ dz(2**ldim,lelv*(2**ldim)),
489 $ xs(2**ldim,lelv*(2**ldim)),
490 $ ys(2**ldim,lelv*(2**ldim)),
491 $ zs(2**ldim,lelv*(2**ldim)),
492 $ nodmask(2**ldim,lelv*(2**ldim)),
493 $ mlt(2**ldim,lelv*(2**ldim)),
494 $ sk((2**ldim),lelv*(2**ldim),ldim),
495 $ jac(2**ldim,lelv*(2**ldim))
496 real alpha,wrk1,f1,f2
497 integer siz,opt,z,gshl,invflag
498 integer n1,n2,chk1,chk2,tstop,maxcount,iter
500 common /lsinfo / lssteps
509 if (icalld.eq.0)
then
510 call rzero(lssteps,5)
518 dumsum =
vlsum(lssteps,5)
527 n2 = nelv*(2**ldim)*n1
529 call copy(xs(1,1),xe(1,1),n2)
530 call copy(ys(1,1),ye(1,1),n2)
531 if (ldim.eq.3)
call copy(zs(1,1),ze(1,1),n2)
535 do while (tstop.eq.0.and.z.le.maxcount)
537 call col3c(dx,sk(1,1,1),nodmask,alpha,n2)
538 call col3c(dy,sk(1,1,2),nodmask,alpha,n2)
539 if (ldim.eq.3)
call col3c(dz,sk(1,1,ldim),nodmask,alpha,n2)
541 call add3(xs,xe,dx,n2)
542 call add3(ys,ye,dy,n2)
543 if (ldim.eq.3)
call add3(zs,ze,dz,n2)
550 call gop(chk1,wrk1,
'm ',1)
556 if (ldim.eq.3)
call x8toxm(zmc,zs)
558 if (invflag.eq.0) chk2 = 1
560 call gop(chk2,wrk1,
'm ',1)
562 if (chk1.eq.1.and.chk2.eq.1.)
then
574 lssteps(idx) = alphasav
576 lssteps(1) = lssteps(2)
577 lssteps(2) = lssteps(3)
578 lssteps(3) = lssteps(4)
579 lssteps(4) = lssteps(5)
580 lssteps(5) = alphasav
585 if (nid.eq.0.and.loglevel.ge.3)
write(6,101) iter,f2
586 101
format(i5,
' glob_phi ',1p1e13.6)
590 if (nid.eq.0.and.loglevel.ge.4)
591 $
write(6,*)
'SMOOTHER-line-search alpha set to 0'
600 real xe(2**ldim,lelv*(2**ldim))
601 real ye(2**ldim,lelv*(2**ldim))
602 real ze(2**ldim,lelv*(2**ldim))
603 real mlt(2**ldim,lelv*(2**ldim))
604 integer gshl,siz,e,opt
608 do e=1,nelv*(2**ldim)
610 $
call get_jac(f1,xe(1,e),ye(1,e),ze(1,e),siz,e,1)
611 if (opt.eq.2)
call get_len(f1,xe(1,e),ye(1,e),ze(1,e),siz)
614 call gop(fl,wrk1,
'+ ',1)
619 subroutine disfun(dis,funtype,alpha,beta,dcbc,nbc)
622 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
623 real dd1(lx1*ly1*lz1*lelv),
624 $ dd2(lx1*ly1*lz1*lelv),
625 $ ddd(lx1*ly1*lz1*lelv),
626 $ ddc(lxc*lyc*lzc,lelv),
627 $ dis((2**ldim)*lelv*(2**ldim))
628 integer i,nbc,j,funtype
629 character*3 dcbc(nbc)
630 real dscale,dmax,alpha,beta,dum2
632 if (nid.eq.0.and.loglevel.ge.5)
633 $
write(6,*)
'calculate distance function'
635 call rone (dd1,lx1*ly1*lz1*nelv)
640 call rone (dd2,lx1*ly1*lz1*nelv)
642 do j=1,lx1*ly1*lz1*nelv
643 dd1(j) = min(dd1(j),dd2(j))
648 dmax =
glamax(dd1,lx1*ly1*lz1*nelv)
650 call cmult(dd1,dscale,lx1*ly1*lz1*nelv)
665 if (funtype.eq.0)
then
666 do i=1,(2**ldim)*nelv*(2**ldim)
667 dis(i) = (1-exp(-dis(i)/beta))
669 elseif (funtype.eq.1)
then
670 do i=1,(2**ldim)*nelv*(2**ldim)
671 dis(i) = 0.5*(tanh(alpha*(dis(i)-beta))+1)
674 call exitti(
'Please set the funtype to 0 or 1$',funtype)
677 if (nid.eq.0.and.loglevel.ge.5)
678 $
write(6,
'(1p1e13.4,A)') dmax,
'max disfun'
687 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
688 real xmc(lxc,lyc,lzc,lelv),
689 $ ymc(lxc,lyc,lzc,lelv),
690 $ zmc(lxc,lyc,lzc,lelv)
691 common /coarsemesh/ xmc,ymc,zmc
693 real dx(lxc*lyc*lzc,lelv),
694 $ dy(lxc*lyc*lzc,lelv),
695 $ dz(lxc*lyc*lzc,lelv),
696 $ dis((2**ldim)*lelv*(2**ldim)),
697 $ dis2(lxc,lyc,lzc,lelv),
698 $ mltc(lxc,lyc,lzc,lelv)
703 dum2 =
glamax(dis2,lxc*lyc*lzc*nelv)
705 call cmult(dis2,dum2,lxc*lyc*lzc*nelv)
707 call col2(xmc,dis2,lxc*lyc*lzc*nelv)
708 call col2(ymc,dis2,lxc*lyc*lzc*nelv)
709 if (ndim.eq.3)
call col2(zmc,dis2,lxc*lyc*lzc*nelv)
711 call add2(xmc,dx,lxc*lyc*lzc*nelv)
712 call add2(ymc,dy,lxc*lyc*lzc*nelv)
713 if (ndim.eq.3)
call add2(zmc,dz,lxc*lyc*lzc*nelv)
715 call col2(dx,dis2,lxc*lyc*lzc*nelv)
716 call col2(dy,dis2,lxc*lyc*lzc*nelv)
717 if (ndim.eq.3)
call col2(dz,dis2,lxc*lyc*lzc*nelv)
719 call sub2(xmc,dx,lxc*lyc*lzc*nelv)
720 call sub2(ymc,dy,lxc*lyc*lzc*nelv)
721 if (ndim.eq.3)
call sub2(zmc,dz,lxc*lyc*lzc*nelv)
723 call sub2(dx,xmc,lxc*lyc*lzc*nelv)
724 call sub2(dy,ymc,lxc*lyc*lzc*nelv)
725 if (ndim.eq.3)
call sub2(dz,zmc,lxc*lyc*lzc*nelv)
736 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
737 real nodmask(2**ldim,lelv*(2**ldim))
738 real d(lx1*ly1*lz1,lelv)
739 real vcmask(lxc,lyc,lzc,lelv)
740 integer e,f,i,j,nlayers,valm,c
744 data tcbc /
'W ',
'v ',
'V ',
'mv ',
'MV ' /
746 call x8toxm(v1mask,nodmask)
748 call rone(d,nx1*ny1*nz1*nelv)
752 if(cbc(f,e,1).eq.tcbc(c))
call facev(d,e,f,zero,nx1,ny1,nz1)
756 call dsop(d,
'mul',nx1,ny1,nz1)
759 call dsop(d,
'mul',nx1,ny1,nz1)
761 val =
glamin(d(1,e),lx1**ldim)
762 call cmult(d(1,e),val,lx1**ldim)
766 call dsop(d,
'mul',nx1,ny1,nz1)
767 call col2(v1mask,d,lx1*ly1*lz1*nelv)
771 call xmtox8(vcmask,nodmask)
780 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
781 real xmc(lxc,lyc,lzc,lelv),
782 $ ymc(lxc,lyc,lzc,lelv),
783 $ zmc(lxc,lyc,lzc,lelv)
784 common /coarsemesh/ xmc,ymc,zmc
787 real w1(lxc*lyc*lzc*lelv),w2(lxc*lyc*lzc*lelv)
788 real vcmask(lxc,lyc,lzc,lelv)
789 integer f,e,nedge,n,nfaces,gshlc
792 real xd(lxc*lyc*lzc),
795 $ mltc(lxc*lyc*lzc*lelv)
799 data ke / 1, 2, 3, 3, 6, 9, 9, 8, 7, 7, 4, 1
800 $ , 19,20,21, 21,24,27, 27,26,25, 25,22,19
801 $ , 1,10,19, 3,12,21, 9,18,27, 7,16,25 /
805 nedge = 4 + 8*(ldim-2)
812 if (cbc(f,e,1).ne.
'E '.and.cbc(f,e,1).ne.
' ')
813 $
call facev (vcmask,e,f,0.0,lxc,lyc,lzc)
816 call fgslib_gs_op(gshlc,vcmask,1,2,0)
822 xyz(1,i) = xmc(ke(i,j),1,1,e)
823 xyz(2,i) = ymc(ke(i,j),1,1,e)
824 if (ldim.eq.3) xyz(3,i) = zmc(ke(i,j),1,1,e)
827 if (vcmask(ke(2,j),1,1,e).gt.0.5)
then
829 xmc(ke(2,j),1,1,e) = nxv
830 ymc(ke(2,j),1,1,e) = nyv
831 if (ldim.eq.3) zmc(ke(2,j),1,1,e) = nzv
839 call copy(xd,xmc(1,1,1,e),lxc*lyc*lzc)
840 call copy(yd,ymc(1,1,1,e),lxc*lyc*lzc)
841 if (ldim.eq.3)
call copy(zd,zmc(1,1,1,e),lxc*lyc*lzc)
853 xmc(kin(i),1,1,e) = xd(kin(i))
854 ymc(kin(i),1,1,e) = yd(kin(i))
855 if (ldim.eq.3) zmc(kin(i),1,1,e) = zd(kin(i))
864 real x0(3),x1(3),x2(3),v2(3),v1(3),l02,l01,n1i,u1(3),u2(3)
868 call copy(x0,xyz(1,0),3)
869 call copy(x1,xyz(1,1),3)
870 call copy(x2,xyz(1,2),3)
872 call sub3(v1,x1,x0,3)
873 call sub3(v2,x2,x0,3)
892 write(6,*)
'SMOOTHER-ERROR 1 IN SHIFT - YOU SHOULD ABORT'
894 elseif (
dot.gt.l02)
then
895 write(6,*)
'SMOOTHER-ERROR 2 IN SHIFT - YOU SHOULD ABORT'
902 p1i = x0(i) + u2(i)*
dot
905 h2 = h2+ (x2(i)-x0(i))**2
906 xmi = 0.5*(x0(i)+x2(i))
909 if (h.le.h2*tol)
then
910 x1(1) = 0.5*(x0(1)+x2(1))
911 x1(2) = 0.5*(x0(2)+x2(2))
912 x1(3) = 0.5*(x0(3)+x2(3))
923 subroutine gradf(f2,dfdx,x8,y8,z8,mlt,gshl,siz,opt,h)
926 real x8(2**ldim,lelv*(2**ldim)),
927 $ y8(2**ldim,lelv*(2**ldim)),
928 $ z8(2**ldim,lelv*(2**ldim)),
929 $ mlt(2**ldim,lelv*(2**ldim)),
930 $ dfdx(2**ldim,lelv*(2**ldim),ldim)
934 integer siz,opt,vertex,gshl,e,eg,e0,f
936 real f1,fl,gl,f2,h(2**ldim,lelv*(2**ldim))
939 do e=1,nelv*(2**ldim)
941 $
call get_jac(fl,x8(1,e),y8(1,e),z8(1,e),siz,e,0)
942 if (opt.eq.2)
call get_len(fl,x8(1,e),y8(1,e),z8(1,e),siz)
944 call copy(xt,x8(1,e),2**ldim)
945 call copy(yt,y8(1,e),2**ldim)
946 call copy(zt,z8(1,e),2**ldim)
948 xt(j) = x8(j,e)+h(j,e)
949 if (opt.eq.1)
call get_jac(gl,xt,yt,zt,siz,e,1)
950 if (opt.eq.2)
call get_len(gl,xt,yt,zt,siz)
951 xt(j) = x8(j,e)-h(j,e)
952 if (opt.eq.1)
call get_jac(fl,xt,yt,zt,siz,e,1)
953 if (opt.eq.2)
call get_len(fl,xt,yt,zt,siz)
955 dfdx(j,e,1) = (gl-fl)/(2.*h(j,e))
957 yt(j) = y8(j,e)+h(j,e)
958 if (opt.eq.1)
call get_jac(gl,xt,yt,zt,siz,e,2)
959 if (opt.eq.2)
call get_len(gl,xt,yt,zt,siz)
960 yt(j) = y8(j,e)-h(j,e)
961 if (opt.eq.1)
call get_jac(fl,xt,yt,zt,siz,e,2)
962 if (opt.eq.2)
call get_len(fl,xt,yt,zt,siz)
964 dfdx(j,e,2) = (gl-fl)/(2.*h(j,e))
967 zt(j) = z8(j,e)+h(j,e)
968 if (opt.eq.1)
call get_jac(gl,xt,yt,zt,siz,e,3)
969 if (opt.eq.2)
call get_len(gl,xt,yt,zt,siz)
970 zt(j) = z8(j,e)-h(j,e)
971 if (opt.eq.1)
call get_jac(fl,xt,yt,zt,siz,e,3)
972 if (opt.eq.2)
call get_len(fl,xt,yt,zt,siz)
974 dfdx(j,e,ldim) = (gl-fl)/(2.*h(j,e))
979 call fgslib_gs_op(gshl,dfdx(1,1,1),1,1,0)
980 call fgslib_gs_op(gshl,dfdx(1,1,2),1,1,0)
981 if (ldim.eq.3)
call fgslib_gs_op(gshl,dfdx(1,1,ldim),1,1,0)
993 integer i,j,k,siz,el,dire
995 real par(siz),det(siz)
996 real jm(ldim,ldim),jin(ldim,ldim),frn(ldim**2)
997 real x(2**ldim),y(2**ldim),z(2**ldim),jac(2**ldim)
998 real fr1,fr2,sum1,dumc,val
1000 integer bzindx(24),czindx(24)
1003 DATA bzindx / 2,3,5, 1,4,6, 4,1,7, 3,2,8,
1004 $ 6,7,1, 5,8,2, 8,5,3, 7,6,4 /
1008 DATA czindx / 1,1,1, -1,1,1, 1,-1,1, -1,-1,1,
1009 $ 1,1,-1, -1,1,-1, 1,-1,-1, -1,-1,-1 /
1012 if (siz.ne.2**ldim)
then
1013 write(6,*)
'siz value wrong input into get_jac'
1014 write(6,*) siz,
'sizval',2**ldim,
'should be this'
1022 jm(1,j) = 0.5*czindx(ind2)*(x(bzindx(ind2))-x(i))
1023 jm(2,j) = 0.5*czindx(ind2)*(y(bzindx(ind2))-y(i))
1025 $ jm(ldim,j) = 0.5*czindx(ind2)*(z(bzindx(ind2))-z(i))
1030 jac(i)=jm(1,1)*(jm(2,2)*jm(ldim,ldim)-jm(2,ldim)*jm(ldim,2))+
1031 $ jm(1,ldim)*(jm(2,1)*jm(ldim,2)-jm(2,2)*jm(ldim,1)) +
1032 $ jm(1,2)*(jm(2,ldim)*jm(ldim,1)-jm(2,1)*jm(ldim,ldim))
1034 jac(i)=jm(1,1)*jm(2,2)-jm(2,1)*jm(1,2)
1038 jin(1,1) = jm(2,2)*jm(ldim,ldim)-jm(ldim,2)*jm(2,ldim)
1039 jin(2,1) = jm(2,ldim)*jm(ldim,1)-jm(ldim,ldim)*jm(2,1)
1040 jin(ldim,1) = jm(2,1)*jm(ldim,2)-jm(ldim,1)*jm(2,2)
1042 jin(1,2) = jm(1,ldim)*jm(ldim,2)-jm(ldim,ldim)*jm(1,2)
1043 jin(2,2) = jm(1,1)*jm(ldim,ldim)-jm(ldim,1)*jm(1,ldim)
1044 jin(ldim,2) = jm(1,2)*jm(ldim,1)-jm(ldim,2)*jm(1,1)
1046 jin(1,ldim) = jm(1,2)*jm(2,ldim)-jm(2,2)*jm(1,ldim)
1047 jin(2,ldim) = jm(1,ldim)*jm(2,1)-jm(2,ldim)*jm(1,1)
1048 jin(ldim,ldim) = jm(1,1)*jm(2,2)-jm(2,1)*jm(1,2)
1058 call cmult(jin,dumc,ldim**2)
1060 call rzero(frn,ldim**2)
1061 call col3(frn,jm,jm,ldim**2)
1062 sum1 =
vlsum(frn,ldim**2)
1065 call rzero(frn,ldim**2)
1066 call col3(frn,jin,jin,ldim**2)
1067 sum1 =
vlsum(frn,ldim**2)
1071 par(i) = (par(i)/ldim)**2
1075 val =
vlsum(par,siz)
1086 real x(2**ldim),y(2**ldim),z(2**ldim)
1087 real par(siz),xm,ym,zm,val
1091 DATA azindx / 1,2 ,2,4, 3,4, 1,3, 2,6, 6,8,
1092 $ 4,8, 5,6, 7,8, 5,7, 1,5, 3,7 /
1097 xm = x(azindx(ind+1))-x(azindx(ind+2))
1098 ym = y(azindx(ind+1))-y(azindx(ind+2))
1099 zm = z(azindx(ind+1))-z(azindx(ind+2))
1100 par(i) = sqrt(xm*xm+ym*ym+zm*zm)
1104 val =
vlsum(par,siz)
1112 real x8(2**ldim,lelv*(2**ldim)),
1113 $ y8(2**ldim,lelv*(2**ldim)),
1114 $ z8(2**ldim,lelv*(2**ldim))
1115 real curval,xm,ym,zm,work1(1),dum,wrk1
1117 real scalek(2**ldim,lelv*(2**ldim))
1118 integer bzindx(24),e,gshl
1119 DATA bzindx / 2,3,5, 1,4,6, 4,1,7, 3,2,8,
1120 $ 6,7,1, 5,8,2, 8,5,3, 7,6,4 /
1126 call rone(scalek,n2)
1127 call cmult(scalek,curval,n2)
1129 do e=1,nelv*(2**ldim)
1134 xm = x8(i,e)-x8(bzindx(ind+j),e)
1135 ym = y8(i,e)-y8(bzindx(ind+j),e)
1137 if (ldim.eq.3) zm = z8(i,e)-z8(bzindx(ind+j),e)
1138 dum = sqrt(xm*xm+ym*ym+zm*zm)
1139 curval = min(dum,curval)
1141 scalek(i,e) = curval
1146 call cmult(scalek,fac,n2)
1147 call fgslib_gs_op(gshl,scalek,1,3,0)
1155 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1158 common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
1159 common /ivrtx/ vertex
1160 integer*8 glo_num(lxc*lyc*lzc,lelv),ngv
1161 integer*8 glo_numk2(2**ldim,lelv*(2**ldim))
1163 real mlt(2**ldim,lelv*(2**ldim)),
1164 $ nodmask(2**ldim,lelv*(2**ldim))
1165 real mltc(lxc*lyc*lzc*lelv),
1166 $ wrkmask(lxc*lyc*lzc*lelv)
1167 integer gshlc,gshl,e,eg,e0,f
1171 DATA zindx / 1, 2, 4, 5, 10, 11, 13, 14,
1172 $ 2, 3, 5, 6, 11, 12, 14, 15,
1173 $ 4, 5, 7, 8, 13, 14, 16, 17,
1174 $ 5, 6, 8, 9, 14, 15, 17, 18,
1175 $ 10, 11, 13, 14, 19, 20, 22, 23,
1176 $ 11, 12, 14, 15, 20, 21, 23, 24,
1177 $ 13, 14, 16, 17, 22, 23, 25, 26,
1178 $ 14, 15, 17, 18, 23, 24, 26, 27 /
1182 $ nelgv,vertex,glo_num)
1186 call rone(wrkmask,lxc*lyc*lzc*nelv)
1189 if(cbc(f,e,1).ne.
'E '.and.cbc(f,e,1).ne.
' ')
then
1190 call facev(wrkmask,e,f,zero,lxc,lyc,lzc)
1195 n = (lxc*lyc*lzc)*nelv
1197 call fgslib_gs_setup(gshlc,glo_num,n,nekcomm,np)
1198 call fgslib_gs_op(gshlc,mltc,1,1,0)
1200 call fgslib_gs_op(gshlc,wrkmask,1,2,0)
1201 call xmtox8(wrkmask,nodmask)
1209 glo_numk2(k,n) = glo_num(zindx(ind1+k),e)
1214 n = (2**ldim)*(nelv*(2**ldim))
1215 call fgslib_gs_setup(gshl,glo_numk2,n,nekcomm,np)
1217 call fgslib_gs_op(gshl,mlt,1,1,0)
1221 call fgslib_gs_op(gshl,nodmask,1,2,0)
1234 integer*8 glo_num(1),ngv
1235 common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
1238 call set_vert(glo_num,ngv,nx,nel,vertex,.true.)
1239 call fgslib_gs_setup(gs_handle,glo_num,n,nekcomm,mp)
1243 subroutine fastlap(iter,nodmask,mlt,gshl,dis,lapinv,mltc,gshlc)
1246 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1247 real xmc(lxc,lyc,lzc,lelv),
1248 $ ymc(lxc,lyc,lzc,lelv),
1249 $ zmc(lxc,lyc,lzc,lelv)
1250 common /coarsemesh/ xmc,ymc,zmc
1252 real x8(2,2,ldim-1,lelv*(2**ldim)),
1253 $ y8(2,2,ldim-1,lelv*(2**ldim)),
1254 $ z8(2,2,ldim-1,lelv*(2**ldim))
1255 common /coarsemesh8/ x8,y8,z8
1257 real dxx(2**ldim,lelv*(2**ldim)),
1258 $ dyy(2**ldim,lelv*(2**ldim)),
1259 $ dzz(2**ldim,lelv*(2**ldim)),
1260 $ dis(2**ldim,lelv*(2**ldim)),
1261 $ mlt(2**ldim,lelv*(2**ldim)),
1262 $ nodmask(2**ldim,lelv*(2**ldim)),
1263 $ mltc(lxc*lyc*lzc,lelv)
1264 integer z,e,f,gshl,lapinv,kerr,gshlc
1265 real xbar,ybar,zbar,sfac
1267 if (nid.eq.0.and.loglevel.ge.2)
1268 $
write(6,*)
'laplacian smoothing started'
1273 do e=1,nelv*(2**ldim)
1274 xbar =
vlsum(x8(1,1,1,e),n)/(n)
1275 ybar =
vlsum(y8(1,1,1,e),n)/(n)
1276 if (ldim.eq.3) zbar =
vlsum(z8(1,1,1,e),n)/(n)
1278 dxx(i,e) = sfac*(xbar-x8(i,1,1,e))
1279 dyy(i,e) = sfac*(ybar-y8(i,1,1,e))
1280 if (ldim.eq.3) dzz(i,e) = sfac*(zbar-z8(i,1,1,e))
1284 n2 = nelv*(2**ldim)*(n)
1286 call col2(dxx,nodmask,n2)
1287 call col2(dxx,dis,n2)
1289 call add2(x8,dxx,n2)
1291 call col2(dyy,nodmask,n2)
1292 call col2(dyy,dis,n2)
1294 call add2(y8,dyy,n2)
1297 call col2(dzz,nodmask,n2)
1298 call col2(dzz,dis,n2)
1300 call add2(z8,dzz,n2)
1310 if (nio.eq.0.and.loglevel.ge.3)
write(6,1) k,dxm,dym,dzm
1311 1
format(i5,1p3e12.3,
' dxm')
1317 if (ldim.eq.3)
call x8toxm(zmc,z8)
1321 if (ldim.eq.3)
call xmtox8(zmc,z8)
1324 if (kerr.gt.0.)
then
1326 if (nid.eq.0.and.loglevel.ge.2)
write(6,*)
'terminating Laplacian'
1338 real u(2**ldim,lelv*(2**ldim))
1339 real mlt(2**ldim,lelv*(2**ldim))
1341 call fgslib_gs_op(gshl,u,1,1,0)
1342 call col2(u,mlt,(2**ldim)*nelv*(2**ldim))
1350 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1351 real x8(2**ldim,lelv*(2**ldim))
1352 real xd(lxc*lyc*lzc,lelv)
1353 integer e,k,n,j,ind1
1356 DATA zindx / 1, 2, 4, 5, 10, 11, 13, 14,
1357 $ 2, 3, 5, 6, 11, 12, 14, 15,
1358 $ 4, 5, 7, 8, 13, 14, 16, 17,
1359 $ 5, 6, 8, 9, 14, 15, 17, 18,
1360 $ 10, 11, 13, 14, 19, 20, 22, 23,
1361 $ 11, 12, 14, 15, 20, 21, 23, 24,
1362 $ 13, 14, 16, 17, 22, 23, 25, 26,
1363 $ 14, 15, 17, 18, 23, 24, 26, 27 /
1371 x8(k,n) = xd(zindx(ind1+k),e)
1382 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1383 real x8(2**ldim,lelv*(2**ldim))
1384 real xd(lxc*lyc*lzc,lelv)
1385 integer zindx((2**3)**2)
1386 integer e,k,n,j,ind1
1387 DATA zindx / 1, 2, 4, 5, 10, 11, 13, 14,
1388 $ 2, 3, 5, 6, 11, 12, 14, 15,
1389 $ 4, 5, 7, 8, 13, 14, 16, 17,
1390 $ 5, 6, 8, 9, 14, 15, 17, 18,
1391 $ 10, 11, 13, 14, 19, 20, 22, 23,
1392 $ 11, 12, 14, 15, 20, 21, 23, 24,
1393 $ 13, 14, 16, 17, 22, 23, 25, 26,
1394 $ 14, 15, 17, 18, 23, 24, 26, 27 /
1403 xd(zindx(ind1+k),e) = x8(k,n)
1412 real a(1),b(1),c(1),d
1429 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1430 parameter(nxc=3,nyc=3,nzc=1+(ldim-2)*(nxc-1))
1431 real xmc(lxc,lyc,lzc,lelv),ymc(lxc,lyc,lzc,lelv),
1432 $ zmc(lxc,lyc,lzc,lelv)
1433 common /coarsemesh/ xmc,ymc,zmc
1435 real XRMc(LXc,LYc,LZc,LELv)
1436 $ , YRMc(LXc,LYc,LZc,LELv)
1437 $ , xsmc(lxc,lyc,lzc,lelv)
1438 $ , ysmc(lxc,lyc,lzc,lelv)
1439 $ , xtmc(lxc,lyc,lzc,lelv)
1440 $ , ytmc(lxc,lyc,lzc,lelv)
1441 $ , zrmc(lxc,lyc,lzc,lelv)
1442 real ZSMc(LXc,LYc,LZc,LELv)
1443 $ , ZTMc(LXc,LYc,LZc,LELv)
1444 $ , jacmc(lxc,lyc,lzc,lelv)
1445 real rxmc(lxc,lyc,lzc,lelv)
1446 $ , rymc(lxc,lyc,lzc,lelv)
1447 $ , rzmc(lxc,lyc,lzc,lelv)
1448 $ , sxmc(lxc,lyc,lzc,lelv)
1449 $ , symc(lxc,lyc,lzc,lelv)
1450 $ , szmc(lxc,lyc,lzc,lelv)
1451 $ , txmc(lxc,lyc,lzc,lelv)
1452 $ , tymc(lxc,lyc,lzc,lelv)
1453 $ , tzmc(lxc,lyc,lzc,lelv)
1461 CALL xyzrstc (xrmc,yrmc,zrmc,xsmc,ysmc,zsmc,xtmc,ytmc,ztmc,
1467 CALL rzero (jacmc,ntotc)
1468 CALL addcol3 (jacmc,xrmc,ysmc,ntotc)
1469 CALL subcol3 (jacmc,xsmc,yrmc,ntotc)
1470 CALL copy (rxmc,ysmc,ntotc)
1471 CALL copy (rymc,xsmc,ntotc)
1473 CALL copy (sxmc,yrmc,ntotc)
1475 CALL copy (symc,xrmc,ntotc)
1476 CALL rzero (rzmc,ntotc)
1477 CALL rzero (szmc,ntotc)
1478 CALL rone (tzmc,ntotc)
1480 CALL rzero (jacmc,ntotc)
1481 CALL addcol4 (jacmc,xrmc,ysmc,ztmc,ntotc)
1482 CALL addcol4 (jacmc,xtmc,yrmc,zsmc,ntotc)
1483 CALL addcol4 (jacmc,xsmc,ytmc,zrmc,ntotc)
1484 CALL subcol4 (jacmc,xrmc,ytmc,zsmc,ntotc)
1485 CALL subcol4 (jacmc,xsmc,yrmc,ztmc,ntotc)
1486 CALL subcol4 (jacmc,xtmc,ysmc,zrmc,ntotc)
1487 CALL ascol5 (rxmc,ysmc,ztmc,ytmc,zsmc,ntotc)
1488 CALL ascol5 (rymc,xtmc,zsmc,xsmc,ztmc,ntotc)
1489 CALL ascol5 (rzmc,xsmc,ytmc,xtmc,ysmc,ntotc)
1490 CALL ascol5 (sxmc,ytmc,zrmc,yrmc,ztmc,ntotc)
1491 CALL ascol5 (symc,xrmc,ztmc,xtmc,zrmc,ntotc)
1492 CALL ascol5 (szmc,xtmc,yrmc,xrmc,ytmc,ntotc)
1493 CALL ascol5 (txmc,yrmc,zsmc,ysmc,zrmc,ntotc)
1494 CALL ascol5 (tymc,xsmc,zrmc,xrmc,zsmc,ntotc)
1495 CALL ascol5 (tzmc,xrmc,ysmc,xsmc,yrmc,ntotc)
1500 CALL chkjacinv(jacmc(1,1,1,ie),nxyzc,ie,xmc(1,1,1,ie),
1501 $ ymc(1,1,1,ie),zmc(1,1,1,ie),ndim,ierr)
1502 if (ierr.ne.0) kerr = kerr+1
1516 REAL JAC(N),x(1),y(1),z(1)
1522 IF (sign*jac(i).LE.0.0)
THEN
1531 $ XTMc,YTMc,ZTMc,IFAXIS)
1539 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1540 dimension xrmc(lxc,lyc,lzc,1),yrmc(lxc,lyc,lzc,1)
1541 $ , zrmc(lxc,lyc,lzc,1),xsmc(lxc,lyc,lzc,1)
1542 $ , ysmc(lxc,lyc,lzc,1),zsmc(lxc,lyc,lzc,1)
1543 $ , xtmc(lxc,lyc,lzc,1),ytmc(lxc,lyc,lzc,1)
1544 $ , ztmc(lxc,lyc,lzc,1)
1546 real dxmc(3,3),dymc(3,3),dzmc(3,3)
1547 real dxtmc(3,3),dytmc(3,3),dztmc(3,3)
1548 common /coarseders/ dxmc,dymc,dzmc,dxtmc,dytmc,dztmc
1549 real xmc(lxc,lyc,lzc,lelv),ymc(lxc,lyc,lzc,lelv),
1550 $ zmc(lxc,lyc,lzc,lelv)
1551 common /coarsemesh/ xmc,ymc,zmc
1558 CALL mxm (dxmc,lxc,xmc(1,1,1,iel),lxc,xrmc(1,1,1,iel),nyzc)
1559 CALL mxm (dxmc,lxc,ymc(1,1,1,iel),lxc,yrmc(1,1,1,iel),nyzc)
1560 CALL mxm (dxmc,lxc,zmc(1,1,1,iel),lxc,zrmc(1,1,1,iel),nyzc)
1563 CALL mxm (xmc(1,1,iz,iel),lxc,dytmc,lyc,xsmc(1,1,iz,iel),lyc)
1564 CALL mxm (ymc(1,1,iz,iel),lxc,dytmc,lyc,ysmc(1,1,iz,iel),lyc)
1565 CALL mxm (zmc(1,1,iz,iel),lxc,dytmc,lyc,zsmc(1,1,iz,iel),lyc)
1569 CALL mxm (xmc(1,1,1,iel),nxyc,dztmc,lzc,xtmc(1,1,1,iel),lzc)
1570 CALL mxm (ymc(1,1,1,iel),nxyc,dztmc,lzc,ytmc(1,1,1,iel),lzc)
1571 CALL mxm (zmc(1,1,1,iel),nxyc,dztmc,lzc,ztmc(1,1,1,iel),lzc)
1573 CALL rzero (xtmc(1,1,1,iel),nxyc)
1574 CALL rzero (ytmc(1,1,1,iel),nxyc)
1575 CALL rone (ztmc(1,1,1,iel),nxyc)
1586 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1587 real xmc(lxc,lyc,lzc,lelv),ymc(lxc,lyc,lzc,lelv),
1588 $ zmc(lxc,lyc,lzc,lelv)
1589 common /coarsemesh/ xmc,ymc,zmc
1611 parameter(lxc=3,lyc=3,lzc=1+(ldim-2)*(lxc-1))
1612 real xmc(lxc,lyc,lzc,lelv),ymc(lxc,lyc,lzc,lelv),
1613 $ zmc(lxc,lyc,lzc,lelv)
1614 common /coarsemesh/ xmc,ymc,zmc
1637 parameter(lt = lx1*ly1*lz1*lelv)
1638 common /mrthoi/ napprx(2),nappry(2),napprz(2)
1639 common /mrthov/ apprx(lt,0:mxprev)
1640 $ , appry(lt,0:mxprev)
1641 $ , apprz(lt,0:mxprev)
1642 common /mstuff/ d(lt),h1(lt),h2(lt),mask(lt)
1644 real mask2(lx1,ly1,lz1,lelv)
1645 real dx(1),dy(1),dz(1)
1653 n = nx1*ny1*nz1*nelv
1666 if (cbc(f,e,1).eq.
'W ')
then
1667 srfbl = srfbl +
vlsum(area(1,1,f,e),nxz )
1668 volbl = volbl +
vlsum(bm1(1,1,1,e),nxyz)
1672 srfbl =
glsum(srfbl,1)
1673 volbl =
glsum(volbl,1)
1675 delta = volbl / srfbl
1683 arg = -(d(i)/deltap)**2
1684 h1(i) = h1(i) + 9*exp(arg)
1690 if (cbc(f,e,1).ne.
'E '.and.cbc(f,e,1).ne.
' ')
1691 $
call facev(mask,e,f,0.,nx1,ny1,nz1)
1694 call dsop(mask,
'mul',nx1,ny1,nz1)
1695 call copy(mask2,mask,n)
1697 call cadd(mask2,1.,n)
1698 call col2(dx,mask2,n)
1699 call col2(dy,mask2,n)
1700 call col2(dz,mask2,n)
1702 call laplaceh(
'mshx',dx,h1,h2,mask,vmult,1,tol,500,apprx,napprx)
1703 call laplaceh(
'mshy',dy,h1,h2,mask,vmult,1,tol,500,appry,nappry)
1705 $
call laplaceh(
'mshz',dz,h1,h2,mask,vmult,1,tol,500,apprz,napprz)
1711 $ (name,u,h1,h2,mask,mult,ifld,tli,maxi,approx,napprox)
1717 real u(1),h1(1),h2(1),mask(1),mult(1),approx (1)
1720 parameter(lt=lx1*ly1*lz1*lelv)
1721 common /scruz/ r(lt),ub(lt)
1729 call chcopy(cname,name,4)
1730 call capit (cname,4)
1732 call blank (name6,6)
1733 call chcopy(name6,name,4)
1745 call axhelm (r,ub,h1,h2,1,1)
1751 call dssum (r,nx1,ny1,nz1)
1754 $ (r,n,approx,napprox,h1,h2,mask,mult,ifwt,ifvec,name6)
1757 if (nel.eq.nelv)
then
1758 call hmhzpf (name,u,r,h1,h2,mask,mult,imsh,tol,maxi,isd,binvm1)
1760 call hmhzpf (name,u,r,h1,h2,mask,mult,imsh,tol,maxi,isd,bintm1)
1764 $ (u,n,approx,napprox,h1,h2,mask,mult,ifwt,ifvec,name6)
1782 real d(lx1,ly1,lz1,lelt)
1793 xmn = min(xmin,ymin)
1794 xmx = max(xmax,ymax)
1795 if (if3d) xmn = min(xmn ,zmin)
1796 if (if3d) xmx = max(xmx ,zmax)
1804 if (cbc(f,e,ifld).eq.b)
call facev(d,e,f,0.,lx1,ly1,lz1)
1826 dtmp = d(ii,jj,kk,e) +
dist3d(
1827 $ xm1(ii,jj,kk,e),ym1(ii,jj,kk,e),zm1(ii,jj,kk,e)
1828 $ ,xm1(i ,j ,k ,e),ym1(i ,j ,k ,e),zm1(i ,j ,k ,e))
1830 dtmp = d(ii,jj,kk,e) +
dist2d(
1831 $ xm1(ii,jj,kk,e),ym1(ii,jj,kk,e)
1832 $ ,xm1(i ,j ,k ,e),ym1(i ,j ,k ,e))
1835 if (dtmp.lt.d(i,j,k,e))
then
1838 dmax = max(dmax,d(i,j,k,e))
1848 call fgslib_gs_op(gsh_fld(ifld),d,1,3,0)
1849 nchange =
iglsum(nchange,1)
1850 dmax =
glmax(dmax,1)
1851 if (nio.eq.0.and.loglevel.ge.3)
write(6,1) ipass,nchange,dmax,b
1852 1
format(i9,i12,1pe12.4,
' max distance b: ',a3)
1853 if (nchange.eq.0)
goto 1000
subroutine gop(x, w, op, n)
subroutine exitti(stringi, idata)
real *8 function dnekclock()
subroutine facev(a, ie, iface, val, nx, ny, nz)
subroutine dsop(u, op, nx, ny, nz)
subroutine dssum(u, nx, ny, nz)
real function dot(V1, V2, N)
subroutine axhelm(au, u, helm1, helm2, imesh, isd)
subroutine capit(lettrs, n)
subroutine geom_reset(icall)
subroutine cadd(a, const, n)
subroutine col3(a, b, c, n)
subroutine ascol5(a, b, c, d, e, n)
subroutine addcol3(a, b, c, n)
subroutine add2s2(a, b, c1, n)
subroutine addcol4(a, b, c, d, n)
real function glamin(a, 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 subcol3(a, b, c, n)
subroutine subcol4(a, b, c, d, n)
subroutine sub3(a, b, c, n)
subroutine cmult(a, const, n)
real function glamax(a, n)
subroutine chcopy(a, b, n)
subroutine cfill(a, b, n)
subroutine setupds_center(gs_handle, nx, ny, nz, nel, melg, vertex, glo_num)
subroutine chkjacinv(jac, n, iel, X, Y, Z, ND, IERR)
subroutine int_fine_to_coarse_3d(u1, u2, n1, n2)
subroutine smoothmesh(mtyp, nouter, nlap, nopt, nbc, dcbc, idftyp, alpha, beta)
subroutine int_coarse_to_fine_2d(u1, u2, n1, n2)
subroutine my_mv_mesh(dx, dy, dz)
subroutine gen_int_lx1_to_3
subroutine disfun(dis, funtype, alpha, beta, dcbc, nbc)
subroutine sm_cheap_dist(d, ifld, b)
subroutine laplaceh(name, u, h1, h2, mask, mult, ifld, tli, maxi, approx, napprox)
subroutine fixedgs(xyz, nx, ny, nz)
subroutine get_len(val, x, y, z, siz)
subroutine dsavg_general(u, mlt, gshl)
subroutine getglobsum(xe, ye, ze, mlt, gshl, siz, opt, fl)
subroutine masklayers(nodmask, nlayers)
subroutine col3c(a, b, c, d, n)
subroutine restbndrlayer(dx, dy, dz, dis, mltc, gshlc)
subroutine x8toxm(xd, x8)
subroutine int_fine_to_coarse_2d(u1, u2, n1, n2)
subroutine xyzrstc(xrmc, yrmc, zrmc, xsmc, ysmc, zsmc, XTMc, YTMc, ZTMc, IFAXIS)
subroutine optcg(itmax, nodmask, mlt, gshl, dis, opt, optinv, mltc, gshlc)
subroutine get_nodscale(scalek, x8, y8, z8, gshl)
subroutine xmtox8(xd, x8)
subroutine fastlap(iter, nodmask, mlt, gshl, dis, lapinv, mltc, gshlc)
subroutine dolsalpha(xe, ye, ze, sk, alpha, siz, opt, mlt, gshl, nodmask, iter)
subroutine genmask(nodmask, mlt, gshl, mltc, gshlc)
subroutine int_coarse_to_fine_3d(u1, u2, n1, n2)
subroutine glmapm1chkinv(kerr)
subroutine get_jac(val, x, y, z, siz, el, dire)
subroutine fixcurs(mltc, gshlc)
subroutine gradf(f2, dfdx, x8, y8, z8, mlt, gshl, siz, opt, h)
subroutine mxm(a, n1, b, n2, c, n3)
subroutine opadd2(a1, a2, a3, b1, b2, b3)
subroutine opsub3(a1, a2, a3, b1, b2, b3, c1, c2, c3)
subroutine project1(b, n, rvar, ivar, h1, h2, msk, w, ifwt, ifvec, name6)
subroutine hmhzpf(name, u, r, h1, h2, mask, mult, imesh, tli, maxit, isd, bi)
subroutine project2(x, n, rvar, ivar, h1, h2, msk, w, ifwt, ifvec, name6)
subroutine domain_size(xmin, xmax, ymin, ymax, zmin, zmax)
function dist2d(a, b, x, y)
function dist3d(a, b, c, x, y, z)
subroutine gh_face_extend(x, zg, n, gh_type, e, v)
subroutine set_vert(glo_num, ngv, nx, nel, vertex, ifcenter)
subroutine zwgll(Z, W, NP)
subroutine igllm(I12, IT12, Z1, Z2, lz1, lz2, ND1, ND2)
subroutine dgll(D, DT, Z, NZ, lzd)
subroutine cmult2(A, B, CONST, N)