12 logical ifbswap,ifre2,parfound
14 integer idum(3*numsts+3)
20 if(nid.eq.0)
inquire(
file=parfle, exist=parfound)
21 call bcast(parfound,lsize)
23 if(nio.eq.0)
write(6,
'(A,A)')
' Reading ', parfle
31 write(6,
'(A,A)')
' Reading ', reafle
32 open (unit=9,
file=reafle,status=
'old', iostat=ierr)
35 call bcast(ierr,isize)
36 if (ierr .gt. 0)
call exitti(
'Cannot open rea file!$',1)
46 read(9,*) nelgs,ldimr,nelgv
49 call bcast(ldimr,isize)
50 call bcast(nelgs,isize)
51 call bcast(nelgv,isize)
52 call bcast(nelgt,isize)
54 if (nelgs.lt.0) ifre2 = .true.
58 if (nelgt.gt.350000 .and. .not.ifre2)
59 $
call exitti(
'Problem size requires .re2!$',1)
70 mread = (np-1)/maxrd+1
75 if (mod(nid,mread).eq.iread)
then
77 open(unit=9,
file=reafle,status=
'OLD')
78 call cscan(string,
'MESH DATA',9)
84 if (nid.ne.0)
close(unit=9)
107 write(6,
'(A,g13.5,A,/)')
' done :: read .rea file ',
111 99
call izero(boundaryid,
size(boundaryid))
112 call izero(boundaryidt,
size(boundaryidt))
118 boundaryid(ifc,iel) = bc(5,ifc,iel,ifld)
124 if(iftmsh(1+i)) ntmsh = ntmsh + 1
130 boundaryidt(ifc,iel) = bc(5,ifc,iel,2)
148 COMMON /scrns/ ta(lx1,ly1,lz1,lelt),tb(lx1,ly1,lz1,lelt)
149 $ ,
qmask(lx1,ly1,lz1,lelt),tmp(2)
154 if(nio.eq.0)
write(*,*)
'verify mesh topology'
160 if (nelgv.ne.nelgt .or. .not.ifflow) ifield = 2
162 ntot = lx1*ly1*lz1*nelt
165 xmx =
glmax(xm1,ntot)
166 xmn =
glmin(xm1,ntot)
167 ymx =
glmax(ym1,ntot)
168 ymn =
glmin(ym1,ntot)
169 zmx =
glmax(zm1,ntot)
170 zmn =
glmin(zm1,ntot)
171 if (nio.eq.0)
write(6,*) xmn,xmx,
' Xrange'
172 if (nio.eq.0)
write(6,*) ymn,ymx,
' Yrange'
173 if (nio.eq.0)
write(6,*) zmn,zmx,
' Zrange'
179 CALL copy(ta,tmult,ntot)
181 CALL copy(ta,vmult,ntot)
188 CALL dssum(ta,lx1,ly1,lz1)
194 CALL sub2 (tb,ta,ntot)
200 IF (abs(tb(ix,iy,iz,ie)).GT.eps )
THEN
201 WRITE(6,1005) ix,iy,iz,ieg
202 $ ,xm1(ix,iy,iz,ie),ym1(ix,iy,iz,ie),zm1(ix,iy,iz,ie)
203 $ ,ta(ix,iy,iz,ie),eps
207 1005
FORMAT(2x,
'WARNING: DSSUM problem at:',/
208 $ ,1x,
'I,J,K,IE:',3i5,i12,/
209 $ ,2x,
'Near X =',3g16.8,
', d:',2g16.8)
218 DO 100 iface=1,nfaces
219 cb =cbc(iface,iel,ifield)
220 IF (cb.EQ.
'P '.or.cb.eq.
'p ')
239 CALL copy(ta,xm1,ntot)
240 CALL copy(tb,xm1,ntot)
241 CALL dsop(ta,
'MIN',lx1,ly1,lz1)
242 CALL dsop(tb,
'MAX',lx1,ly1,lz1)
243 CALL sub2(ta,xm1,ntot)
244 CALL sub2(tb,xm1,ntot)
248 xscmax =
vlmax(xm1(1,1,1,ie),nxyz1)
249 xscmin =
vlmin(xm1(1,1,1,ie),nxyz1)
250 scal1=abs(xscmax-xscmin)
253 scal1=max(scal1,scal2)
254 scal1=max(scal1,scal3)
260 if (abs(ta(ix,iy,iz,ie)*xscale).gt.eps .or.
261 $ abs(tb(ix,iy,iz,ie)*xscale).gt.eps )
then
262 write(6,1105) ix,iy,iz,ieg
263 $ ,xm1(ix,iy,iz,ie),ym1(ix,iy,iz,ie),zm1(ix,iy,iz,ie)
264 $ ,tb(ix,iy,iz,ie),ta(ix,iy,iz,ie),xscale
265 1105
format(1x,
'WARNING1 Element mesh mismatch at:',/
266 $ ,1x,
'i,j,k,ie:',3i5,i12,/
267 $ ,1x,
'Near X =',3g16.8,
', d:',3g16.8)
274 CALL copy(ta,ym1,ntot)
275 CALL copy(tb,ym1,ntot)
276 CALL dsop(ta,
'MIN',lx1,ly1,lz1)
277 CALL dsop(tb,
'MAX',lx1,ly1,lz1)
278 CALL sub2(ta,ym1,ntot)
279 CALL sub2(tb,ym1,ntot)
283 yscmax =
vlmax(ym1(1,1,1,ie),nxyz1)
284 yscmin =
vlmin(ym1(1,1,1,ie),nxyz1)
285 scal1=abs(yscmax-yscmin)
288 scal1=max(scal1,scal2)
289 scal1=max(scal1,scal3)
295 IF (abs(ta(ix,iy,iz,ie)*yscale).GT.eps .OR.
296 $ abs(tb(ix,iy,iz,ie)*yscale).GT.eps )
THEN
297 WRITE(6,1205) ix,iy,iz,ieg
298 $ ,xm1(ix,iy,iz,ie),ym1(ix,iy,iz,ie),zm1(ix,iy,iz,ie)
299 $ ,tb(ix,iy,iz,ie),ta(ix,iy,iz,ie),yscale
300 1205
FORMAT(1x,
'WARNING2 Element mesh mismatch at:',/
301 $ ,1x,
'I,J,K,IE:',3i5,i12,/
302 $ ,1x,
'Near Y =',3g16.8,
', d:',3g16.8)
310 CALL copy(ta,zm1,ntot)
311 CALL copy(tb,zm1,ntot)
312 CALL dsop(ta,
'MIN',lx1,ly1,lz1)
313 CALL dsop(tb,
'MAX',lx1,ly1,lz1)
314 CALL sub2(ta,zm1,ntot)
315 CALL sub2(tb,zm1,ntot)
319 zscmax =
vlmax(zm1(1,1,1,ie),nxyz1)
320 zscmin =
vlmin(zm1(1,1,1,ie),nxyz1)
321 scal1=abs(zscmax-zscmin)
324 scal1=max(scal1,scal2)
325 scal1=max(scal1,scal3)
331 IF (abs(ta(ix,iy,iz,ie)*zscale).GT.eps .OR.
332 $ abs(tb(ix,iy,iz,ie)*zscale).GT.eps )
THEN
333 WRITE(6,1305) ix,iy,iz,ieg
334 $ ,xm1(ix,iy,iz,ie),ym1(ix,iy,iz,ie),zm1(ix,iy,iz,ie)
335 $ ,tb(ix,iy,iz,ie),ta(ix,iy,iz,ie),zscale
336 1305
FORMAT(1x,
'WARNING3 Element mesh mismatch at:',/
337 $ ,1x,
'I,J,K,IE:',3i5,i12,/
338 $ ,1x,
'Near Z =',3g16.8,
', d:',3g16.8)
346 if(nid.eq.0)
WRITE(6,1400)
348 $ (
' Mesh consistency check failed. EXITING in VRDSMSH.')
353 CALL gop(tmp,tmp(2),
'M ',1)
354 IF (tmp(1).ge.4.0)
THEN
356 $ (
' Mesh consistency check failed. EXITING in VRDSMSH.')
361 write(6,*)
'done :: verify mesh topology'
378 common /scrns/ tc(lx1,ly1,lz1,lelt),td(lx1,ly1,lz1,lelt)
379 $ , ta(lx1,ly1,lz1,lelt),tb(lx1,ly1,lz1,lelt)
380 $ ,
qmask(lx1,ly1,lz1,lelt)
387 IF (ifheat) ifield = 2
389 ntot = lx1*ly1*lz1*nelt
392 xmx =
glmax(xm1,ntot)
393 xmn =
glmin(xm1,ntot)
394 ymx =
glmax(ym1,ntot)
395 ymn =
glmin(ym1,ntot)
396 zmx =
glmax(zm1,ntot)
397 zmn =
glmin(zm1,ntot)
398 if (nio.eq.0)
write(6,*) xmn,xmx,
' Xrange'
399 if (nio.eq.0)
write(6,*) ymn,ymx,
' Yrange'
400 if (nio.eq.0)
write(6,*) zmn,zmx,
' Zrange'
406 CALL copy(ta,tmult,ntot)
408 CALL copy(ta,vmult,ntot)
415 CALL dssum(ta,lx1,ly1,lz1)
421 CALL sub2 (tb,ta,ntot)
427 IF (abs(tb(ix,iy,iz,ie)).GT.eps )
THEN
428 WRITE(6,1005) ix,iy,iz,ieg
429 $ ,xm1(ix,iy,iz,ie),ym1(ix,iy,iz,ie),zm1(ix,iy,iz,ie)
430 $ ,ta(ix,iy,iz,ie),eps
434 1005
FORMAT(2x,
'WARNING: DSSUM problem at:',/
435 $ ,1x,
'I,J,K,IE:',3i5,i12,/
436 $ ,2x,
'Near X =',3g16.8,
', d:',2g16.8)
445 DO 100 iface=1,nfaces
446 cb =cbc(iface,iel,ifield)
447 IF (cb.EQ.
'P '.or.cb.eq.
'p ')
452 xxmin =
glmin(xm1,ntot)
453 yymin =
glmin(ym1,ntot)
454 zzmin =
glmin(zm1,ntot)
455 xxmax =
glmax(xm1,ntot)
456 yymax =
glmax(ym1,ntot)
457 zzmax =
glmax(zm1,ntot)
458 if (nio.eq.0)
write(6,7) xxmin,yymin,zzmin,xxmax,yymax,zzmax
459 7
format(
'xyz minmx2:',6g13.5)
465 call copy(ta,xm1,ntot)
466 call copy(tb,xm1,ntot)
467 call dsop(ta,
'min',lx1,ly1,lz1)
468 call dsop(tb,
'max',lx1,ly1,lz1)
470 call copy(tc,xm1,ntot)
471 call copy(td,xm1,ntot)
472 call dsop(tc,
'min',lx1,ly1,lz1)
473 call dsop(td,
'max',lx1,ly1,lz1)
475 xxmin =
glmin(xm1,ntot)
476 xxmax =
glmax(xm1,ntot)
477 yymax =
glmax(ta ,ntot)
478 yymin =
glmin(ta ,ntot)
479 zzmin =
glmin(tb ,ntot)
480 zzmax =
glmax(tb ,ntot)
481 if (nio.eq.0)
write(6,9) xxmin,yymin,zzmin,xxmax,yymax,zzmax
482 9
format(
'xyz minmx3:',6g13.5)
484 CALL sub2(ta,xm1,ntot)
485 CALL sub2(tb,xm1,ntot)
489 yymax =
glmax(ta ,ntot)
490 yymin =
glmin(ta ,ntot)
491 zzmin =
glmin(tb ,ntot)
492 zzmax =
glmax(tb ,ntot)
493 if (nio.eq.0)
write(6,19) xxmin,yymin,zzmin,xxmax,yymax,zzmax
494 19
format(
'xyz minmx4:',6g13.5)
501 yymax =
glmax(ta ,ntot)
502 yymin =
glmin(ta ,ntot)
503 zzmin =
glmin(tb ,ntot)
504 zzmax =
glmax(tb ,ntot)
505 if (nio.eq.0)
write(6,29) xxmin,yymin,zzmin,xxmax,yymax,zzmax
506 29
format(
'xyz minmx5:',6g13.5)
509 xscmax =
vlmax(xm1(1,1,1,ie),nxyz1)
510 xscmin =
vlmin(xm1(1,1,1,ie),nxyz1)
511 scal1=abs(xscmax-xscmin)
514 scal1=max(scal1,scal2)
515 scal1=max(scal1,scal3)
521 if (abs(ta(ix,iy,iz,ie)*xscale).gt.eps .or.
522 $ abs(tb(ix,iy,iz,ie)*xscale).gt.eps )
then
523 write(6,1105) nid,ix,iy,iz,ie,ieg
524 $ ,xm1(ix,iy,iz,ie),tc(ix,iy,iz,ie),td(ix,iy,iz,ie)
525 $ ,ym1(ix,iy,iz,ie),zm1(ix,iy,iz,ie)
526 $ ,ta(ix,iy,iz,ie),tb(ix,iy,iz,ie),xscale
527 $ ,
qmask(ix,iy,iz,ie)
528 1105
format(i4.4,1x,
'ie:',3i3,i10,i10,1p9e11.3)
536 xxmin =
glmin(xm1,ntot)
537 xxmax =
glmax(xm1,ntot)
538 yymax =
glmax(ta ,ntot)
539 yymin =
glmin(ta ,ntot)
540 zzmin =
glmin(tb ,ntot)
541 zzmax =
glmax(tb ,ntot)
542 if (nio.eq.0)
write(6,39) xxmin,yymin,zzmin,xxmax,yymax,zzmax
543 39
format(
'xyz minmx5:',6g13.5)
561 COMMON /ctmp0/ rmtrx(3,3),rx(3,3),rz(3,3),xyzn(3,10)
583 CALL mxm(rx,3,rz,3,rmtrx,3)
586 DO 100 i=1,npts-10,10
587 CALL mxm(rmtrx,3,xyz(1,i),3,xyzn,10)
588 CALL copy(xyz(1,i),xyzn,30)
594 CALL mxm(rmtrx,3,xyz(1,i),3,xyzn,n10)
595 CALL copy(xyz(1,i),xyzn,3*n10)
607 dimension xyzl(3,8,lelt)
608 COMMON /ctmp0/ vo(lelt),xyzi(3,lelt),cg(3,lelt)
622 CALL inrtia(xyzi(1,il),cg(1,il),xyzl(1,1,il),ncrnr,1)
623 ti(1)=ti(1)+xyzi(1,il)*vo0
624 ti(2)=ti(2)+xyzi(2,il)*vo0
625 ti(3)=ti(3)+xyzi(3,il)*vo0
626 ti(4)=ti(4)+cg(1,il) *vo0
627 ti(5)=ti(5)+cg(2,il) *vo0
628 ti(6)=ti(6)+cg(3,il) *vo0
630 CALL gop(ti,work,
'+ ',6)
634 IF (if3d) zi=sqrt(ti(3))
640 xyzl(1,ic,il)=(xyzl(1,ic,il)-ti(4))/xi
641 xyzl(2,ic,il)=(xyzl(2,ic,il)-ti(5))/yi
642 xyzl(3,ic,il)=(xyzl(3,ic,il)-ti(6))/zi
653 dimension xyzi(3),cg(3),xyzl(3,1)
654 dimension ti(4),work(4)
661 ti(1)=ti(1)+xyzl(1,i)
662 ti(2)=ti(2)+xyzl(2,i)
663 ti(3)=ti(3)+xyzl(3,i)
665 IF (itype.EQ.2)
CALL gop(ti,work,
'+ ',4)
666 IF (ti(4).EQ.0.0) ti(4)=1.0
675 ti(1)=ti(1)+( xyzl(1,i)-cg(1) )**2
676 ti(2)=ti(2)+( xyzl(2,i)-cg(2) )**2
677 ti(3)=ti(3)+( xyzl(3,i)-cg(3) )**2
679 IF (itype.EQ.2)
CALL gop(ti,work,
'+ ',3)
700 dimension xyz(3,2,2,2,1)
709 vol1 = (xyz(1,2,j,k,ie)-xyz(1,1,j,k,ie))
710 $ * (xyz(2,i,2,k,ie)-xyz(2,i,1,k,ie))
711 $ * (xyz(3,i,j,2,ie)-xyz(3,i,j,1,ie))
712 vol2 = (xyz(1,2,j,k,ie)-xyz(1,1,j,k,ie))
713 $ * (xyz(2,i,j,2,ie)-xyz(2,i,j,1,ie))
714 $ * (xyz(3,i,2,k,ie)-xyz(3,i,1,k,ie))
715 vol3 = (xyz(1,i,2,k,ie)-xyz(1,i,1,k,ie))
716 $ * (xyz(2,2,j,k,ie)-xyz(2,1,j,k,ie))
717 $ * (xyz(3,i,j,2,ie)-xyz(3,i,j,1,ie))
718 vol4 = (xyz(1,i,j,2,ie)-xyz(1,i,j,1,ie))
719 $ * (xyz(2,i,2,k,ie)-xyz(2,i,1,k,ie))
720 $ * (xyz(3,i,2,k,ie)-xyz(3,i,1,k,ie))
721 vol5 = (xyz(1,i,2,k,ie)-xyz(1,i,1,k,ie))
722 $ * (xyz(2,i,j,2,ie)-xyz(2,i,j,1,ie))
723 $ * (xyz(3,2,j,k,ie)-xyz(3,1,j,k,ie))
724 vol6 = (xyz(1,i,j,2,ie)-xyz(1,i,j,1,ie))
725 $ * (xyz(2,i,2,k,ie)-xyz(2,i,1,k,ie))
726 $ * (xyz(3,2,j,k,ie)-xyz(3,1,j,k,ie))
727 vol(ie) = vol(ie)+vol1+vol2+vol3+vol4+vol5+vol6
734 vol1 = (xyz(1,2,j,1,ie)-xyz(1,1,j,1,ie))
735 $ * (xyz(2,i,2,1,ie)-xyz(2,i,1,1,ie))
736 vol3 = (xyz(1,i,2,1,ie)-xyz(1,i,1,1,ie))
737 $ * (xyz(2,2,j,1,ie)-xyz(2,1,j,1,ie))
738 vol(ie)=vol(ie)+vol1+vol3
753 dimension cg(3,1),xyz(3,8,1)
759 cg(1,i)=cg(1,i)+xyz(1,ic,i)
760 cg(2,i)=cg(2,i)+xyz(2,ic,i)
761 cg(3,i)=cg(3,i)+xyz(3,ic,i)
764 CALL cmult(cg,tmp,3*n)
768 subroutine divide(list1,list2,nl1,nl2,ifok,list,nl,xyzi,cg,WGT)
779 dimension list(lelt),list1(lelt),list2(lelt)
780 dimension xyzi(3),cg(3,lelt),wgt(1)
781 COMMON /ctmp0/ xcg(lelt),ycg(lelt),zcg(lelt)
783 INTEGER WORK(2),WRK2(2)
792 IF (ixx.LE.iyy.AND.ixx.LE.izz)
THEN
798 ELSEIF (iyy.LE.ixx.AND.iyy.LE.izz)
THEN
804 ELSEIF (izz.LE.ixx.AND.izz.LE.iyy)
THEN
825 call col2(xcg,wgt,nl)
826 call col2(ycg,wgt,nl)
827 call col2(zcg,wgt,nl)
834 IF (if3d) zm=
fmdian(zcg,nl,ifok)
839 WRITE(6,130) nid,nl,xm,ym,zm
841 WRITE(6,135) nid,il,xcg(il),ycg(il),zcg(il)
843 130
FORMAT(i10,
'DIVIDE: NL,XM,YM,ZM',i3,3f12.5)
844 135
FORMAT(i10,
'DIVIDE: NID,IL,XC,YC,ZCG',i4,3f12.5)
854 IF (xcg(ie).LT.xm)
THEN
858 IF (xcg(ie).GT.xm)
THEN
862 IF (xcg(ie).EQ.xm)
THEN
870 IF (.NOT.ifok)
WRITE(6,201) nid,ie,xcg(ie),xm
871 201
FORMAT(i10,
'DIVIDE: IE,XCG,XM:',i4,3f12.5)
873 IF (ycg(ie).LT.ym)
THEN
877 IF (ycg(ie).GT.ym)
THEN
881 IF (ycg(ie).EQ.ym)
THEN
883 IF (if3d .AND. zcg(ie).LT.zm)
THEN
886 ELSE IF (if3d .AND. zcg(ie).GT.zm)
THEN
905 CALL igop(work,wrk2,
'+ ',2)
906 IF (abs(work(1)-work(2)).GT.1) ifok=.false.
915 write(6,*) buf(i),
' whhhh'
927 write(6,1) nid,eg,e,(cbc(f,e,1),f=1,6)
929 1
format(3i12,6(1x,a3),
' cbc')
941 neltmx=min(neltmx,lelg)
942 nelvmx=min(nelvmx,lelg)
949 if (nelgt.gt.neltmx.or.nelgv.gt.nelvmx)
then
951 lelt_needed = nelgt/np
952 if (mod(nelgt,np).ne.0) lelt_needed = lelt_needed + 1
953 write(6,12) lelt,lelg,lelt_needed,np,nelgt
954 12
format(//,2x,
'ABORT: Problem size too large!'
956 $ ,/,2x,
'This solver has been compiled for:'
957 $ ,/,2x,
' number of elements/proc (lelt):',i12
958 $ ,/,2x,
' total number of elements (lelg):',i12
960 $ ,/,2x,
'Recompile with the following SIZE parameters:'
961 $ ,/,2x,
' lelt >= ',i12,
' for np = ',i12
962 $ ,/,2x,
' lelg >= ',i12,/)
969 if(nelgt.gt.nelgt_max)
then
970 if(nid.eq.0)
write(6,*)
971 $
'ABORT: Total number of elements too large!',
972 $
' nel_max = ', nelgt_max
976 if (nelt.gt.lelt)
then
977 write(6,
'(A,3I12)')
'ABORT: nelt>lelt!', nid, nelt, lelt
986 character*132 sout,key
988 character*1 string1(132)
989 equivalence(string1,string)
992 call blank(string,132)
993 read (nk,80,
end=100,err=100) string
994 call chcopy(sout,string,132)
996 if (
indx1(string,key,nk).ne.0)
return
subroutine igop(x, w, op, n)
subroutine gop(x, w, op, n)
subroutine exitti(stringi, idata)
subroutine bcast(buf, len)
real *8 function dnekclock()
real *8 function dnekclock_sync()
subroutine facev(a, ie, iface, val, nx, ny, nz)
subroutine inrtia(xyzi, cg, xyzl, n, itype)
subroutine bufchk(buf, n)
subroutine scale(xyzl, nl)
subroutine volume2(vol, xyz, n)
subroutine rotat2(xyz, angle, npts)
subroutine cscan(sout, key, nk)
subroutine divide(list1, list2, nl1, nl2, ifok, list, nl, xyzi, cg, WGT)
subroutine findcg(cg, xyz, n)
subroutine dsop(u, op, nx, ny, nz)
subroutine dssum(u, nx, ny, nz)
integer function indx1(S1, S2, L2)
real function vlmax(vec, n)
function fmdian(a, n, ifok)
subroutine cmult(a, const, n)
subroutine chcopy(a, b, n)
real function vlmin(vec, n)
subroutine mxm(a, n1, b, n2, c, n3)
subroutine read_re2_hdr(ifbswap, ifverbose)
subroutine read_re2_data(ifbswap)
subroutine qmask(R1, R2, R3, R1MASK, R2MASK, R3MASK, NEL)