Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
connect1.F90
Go to the documentation of this file.
1 !-----------------------------------------------------------------------
12 subroutine setup_topo()
13  use kinds, only : dp, i8
14  use size_m, only : nid, ndim, nx1, ny1, nz1, nelv, nelt, nfield
15  use size_m, only : lx1, ly1, lz1, lelv
16  use input, only : ifflow, ifmvbd, ifheat, param
17  use mesh, only : vertex
18  use mvgeom, only : wmult
19  use parallel, only : nelgv, nelgt, gsh_fld, nelg
20  use soln, only : vmult, tmult
21  use tstep, only : ifield
22  use zper, only : ifgtp
23  implicit none
24 
25  integer(i8), allocatable :: glo_num(:)
26 
27  integer :: nxl, nyl, nzl, mfield, ncrnr, ntotv, ntott
28  real(DP) :: vmltmax, ivmltmax
29  real(DP), external :: glmax
30 
31  allocate(glo_num(lx1*ly1*lz1*lelv))
32 
33  if(nid == 0) write(6,*) 'setup mesh topology'
34 
35 ! Initialize key arrays for Direct Stiffness SUM.
36 
37  nxl=3
38  nyl=3
39  nzl=1+2*(ndim-2)
40 
41  call initds
42  call dsset(nx1,ny1,nz1)
43  call setedge
44 
45 !=================================================
46 ! Establish (global) domain topology
47 !=================================================
48 ! .Generate topologically correct mesh data.
49 ! .Set up element centers, face centers, etc.
50 ! .Check right handedness of elements.
51 ! .Check element boundary conditions.
52 ! .Establish Element-Element rotations
53 ! .Construct the element to processor map and
54 
55  call genxyzl
56  call setside
57  if (param(75) < 1) call verify
58 
59  CALL setcdof
60 !max IF (IFAXIS ) CALL SETRZER
61 !max IF (IFMVBD ) CALL CBCMESH
62 #if 0
63  IF (ifmodel .AND. ifkeps) CALL cbcturb
64 #endif
65  if (param(75) < 1) CALL chkaxcb
66 
67 !========================================================================
68 ! Set up element-processor mapping and establish global numbering
69 !========================================================================
70 
71  mfield=2
72  if (ifflow) mfield=1
73  if (ifmvbd) mfield=0
74 
75  ncrnr = 2**ndim
76 
77  if (nelgv == nelgt) then
78  if (ifgtp) then
79  write(*,*) "Oops: ifgtp"
80 !max call gen_gtp_vertex (vertex, ncrnr)
81  else
82  call get_vert
83  endif
84  call setupds(gsh_fld(1),nx1,ny1,nz1,nelv,nelgv,vertex,glo_num)
85  gsh_fld(2)=gsh_fld(1)
86 
87  ! call gs_counter(glo_num,gsh_fld(1))
88 
89  else
90 
91  ! For conjugate heat transfer, it is assumed that fluid
92  ! elements are listed both globally and locally with lower
93  ! element numbers than the solid elements.
94  ! We currently assume that there is at least one fluid elem.
95  ! per processor.
96 
97 
98  call get_vert
99  ! call outmati(vertex,4,nelv,'vrtx V')
100  call setupds(gsh_fld(1),nx1,ny1,nz1,nelv,nelgv,vertex,glo_num)
101 
102  ! call get_vert (vertex, ncrnr, nelgt, '.mp2') ! LATER !
103  ! call outmati(vertex,4,nelt,'vrtx T')
104  call setupds(gsh_fld(2),nx1,ny1,nz1,nelt,nelgt,vertex,glo_num)
105 
106 
107  ! Feb 20, 2012: It appears that we do not need this restriction: (pff)
108  ! check if there is a least one fluid element on each processor
109  ! do iel = 1,nelt
110  ! ieg = lglel(iel)
111  ! if (ieg.le.nelgv) goto 101
112  ! enddo
113  ! if(nid.eq.0) write(6,*)
114  ! & 'ERROR: each domain must contain at least one fluid element!'
115  ! call exitt
116  ! 101 continue
117 
118  endif
119 
120 !max if (ifmvbd) call setup_mesh_dssum ! Set up dssum for mesh
121 
122 !========================================================================
123 ! Set up multiplicity and direct stiffness arrays for each IFIELD
124 !========================================================================
125 
126  ntotv = nx1*ny1*nz1*nelv
127  ntott = nx1*ny1*nz1*nelt
128 
129  if (ifheat) then
130  ifield = 2
131  allocate(tmult(nx1,ny1,nz1,nelt,1))
132  tmult(:,:,:,:,1) = 1._dp
133  call dssum(tmult)
134  tmult(:,:,:,:,1) = 1._dp / tmult(:,:,:,:,1)
135  endif
136 
137  if (ifflow) then
138  if (ifheat) then
139  vmult => tmult(:,:,:,:,1)
140  else
141  ifield = 1
142  allocate(vmult(nx1,ny1,nz1,nelv))
143  vmult = 1._dp
144  call dssum(vmult)
145  vmltmax=glmax(vmult,ntotv)
146  ivmltmax=vmltmax
147  if (nid == 0) write(6,*) ivmltmax,' max multiplicity'
148  vmult = 1._dp / vmult
149  endif
150  endif
151  if ( .NOT. ifflow) call copy(vmult,tmult,ntott)
152  if (ifmvbd) call copy(wmult,vmult,ntott)
153  do ifield=3,nfield ! Additional pass. scalrs.
154  if (nelg(ifield) == nelgv) then
155  gsh_fld(ifield) = gsh_fld(1)
156  call copy(tmult(1,1,1,1,ifield-1),vmult,ntotv)
157  else
158  gsh_fld(ifield) = gsh_fld(2)
159  call copy(tmult(1,1,1,1,ifield-1),tmult,ntott)
160  endif
161  enddo
162 
163  if(nid == 0) then
164  write(6,*) 'done :: setup mesh topology'
165  write(6,*) ' '
166  endif
167 
168  return
169 end subroutine setup_topo
170 
171 !-----------------------------------------------------------------------
174 subroutine initds
175  use size_m
176  use topol, only : group, eface1, eface, nomlis
177  implicit none
178 
179  integer :: j, idim, iface
180 
181 ! Nominal ordering for direct stiffness summation of faces
182  j=0
183  DO idim=1,ndim
184  DO iface=1,2
185  j=j+1
186  nomlis(iface,idim)=j
187  enddo
188  END DO
189 
190 ! Assign Ed's numbering scheme to PF's scheme.
191 
192  eface(1)=4
193  eface(2)=2
194  eface(3)=1
195  eface(4)=3
196  eface(5)=5
197  eface(6)=6
198 
199 ! Assign inverse of Ed's numbering scheme to PF's scheme.
200 
201  eface1(1)=3
202  eface1(2)=2
203  eface1(3)=4
204  eface1(4)=1
205  eface1(5)=5
206  eface1(6)=6
207 
208 ! Assign group designation to each face to determine ordering of indices.
209 
210  group(1)=0
211  group(2)=1
212  group(3)=1
213  group(4)=0
214  group(5)=0
215  group(6)=1
216 
217  RETURN
218 end subroutine initds
219 
220 !-----------------------------------------------------------------------
290 subroutine setedge()
291  use size_m, only : ndim
292  use topol, only : iedgef, iedge, invedg, skpdat, group
293  implicit none
294 
295  integer :: ITMP(3,3,3)
296  INTEGER :: ORDER
297 
298  integer :: nxl, nyl, nzl, nxy, nxyz, nfaces
299  integer :: i3d, i, i3, iz, i2, iy, i1, ix
300  integer :: j, j1, j2, jskip2
301  integer :: jf2, js2, jskip1, jf1, js1, iface, image, ii
302  integer :: iedgef_flat(48)
303  nxl=3
304  nyl=3
305  nzl=1+2*(ndim-2)
306  nxy =nxl*nyl
307  nxyz =nxl*nyl*nzl
308  nfaces=2*ndim
309 
310 !----------------------------------------------------------------------
311 ! Set up edge arrays (temporary - required only for defining DS)
312 !----------------------------------------------------------------------
313 ! Fill corners - 1 through 8.
314 
315  i3d=1
316  IF (ndim == 2) i3d=0
317 
318  i=0
319  DO i3=0,i3d
320  iz=1+(nzl-1)*i3
321  DO i2=0,1
322  iy=1+(nyl-1)*i2
323  DO i1=0,1
324  ix=1+(nxl-1)*i1
325  i=i+1
326  iedge(i)=ix+nxl*(iy-1)+nxy*(iz-1)
327  enddo
328  enddo
329  END DO
330 
331 ! Fill X-direction edges.
332 
333  DO i3=0,i3d
334  iz=1+(nzl-1)*i3
335  DO i2=0,1
336  iy=1+(nyl-1)*i2
337  DO ix=2,nxl-1
338  i=i+1
339  iedge(i)=ix+nxl*(iy-1)+nxy*(iz-1)
340  enddo
341  enddo
342  enddo
343 
344 ! Fill Y-direction edges.
345 
346  DO i3=0,i3d
347  iz=1+(nzl-1)*i3
348  DO i1=0,1
349  ix=1+(nxl-1)*i1
350  DO iy=2,nyl-1
351  i=i+1
352  iedge(i)=ix+nxl*(iy-1)+nxy*(iz-1)
353  enddo
354  enddo
355  enddo
356 
357 ! Fill Z-direction edges.
358 
359  IF (ndim == 3) THEN
360  DO i2=0,1
361  iy=1+(nyl-1)*i2
362  DO i1=0,1
363  ix=1+(nxl-1)*i1
364  DO iz=2,nzl-1
365  i=i+1
366  iedge(i)=ix+nxl*(iy-1)+nxy*(iz-1)
367  enddo
368  enddo
369  enddo
370  ENDIF
371 
372  invedg = 0
373  DO ii=1,20
374  ix=iedge(ii)
375  invedg(ix)=ii
376  END DO
377 
378 
379 ! GENERAL FACE, GENERAL ROTATION EDGE NUMBERS.
380 #if 0
381 
382  IF (ndim == 3) THEN
383 
384  ! Pack 3-D edge numbering:
385 
386  ! Fill temporary array with local index numbers:
387  itmp = reshape( (/(i,i=1,nxyz)/), (/nxl, nyl, nzl/))
388 
389  ! Two sets are required, the base cube and the image cube
390  ! which is being summed with it.
391 
392  DO 1000 image=0,1
393 
394  ! Pack edges for each face, no rotation.
395 
396  DO 500 iface=1,nfaces
397  js1 = skpdat(1,iface)
398  jf1 = skpdat(2,iface)
399  jskip1 = skpdat(3,iface)
400  js2 = skpdat(4,iface)
401  jf2 = skpdat(5,iface)
402  jskip2 = skpdat(6,iface)
403 
404  ! Choose proper indexing order according to face type and image.
405 
406  order = (-1)**(group(iface)+image)
407  IF (order == 1) THEN
408 
409  ! Forward ordering:
410 
411  ! +-------------+ ^ v1
412  ! | --------->| | |
413  ! | ^ 2 | | +-->
414  ! | | | | v2
415  ! | |1 3| |
416  ! | | 4 V |
417  ! | |<--------- |
418  ! F-------------I F is fiducial node.
419 
420  ! I is location of fiducial node for
421  ! image face.
422 
423  ! Load edge 1:
424 
425  j=0
426  j2=js2
427  DO 100 j1=js1,jf1-jskip1,jskip1
428  j=j+1
429  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
430  100 END DO
431 
432  ! Load edge 2:
433 
434  j=0
435  j1=jf1
436  DO 200 j2=js2,jf2-jskip2,jskip2
437  j=j+1
438  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
439  200 END DO
440 
441 
442  ! Load edge 3:
443 
444  j=0
445  j2=jf2
446  DO 300 j1=jf1,js1+jskip1,-jskip1
447  j=j+1
448  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
449  300 END DO
450 
451  ! Load edge 4:
452 
453  j=0
454  j1=js1
455  DO 400 j2=jf2,js2+jskip2,-jskip2
456  j=j+1
457  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
458  400 END DO
459  ! insert
460  iedgef(:,:,:,image) = reshape(iedgef_flat, (/2,4,6/))
461 
462  ELSE
463 
464  ! Reverse ordering:
465 
466  ! +-------------+
467  ! | |<--------- | ^ v2
468  ! | | 2 ^ | |
469  ! | | | | <--+
470  ! | |3 1| | v1
471  ! | V 4 | |
472  ! | --------->| |
473  ! I-------------F F is fiducial node.
474 
475  ! I is location of fiducial node for
476  ! image face.
477 
478  ! Load edge 1:
479 
480  j=0
481  j1=js1
482  write(*,*) iface, js2, jf2, jskip2, image
483  DO 105 j2=js2,jf2-jskip2,jskip2
484  j=j+1
485  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
486  105 END DO
487 
488  ! Load edge 2:
489 
490  j=0
491  j2=jf2
492  DO 205 j1=js1,jf1-jskip1,jskip1
493  j=j+1
494  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
495  205 END DO
496 
497  ! Load edge 3:
498 
499  j=0
500  j1=jf1
501  DO 305 j2=jf2,js2+jskip2,-jskip2
502  j=j+1
503  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
504  305 END DO
505 
506  ! Load edge 4:
507 
508  j=0
509  j2=js2
510  DO 405 j1=jf1,js1+jskip1,-jskip1
511  j=j+1
512  iedgef_flat(j+(iface-1)*8)=j1 + 3*(j2-1) !ITMP(J1,J2,1)
513  405 END DO
514  ENDIF
515  ! insert
516  iedgef(:,:,:,image) = reshape(iedgef_flat, (/2,4,6/))
517 
518  500 END DO
519  1000 END DO
520  ELSE
521 
522  ! Load edge information for 2-D case
523 
524  iedgef(1,1,1,0) = nxy - nxl + 1
525  iedgef(1,2,1,0) = 1
526  iedgef(1,1,2,0) = nxl
527  iedgef(1,2,2,0) = nxy
528  iedgef(1,1,3,0) = 1
529  iedgef(1,2,3,0) = nxl
530  iedgef(1,1,4,0) = nxy
531  iedgef(1,2,4,0) = nxy - nxl + 1
532 
533  iedgef(1,1,1,1) = 1
534  iedgef(1,2,1,1) = nxy - nxl + 1
535  iedgef(1,1,2,1) = nxy
536  iedgef(1,2,2,1) = nxl
537  iedgef(1,1,3,1) = nxl
538  iedgef(1,2,3,1) = 1
539  iedgef(1,1,4,1) = nxy - nxl + 1
540  iedgef(1,2,4,1) = nxy
541  ENDIF
542 #endif
543 
544  RETURN
545 end subroutine setedge
546 
547 !-----------------------------------------------------------------------
549 subroutine dsset(nx,ny,nz)
550  use topol, only : ixcn, skpdat, eskip, nedg
551  implicit none
552 
553  integer :: nx, ny, nz
554 
555  INTEGER, save :: NXO = 0, NYO = 0, NZO = 0
556  integer :: ic, icz, icy, icx, nxy, ied, iedm
557 
558 ! Check if element surface counters are already set from last call...
559  IF (nxo == nx .AND. nyo == ny .AND. nzo == nz) RETURN
560 
561 ! else, proceed....
562 
563  nxo = nx
564  nyo = ny
565  nzo = nz
566 
567 ! Establish corner to elemental node number mappings
568 
569  ic=0
570  DO icz=0,1
571  DO icy=0,1
572  DO icx=0,1
573  ! Supress vectorization to
574  ! IF(ICX.EQ.0)DUMMY=0
575  ! IF(ICX.EQ.1)DUMMY=1
576  ! DUMMY2=DUMMY2+DUMMY
577  ic=ic+1
578  ixcn(ic)= 1 + (nx-1)*icx + nx*(ny-1)*icy + nx*ny*(nz-1)*icz
579  enddo
580  enddo
581  enddo
582 
583 ! Assign indices for direct stiffness summation of arbitrary faces.
584 
585 
586 ! Y-Z Planes (Faces 1 and 2)
587 
588  skpdat(1,1)=1
589  skpdat(2,1)=nx*(ny-1)+1
590  skpdat(3,1)=nx
591  skpdat(4,1)=1
592  skpdat(5,1)=ny*(nz-1)+1
593  skpdat(6,1)=ny
594 
595  skpdat(1,2)=1 + (nx-1)
596  skpdat(2,2)=nx*(ny-1)+1 + (nx-1)
597  skpdat(3,2)=nx
598  skpdat(4,2)=1
599  skpdat(5,2)=ny*(nz-1)+1
600  skpdat(6,2)=ny
601 
602 ! X-Z Planes (Faces 3 and 4)
603 
604  skpdat(1,3)=1
605  skpdat(2,3)=nx
606  skpdat(3,3)=1
607  skpdat(4,3)=1
608  skpdat(5,3)=ny*(nz-1)+1
609  skpdat(6,3)=ny
610 
611  skpdat(1,4)=1 + nx*(ny-1)
612  skpdat(2,4)=nx + nx*(ny-1)
613  skpdat(3,4)=1
614  skpdat(4,4)=1
615  skpdat(5,4)=ny*(nz-1)+1
616  skpdat(6,4)=ny
617 
618 ! X-Y Planes (Faces 5 and 6)
619 
620  skpdat(1,5)=1
621  skpdat(2,5)=nx
622  skpdat(3,5)=1
623  skpdat(4,5)=1
624  skpdat(5,5)=ny
625  skpdat(6,5)=1
626 
627  skpdat(1,6)=1 + nx*ny*(nz-1)
628  skpdat(2,6)=nx + nx*ny*(nz-1)
629  skpdat(3,6)=1
630  skpdat(4,6)=1
631  skpdat(5,6)=ny
632  skpdat(6,6)=1
633 
634 ! Set up skip indices for each of the 12 edges
635 
636 ! Note that NXY = NX*NY even for 2-D since
637 ! this branch does not apply to the 2D case anyway.
638 
639 ! ESKIP(*,1) = start location
640 ! ESKIP(*,2) = end
641 ! ESKIP(*,3) = stride
642 
643  nxy=nx*ny
644  eskip( 1,1) = ixcn(1) + 1
645  eskip( 1,2) = ixcn(2) - 1
646  eskip( 1,3) = 1
647  eskip( 2,1) = ixcn(3) + 1
648  eskip( 2,2) = ixcn(4) - 1
649  eskip( 2,3) = 1
650  eskip( 3,1) = ixcn(5) + 1
651  eskip( 3,2) = ixcn(6) - 1
652  eskip( 3,3) = 1
653  eskip( 4,1) = ixcn(7) + 1
654  eskip( 4,2) = ixcn(8) - 1
655  eskip( 4,3) = 1
656  eskip( 5,1) = ixcn(1) + nx
657  eskip( 5,2) = ixcn(3) - nx
658  eskip( 5,3) = nx
659  eskip( 6,1) = ixcn(2) + nx
660  eskip( 6,2) = ixcn(4) - nx
661  eskip( 6,3) = nx
662  eskip( 7,1) = ixcn(5) + nx
663  eskip( 7,2) = ixcn(7) - nx
664  eskip( 7,3) = nx
665  eskip( 8,1) = ixcn(6) + nx
666  eskip( 8,2) = ixcn(8) - nx
667  eskip( 8,3) = nx
668  eskip( 9,1) = ixcn(1) + nxy
669  eskip( 9,2) = ixcn(5) - nxy
670  eskip( 9,3) = nxy
671  eskip(10,1) = ixcn(2) + nxy
672  eskip(10,2) = ixcn(6) - nxy
673  eskip(10,3) = nxy
674  eskip(11,1) = ixcn(3) + nxy
675  eskip(11,2) = ixcn(7) - nxy
676  eskip(11,3) = nxy
677  eskip(12,1) = ixcn(4) + nxy
678  eskip(12,2) = ixcn(8) - nxy
679  eskip(12,3) = nxy
680 
681 ! Load reverse direction edge arrays for reverse mappings...
682 
683  DO 20 ied=1,12
684  iedm=-ied
685  eskip(iedm,1) = eskip(ied,2)
686  eskip(iedm,2) = eskip(ied,1)
687  eskip(iedm,3) = -eskip(ied,3)
688  20 END DO
689 
690 ! Compute offset for global edge vector given current element
691 ! dimensions.....
692 
693 ! NGSPED(ITE,ICMP) = number of global (ie, distinct) special edges
694 ! of type ITE (1,2, or 3) for field ICMP.
695 
696 ! ITE = 1 implies an "X" edge
697 ! ITE = 2 implies an "Y" edge
698 ! ITE = 3 implies an "Z" edge
699 
700 ! Set up number of nodes along each of the 3 types of edges
701 ! (endpoints excluded).
702 
703  nedg(1)=nx-2
704  nedg(2)=ny-2
705  nedg(3)=nz-2
706 
707  RETURN
708 end subroutine dsset
709 
710 !-----------------------------------------------------------------------
712 subroutine genxyzl()
713  use kinds, only : dp
714  use size_m, only : ndim, nelt
715  use input, only : xc, yc, zc
716  use scratch, only : xml, yml, zml
717  implicit none
718 
719  real(DP) :: XCB(2,2,2),YCB(2,2,2),ZCB(2,2,2), H(3,3,2)
720  integer :: indx(8)
721 
722  integer :: nxl, nyl, nzl, ntot3
723  integer :: ix, iy, iz, ixt, iyt, izt, ie, ndim2
724  nxl=3
725  nyl=3
726  nzl=1+2*(ndim-2)
727  ntot3=nxl*nyl*nzl*nelt
728 
729 ! Preprocessor Corner notation: Symmetric Corner notation:
730 
731 ! 4+-----+3 ^ s 3+-----+4 ^ s
732 ! / /| | / /| |
733 ! / / | | / / | |
734 ! 8+-----+7 +2 +----> r 7+-----+8 +2 +----> r
735 ! | | / / | | / /
736 ! | |/ / | |/ /
737 ! 5+-----+6 t 5+-----+6 t
738 
739  DO 10 ix=1,nxl
740  h(ix,1,1)=0.5*float(3-ix)
741  h(ix,1,2)=0.5*float(ix-1)
742  10 END DO
743  DO 20 iy=1,nyl
744  h(iy,2,1)=0.5*float(3-iy)
745  h(iy,2,2)=0.5*float(iy-1)
746  20 END DO
747  DO 30 iz=1,nzl
748  h(iz,3,1)=0.5*float(3-iz)
749  h(iz,3,2)=0.5*float(iz-1)
750  30 END DO
751 
752  indx(1)=1
753  indx(2)=2
754  indx(3)=4
755  indx(4)=3
756  indx(5)=5
757  indx(6)=6
758  indx(7)=8
759  indx(8)=7
760 
761  xml = 0._dp; yml = 0._dp; zml = 0._dp
762  xcb = 0._dp; ycb = 0._dp; zcb = 0._dp
763 
764  DO 5000 ie=1,nelt
765 
766  ndim2 = 2**ndim
767  xcb = reshape(xc(indx(1:ndim2), ie), (/2,2,2/))
768  ycb = reshape(yc(indx(1:ndim2), ie), (/2,2,2/))
769  zcb = reshape(zc(indx(1:ndim2), ie), (/2,2,2/))
770 
771  ! Map R-S-T space into physical X-Y-Z space.
772 
773  DO izt=1,ndim-1
774  DO iyt=1,2
775  DO ixt=1,2
776 
777  DO iz=1,nzl
778  DO iy=1,nyl
779  DO ix=1,nxl
780  xml(ix,iy,iz,ie)=xml(ix,iy,iz,ie)+ &
781  h(ix,1,ixt)*h(iy,2,iyt)*h(iz,3,izt)*xcb(ixt,iyt,izt)
782  yml(ix,iy,iz,ie)=yml(ix,iy,iz,ie)+ &
783  h(ix,1,ixt)*h(iy,2,iyt)*h(iz,3,izt)*ycb(ixt,iyt,izt)
784  zml(ix,iy,iz,ie)=zml(ix,iy,iz,ie)+ &
785  h(ix,1,ixt)*h(iy,2,iyt)*h(iz,3,izt)*zcb(ixt,iyt,izt)
786  enddo
787  enddo
788  enddo
789  enddo
790  enddo
791  enddo
792 
793  5000 END DO
794  RETURN
795 end subroutine genxyzl
796 
797 !-----------------------------------------------------------------------
801 subroutine verify
802  implicit none
803  call verrhe
804  return
805 end subroutine verify
806 
807 !-----------------------------------------------------------------------
808 subroutine setside
809  use kinds, only : dp
810  use size_m, only : nelt, ndim
811  use input, only : if3d, xc, yc, zc
812  use scratch, only : xyz, side
813  use topol, only : indx, icface
814  implicit none
815 
816  integer :: ie, j, ivtx, nfaces, ncrnr, icrn, ifac, icr1, ivt1, idim
817  integer, external :: mod1
818  real(DP) :: avwght
819 
820 ! SIDE(i,IFACE,IE) - Physical (xyz) location of element side midpoint.
821 ! i=1,2,3 gives x,y,z value, respectively.
822 ! i=4 gives average dimension of face for setting
823 ! tolerances.
824  indx(1)=1
825  indx(2)=2
826  indx(3)=4
827  indx(4)=3
828  indx(5)=5
829  indx(6)=6
830  indx(7)=8
831  indx(8)=7
832 
833 ! Flip vertex array structure
834 
835 ! write(6,*) nelv,nelt,if3d
836  xyz = 0._dp
837  if (if3d) then
838  do ie=1,nelt
839  do j=1,8
840  ivtx = indx(j)
841  xyz(1,ivtx,ie) = xc(j,ie)
842  xyz(2,ivtx,ie) = yc(j,ie)
843  xyz(3,ivtx,ie) = zc(j,ie)
844  ! write(6,1) ie,j,ivtx,xc(j,ie),yc(j,ie),zc(j,ie),' xcz'
845  ! write(6,1) ie,j,ivtx,(xyz(k,ivtx,ie),k=1,3),' vtx'
846  ! 1 format(3i5,1p3e12.4,a4)
847  enddo
848  enddo
849  else
850  do ie=1,nelt
851  do j=1,4
852  ivtx = indx(j)
853  xyz(1,ivtx,ie) = xc(j,ie)
854  xyz(2,ivtx,ie) = yc(j,ie)
855  xyz(3,ivtx,ie) = 0.0
856  enddo
857  enddo
858  endif
859 
860 ! Compute location of center and "diameter" of each element side.
861 
862  nfaces=ndim*2
863  ncrnr =2**(ndim-1)
864  side = 0._dp
865  DO icrn=1,ncrnr
866  DO ifac=1,nfaces
867  ivtx = icface(icrn,ifac)
868  icr1 = ncrnr+(icrn-1)
869  icr1 = mod1(icr1,ncrnr)
870  ivt1 = icface(icr1,ifac)
871  DO 400 ie=1,nelt
872  DO 300 idim=1,ndim
873  side(idim,ifac,ie)=side(idim,ifac,ie)+xyz(idim,ivtx,ie)
874  side( 4,ifac,ie)=side( 4,ifac,ie)+ &
875  ( xyz(idim,ivtx,ie)-xyz(idim,ivt1,ie) )**2
876  300 END DO
877  side(4,ifac,ie)=sqrt( side(4,ifac,ie) )
878  400 END DO
879  enddo
880  END DO
881  avwght=1.0/float(ncrnr)
882  side = side*avwght
883 
884 ! call exitt
885  RETURN
886 end subroutine setside
887 
888 !-----------------------------------------------------------------------
891 subroutine verrhe()
892  use kinds, only : dp
893  use size_m, only : nid, nelt
894  use input, only : if3d
895  use parallel, only : lglel, nelgt
896  use scratch, only : xyz
897  implicit none
898 
899  integer :: ie, ieg
900  real(DP) :: v1, v2, v3, v4, v5, v6, v7, v8
901  LOGICAL :: IFCSTT
902  real(DP), external :: volum0
903 
904  ifcstt= .true.
905  IF ( .NOT. if3d) THEN
906  write(*,*) "Oops: not if3d"
907 #if 0
908  DO 1000 ie=1,nelt
909 
910  ! CRSS2D(A,B,O) = (A-O) X (B-O)
911 
912  c1=crss2d(xyz(1,2,ie),xyz(1,3,ie),xyz(1,1,ie))
913  c2=crss2d(xyz(1,4,ie),xyz(1,1,ie),xyz(1,2,ie))
914  c3=crss2d(xyz(1,1,ie),xyz(1,4,ie),xyz(1,3,ie))
915  c4=crss2d(xyz(1,3,ie),xyz(1,2,ie),xyz(1,4,ie))
916 
917  IF (c1 <= 0.0 .OR. c2 <= 0.0 .OR. &
918  c3 <= 0.0 .OR. c4 <= 0.0 ) THEN
919 
920  ieg=lglel(ie)
921  WRITE(6,800) ieg,c1,c2,c3,c4
922  call exitt
923  800 FORMAT(/,2x,'WARNINGa: Detected non-right-handed element.', &
924  /,2x,'Number',i8,' C1-4:',4e12.4)
925  ifcstt= .false.
926  ! CALL QUERY(IFYES,'Proceed ')
927  ! IF (.NOT.IFYES) GOTO 9000
928  ENDIF
929  1000 END DO
930 #endif
931  ! Else 3-D:
932  ELSE
933  DO 2000 ie=1,nelt
934 
935  ! VOLUM0(A,B,C,O) = (A-O)X(B-O).(C-O)
936 
937  v1= volum0(xyz(1,2,ie),xyz(1,3,ie),xyz(1,5,ie),xyz(1,1,ie))
938  v2= volum0(xyz(1,4,ie),xyz(1,1,ie),xyz(1,6,ie),xyz(1,2,ie))
939  v3= volum0(xyz(1,1,ie),xyz(1,4,ie),xyz(1,7,ie),xyz(1,3,ie))
940  v4= volum0(xyz(1,3,ie),xyz(1,2,ie),xyz(1,8,ie),xyz(1,4,ie))
941  v5=-volum0(xyz(1,6,ie),xyz(1,7,ie),xyz(1,1,ie),xyz(1,5,ie))
942  v6=-volum0(xyz(1,8,ie),xyz(1,5,ie),xyz(1,2,ie),xyz(1,6,ie))
943  v7=-volum0(xyz(1,5,ie),xyz(1,8,ie),xyz(1,3,ie),xyz(1,7,ie))
944  v8=-volum0(xyz(1,7,ie),xyz(1,6,ie),xyz(1,4,ie),xyz(1,8,ie))
945 
946  IF (v1 <= 0.0 .OR. v2 <= 0.0 .OR. &
947  v3 <= 0.0 .OR. v4 <= 0.0 .OR. &
948  v5 <= 0.0 .OR. v6 <= 0.0 .OR. &
949  v7 <= 0.0 .OR. v8 <= 0.0 ) THEN
950 
951  ieg=lglel(ie)
952  WRITE(6,1800) ieg,v1,v2,v3,v4,v5,v6,v7,v8
953  call exitt
954  1800 FORMAT(/,2x,'WARNINGb: Detected non-right-handed element.', &
955  /,2x,'Number',i8,' V1-8:',4e12.4 &
956  /,2x,' ',4x,' ',4e12.4)
957  ifcstt= .false.
958  ENDIF
959  2000 END DO
960  ENDIF
961 
962 ! Print out results from right-handed check
963 
964  IF ( .NOT. ifcstt) WRITE(6,2001)
965 
966 ! Check consistency accross all processors.
967 
968  CALL gllog(ifcstt, .false. )
969 
970  IF ( .NOT. ifcstt) THEN
971  IF (nid == 0) WRITE(6,2003) nelgt
972  call exitt
973  ELSE
974  IF (nid == 0) WRITE(6,2002) nelgt
975  ENDIF
976 
977  2001 FORMAT(//,' Elemental geometry not right-handed, ABORTING' &
978  ,' in routine VERRHE.')
979  2002 FORMAT(' Right-handed check complete for',i8,' elements. OK.')
980  2003 FORMAT(' Right-handed check failed for',i8,' elements.' &
981  ,' Exiting in routine VERRHE.')
982  RETURN
983 end subroutine verrhe
984 
985 !-----------------------------------------------------------------------
991 real(DP) FUNCTION volum0(P1,P2,P3,P0)
992  use kinds, only : dp
993  implicit none
994  REAL(DP) :: P1(3),P2(3),P3(3),P0(3)
995  real(DP) :: u1, u2, u3, v1, v2, v3, w1, w2, w3, cross1, cross2, cross3
996  u1=p1(1)-p0(1)
997  u2=p1(2)-p0(2)
998  u3=p1(3)-p0(3)
999 
1000  v1=p2(1)-p0(1)
1001  v2=p2(2)-p0(2)
1002  v3=p2(3)-p0(3)
1003 
1004  w1=p3(1)-p0(1)
1005  w2=p3(2)-p0(2)
1006  w3=p3(3)-p0(3)
1007 
1008  cross1 = u2*v3-u3*v2
1009  cross2 = u3*v1-u1*v3
1010  cross3 = u1*v2-u2*v1
1011 
1012  volum0 = w1*cross1 + w2*cross2 + w3*cross3
1013 
1014  RETURN
1015 END FUNCTION volum0
1016 
1017 !-----------------------------------------------------------------------
1019 subroutine facind (kx1,kx2,ky1,ky2,kz1,kz2,nx,ny,nz,iface)
1020  implicit none
1021  integer :: kx1, ky1, kz1, kx2, ky2, kz2, nx, ny, nz, iface
1022 
1023  kx1=1
1024  ky1=1
1025  kz1=1
1026  kx2=nx
1027  ky2=ny
1028  kz2=nz
1029  IF (iface == 1) ky2=1
1030  IF (iface == 2) kx1=nx
1031  IF (iface == 3) ky1=ny
1032  IF (iface == 4) kx2=1
1033  IF (iface == 5) kz2=1
1034  IF (iface == 6) kz1=nz
1035  return
1036 end subroutine facind
1037 
1038 !-----------------------------------------------------------------------
1041 subroutine facev(a,ie,iface,val,nx,ny,nz)
1042  use kinds, only : dp
1043  use size_m, only : lelt
1044  implicit none
1045  integer :: ie, iface, nx, ny, nz
1046  real(DP) :: a(nx,ny,nz,lelt), val
1047 
1048  integer :: kx1, ky1, kz1, kx2, ky2, kz2
1049  integer :: ix, iy, iz
1050 
1051  CALL facind(kx1,kx2,ky1,ky2,kz1,kz2,nx,ny,nz,iface)
1052  DO iz=kz1,kz2
1053  DO iy=ky1,ky2
1054  DO ix=kx1,kx2
1055  a(ix,iy,iz,ie)=val
1056  enddo
1057  enddo
1058  enddo
1059  RETURN
1060 end subroutine facev
1061 !-----------------------------------------------------------------------
subroutine verify
Verify right-handedness of elements. .Verify element-to-element reciprocity of BC's ...
Definition: connect1.F90:801
subroutine verrhe()
Verify right-handedness of given elements. 8 Mar 1989 21:58:26 PFF.
Definition: connect1.F90:891
subroutine dssum(u)
Direct stiffness sum.
Definition: dssum.F90:54
subroutine initds
– Direct Stiffness Initialization Routine – Set up required data for packing data on faces of spect...
Definition: connect1.F90:174
cleaned
Definition: scratch_mod.F90:2
cleaned
Definition: tstep_mod.F90:2
Input parameters from preprocessors.
Definition: input_mod.F90:11
Definition: soln_mod.F90:1
real(dp) function volum0(P1, P2, P3, P0)
Given four points in R , (P1,P2,P3,P0), VOLUM0 returns the volume enclosed by the parallelagram defin...
Definition: connect1.F90:991
subroutine dsset(nx, ny, nz)
Set up arrays IXCN,ESKIP,SKPDAT,NEDG,NOFFST for new NX,NY,NZ.
Definition: connect1.F90:549
Arrays for direct stiffness summation. cleaned.
Definition: topol_mod.F90:3
void exitt()
Definition: comm_mpi.F90:411
subroutine chkaxcb()
Definition: bdry.F90:247
cleaned
Definition: mesh_mod.F90:2
integer function lglel(iel)
subroutine copy(a, b, n)
Definition: math.F90:52
Cleaned.
Definition: zper_mod.F90:2
subroutine genxyzl()
Generate xyz coordinates.
Definition: connect1.F90:712
subroutine setupds(gs_handle, nx, ny, nz, nel, melg, vertex, glo_num)
setup data structures for direct stiffness operations
Definition: dssum.F90:3
cleaned
Definition: parallel_mod.F90:2
cleaned
Definition: mvgeom_mod.F90:2
subroutine setcdof
Definition: subs1.F90:979
subroutine setside
Definition: connect1.F90:808
subroutine setup_topo()
Parallel compatible routine to find connectivity of element structure. On Processor 0: ...
Definition: connect1.F90:12
subroutine facev(a, ie, iface, val, nx, ny, nz)
Assign the value VAL to face(IFACE,IE) of array A. IFACE is the input in the pre-processor ordering s...
Definition: connect1.F90:1041
subroutine gllog(la, lb)
If ANY LA=LB, then ALL LA=LB.
Definition: math.F90:402
subroutine facind(kx1, kx2, ky1, ky2, kz1, kz2, nx, ny, nz, iface)
ifcase in preprocessor notation
Definition: connect1.F90:1019
subroutine setedge()
Initialize EDGE arrays for face and edge specific tasks. .NOTE: Sevaral arrays in common are initiali...
Definition: connect1.F90:290