35 $
'module ['//trim(map2d_name)//
'] already registered')
44 $
'parent module ['//
'FRAME'//
'] not registered')
49 $
'Mapping 3D mesh to 2D section')
54 $
'MAP2D_TOT',
'2D mapping total time',.false.)
60 ltim = dnekclock() - ltim
93 if (map2d_ifinit)
then
95 $
'module ['//trim(map2d_name)//
'] already initiaised.')
102 call mntr_log(map2d_id,lp_vrb,
'Creating 2D mesh')
109 ltim = dnekclock() - ltim
127 integer lctrs1 ,lctrs2
128 parameter(lctrs1=3,lctrs2=2*lx1*ly1*lz1*lelt)
129 real ctrs(lctrs1,lctrs2)
131 integer ninseg(lctrs2)
133 integer owner(lctrs2)
134 logical ifseg(lctrs2)
137 common /scruz/ cell, ninseg, ind, owner
145 parameter(ltol = 1.0e-4)
151 integer iglsum, iglmin, iglmax
157 character*3 str1, str2
169 call mntr_log(map2d_id,lp_inf,
'3D=>2D mapping begin')
172 call mntr_log(map2d_id,lp_vrb,
'Local 3D=>2D mapping')
178 call user_map2d_get(map2d_idir,ctrs,cell,lctrs1,lctrs2,nelsort,
179 $ map2d_xm1,map2d_ym1,ierr)
183 if (map2d_idir.gt.ldim)
call mntr_abort(map2d_id,
184 $
'Wrong mapping direction')
187 if (lctrs2.lt.nelsort)
then
194 if (nelt.lt.nelsort)
then
200 $
'More element to sort than local elements')
204 $ lctrs1,lctrs2,nseg,nelsort,ltol)
211 call ifill(map2d_lmap,-1,nelt)
218 map2d_lmap(cell(jl)) = iseg
227 write(str1,
'(i3.3)') nid
228 write(str2,
'(i3.3)') icalldl
229 open(unit=iunit,
file=
'map2d_loc.txt'//str1//
'i'//str2)
231 write(iunit,*) nseg, nelv
232 write(iunit,*)
'Coordinates'
234 write(iunit,*) il, ctrs(:,il)
236 write(iunit,*)
'Mapping'
238 write(iunit,*) il, map2d_lmap(il)
243 call mntr_log(map2d_id,lp_vrb,
'Global 3D=>2D mapping')
248 call ifill(map2d_gmap,-1,nseg)
249 call ifill(map2d_own,-1,nseg)
252 $ lctrs1,lctrs2,nseg,ltol)
257 if (map2d_own(il).eq.nid) map2d_lown = map2d_lown + 1
260 map2d_gnum = iglsum(map2d_lown,1)
262 il = iglmin(map2d_lown,1)
263 jl = iglmax(map2d_lown,1)
267 $
'Global number of unique 2D elements: ',map2d_gnum)
268 call mntr_log(map2d_id,lp_vrb,
'Owned 2D element imbalance:')
269 call mntr_logi(map2d_id,lp_vrb,
' min: ',il)
270 call mntr_logi(map2d_id,lp_vrb,
' max: ',jl)
275 write(str1,
'(i3.3)') nid
276 write(str2,
'(i3.3)') icalldl
277 open(unit=iunit,
file=
'map2d_glob.txt'//str1//
'i'//str2)
279 write(iunit,*) map2d_gnum, map2d_lown
280 write(iunit,*)
'Mapping'
282 write(iunit,*) il, map2d_gmap(il),map2d_own(il)
289 call mntr_log(map2d_id,lp_inf,
'3D=>2D mapping end')
292 ltim = dnekclock() - ltim
310 $ lctrs1,lctrs2,nseg,nelsort,tol)
316 integer lctrs1,lctrs2
317 real ctrs(lctrs1,lctrs2)
323 integer ninseg(lctrs2)
325 logical ifseg(lctrs2)
354 call tuple_sort(ctrs(1,il),lctrs1,ninseg(iseg),jl,1,
356 call iswap_ip(cell(il),ind,ninseg(iseg))
357 il = il + ninseg(iseg)
362 if (abs(ctrs(jl,il)-ctrs(jl,il-1)).gt.
363 $ tol*min(ctrs(3,il),ctrs(3,il-1)))
374 ninseg(nseg) = ninseg(nseg) + 1
387 ctrs(il,iseg) = ctrs(il,jl)
389 jl = jl + ninseg(iseg)
407 $ lctrs1,lctrs2,nseg,tol)
416 integer lctrs1,lctrs2
417 real ctrs(lctrs1,lctrs2)
421 integer owner(lctrs2)
423 integer ninseg(lctrs2)
425 logical ifseg(lctrs2)
433 real lctrs(lctrs1,LELT)
439 parameter(igpass_max = 100)
444 integer msg_id1, msg_id2
451 integer ipass, iseg, il, jl, kl
460 integer iglsum, irecv, iglmin, iglmax
465 call copy(lctrs,ctrs,il)
468 csteps=int(log(np+0.0)/log(2.0))
469 if(np.gt.2**csteps) csteps=csteps+1
475 umrkgl = iglsum(nseg,1)
477 nsort = min(nseg,lwork)
494 write(str,
'(i3.3)') igpass
496 $
'Cycle '//str//
'; globally unmarked = ',umrkgl)
506 if (srcid.lt.0) srcid = srcid + np
507 if (dstid.ge.np) dstid = dstid - np
511 msg_id1 = irecv(0,cnsort,len)
514 call csend(0,nsort,len,dstid,0)
521 len = wdsize*lctrs1*cnsort
522 msg_id1 = irecv(1,ctrs(1,nsort+1),len)
525 msg_id2 = irecv(2,owner(nsort+1),len)
528 len = wdsize*lctrs1*nsort
529 call csend(1,ctrs,len,dstid,0)
532 call csend(2,owner,len,dstid,0)
536 do il=nsort + 1,nsort + cnsort
541 nsort = nsort + cnsort
564 call tuple_sort(ctrs(1,il),lctrs1,ninseg(iseg),
567 call iswap_ip(cell(il),ind,ninseg(iseg))
568 call iswap_ip(owner(il),ind,ninseg(iseg))
569 il = il + ninseg(iseg)
574 if (abs(ctrs(jl,il)-ctrs(jl,il-1)).gt.
575 $ tol*min(ctrs(3,il),ctrs(3,il-1)))
586 ninseg(nseg) = ninseg(nseg) + 1
598 ctrs(il,iseg) = ctrs(il,jl)
600 jl = jl + ninseg(iseg)
606 owner(iseg) = owner(jl)
610 if (owner(iseg).gt.owner(jl)) owner(iseg) = owner(jl)
619 cell(iseg) = cell(jl)
625 if (cell(iseg).ne.-1) kl = kl+1
627 if (cell(iseg).lt.cell(jl)) cell(iseg) = cell(jl)
628 if (cell(jl).ne.-1) kl = kl+1
631 if (kl.gt.1) ierror = ierror +1
636 $
'Too many local elements in section')
639 nsort = min(nseg,lwork)
647 if (cell(il).ne.-1)
then
649 if(map2d_gmap(cell(il)).ne.-1)
then
652 map2d_gmap(cell(il)) = nsorted + il
653 map2d_own(cell(il)) = owner(il)
659 $
'Element already assigned')
662 nsorted = nsorted + nsort
667 if(map2d_gmap(il).eq.-1)
then
670 if (nseg.le.lwork)
then
671 call copy(ctrs(1,nseg),lctrs(1,il),lctrs1)
679 umrkgl = iglsum(nseg,1)
681 if (umrkgl.eq.0)
exit
684 nsort = min(nseg,lwork)
690 if (igpass.gt.igpass_max)
then
691 call mntr_abort(map2d_id,
'Max iterations exceeded')
712 real rtmp(lx1,lz1,lelt,2)
723 call ifill(imark, -1,nelv)
727 if (imark(el).eq.-1)
then
729 call copy(rtmp(1,1,el,1),map2d_xm1(1,1,il),len)
730 call copy(rtmp(1,1,el,2),map2d_ym1(1,1,il),len)
737 call copy(map2d_xm1,rtmp(1,1,1,1),len)
738 call copy(map2d_ym1,rtmp(1,1,1,2),len)
742 write(str,
'(i2.2)') nid
744 open(unit=iunit,
file=
'map2d_init_coord.txt'//str)
745 write(iunit,*) nid, nelv, map2d_idir, map2d_lnum
747 write(iunit,*)
'Element ', el
750 write(iunit,*) il,jl,map2d_xm1(il,jl,el),
751 $ map2d_ym1(il,jl,el)
subroutine csend(mtype, buf, len, jnid, jpid)
subroutine map2d_register()
Register 2D mapping routines.
subroutine map2d_get_global(ctrs, owner, cell, ninseg, ind, ifseg, lctrs1, lctrs2, nseg, tol)
Get global 3D=>2D mapping.
subroutine map2d_init()
Initilise map2d module.
subroutine map2d_get_local(ctrs, cell, ninseg, ind, ifseg, lctrs1, lctrs2, nseg, nelsort, tol)
Get local 3D=>2D mapping.
subroutine map2d_get()
Get 3D to 2D element mapping.
subroutine map2d_init_coord
Generate 2D mesh out of 3D one.
subroutine mntr_logi(mid, priority, logs, ivar)
Write log message adding single integer.
subroutine mntr_tmr_is_name_reg(mid, mname)
Check if timer name is registered and return its id.
subroutine mntr_warn(mid, logs)
Write warning message.
subroutine mntr_tmr_add(mid, icount, time)
Check if timer id is registered. This operation is performed locally.
subroutine mntr_mod_is_name_reg(mid, mname)
Check if module name is registered and return its id.
subroutine mntr_abort(mid, logs)
Abort simulation.
subroutine mntr_log(mid, priority, logs)
Write log message.
subroutine mntr_mod_reg(mid, pmid, mname, mdscr)
Register new module.
subroutine mntr_tmr_reg(mid, pmid, modid, mname, mdscr, ifsum)
Register new timer.
subroutine mntr_check_abort(mid, ierr, logs)
Abort simulation.
subroutine ifill(ia, ib, n)
subroutine iswap_ip(x, p, n)
subroutine tuple_sort(a, lda, n, key, nkey, ind, aa)