95 integer,
intent(in) :: ne
96 integer,
intent(in) :: nfaces
97 integer,
intent(out) :: etoe(ne, nfaces)
98 integer,
intent(out) :: etof(ne, nfaces)
99 integer,
intent(in) :: etov(ne,2)
101 integer :: nodes(ne*nfaces,1)
102 integer :: face_ids(ne*nfaces)
103 integer :: spnodetonode(ne*nfaces,4)
110 integer :: spnodetonoderowtmp(4)
111 integer :: nnodes_row
112 integer :: matchl(2,4), matchr(2,4)
114 real(rp) :: etoe_1d(ne*nfaces)
115 real(rp) :: etof_1d(ne*nfaces)
118 nnodes = maxval( etov )
119 nnodes_row =
size(nodes,1)
123 nodes(n ,:) = etov(n,(/ 1 /))
124 nodes(n+ne ,:) = etov(n,(/ 2 /))
132 etof(n,:) = (/ 1, 2 /)
135 face_ids(:) = nodes(:,1) + 1
140 spnodetonode(n,:) = (/ face_ids(n), n, etoe(k,f), etof(k,f) /)
146 do n1=1, nnodes_row-1
147 do n2=n1+1, nnodes_row
148 if (spnodetonode(n1,1) > spnodetonode(n2,1))
then
149 spnodetonoderowtmp(:) = spnodetonode(n1,:)
150 spnodetonode(n1,:) = spnodetonode(n2,:)
151 spnodetonode(n2,:) = spnodetonoderowtmp
164 if ( spnodetonode(n,1) - spnodetonode(n+1,1) == 0 )
then
165 matchl(:,:) = spnodetonode((/ n, n+1 /), :)
166 matchr(:,:) = spnodetonode((/ n+1, n /), :)
168 etoe_1d(matchl(:,2)) = matchr(:,3)
169 etof_1d(matchl(:,2)) = matchr(:,4)
176 if ( etoe_1d(n) /= -1 )
then
177 etoe(k,f) = etoe_1d(n)
178 etof(k,f) = etof_1d(n)
199 pos_en, pos_ev, etoe, etof, etov, fmask, ne, np, nfp, nfaces, nv )
204 integer,
intent(in) :: ne
205 integer,
intent(in) :: np
206 integer,
intent(in) :: nfp
207 integer,
intent(in) :: nfaces
208 integer,
intent(in) :: nv
210 integer,
intent(out) :: vmapm(nfp,nfaces,ne)
211 integer,
intent(out) :: vmapp(nfp,nfaces,ne)
212 integer,
intent(out) :: mapm(nfp,nfaces,ne)
213 integer,
intent(out) :: mapp(nfp,nfaces,ne)
215 real(rp),
intent(in) :: pos_en(np,ne,1)
216 real(rp),
intent(in) :: pos_ev(nv,1)
217 integer,
intent(in) :: etoe(ne, nfaces)
218 integer,
intent(in) :: etof(ne, nfaces)
219 integer,
intent(in) :: etov(ne,2)
220 integer,
intent(in) :: fmask(nfp,2)
229 integer :: nodeids(np,ne)
231 real(rp) :: x1(nfp,nfp), x2(nfp,nfp)
232 real(rp) :: dist(nfp,nfp)
247 n = p + (f-1)*nfp + (k-1)*nfp*nfaces
250 vmapm(p,f,k) = nodeids(fmask(p,f),k)
258 k2 = etoe(k1,f1); f2 = etof(k1,f1)
260 v1 = etov(k1,f1); v2 = etov(k1,1+mod(f1,nfaces))
261 refd2 = (pos_ev(v1,1) - pos_ev(v2,1))**2
263 x1(:,:) = spread( x(vmapm(:,f1,k1)), 2, nfp )
264 x2(:,:) = spread( x(vmapm(:,f2,k2)), 1, nfp )
266 dist(:,:) = (x1 - x2)**2
269 if (dist(idm,idp)/refd2 < 1.0e-14_rp)
then
270 vmapp(idm,f1,k1) = vmapm(idp,f2,k2)
271 mapp(idm,f1,k1) = idp + (f2-1)*nfp + (k2-1)*nfp*nfaces
316 pos_en, xmin, xmax, fmask, ne, np, nfp, nfaces, nv )
320 integer,
intent(in) :: ne
321 integer,
intent(in) :: np
322 integer,
intent(in) :: nfp
323 integer,
intent(in) :: nfaces
324 integer,
intent(in) :: nv
326 integer,
intent(inout),
allocatable :: vmapb(:)
327 integer,
intent(inout),
allocatable :: mapb(:)
328 integer,
intent(inout) :: vmapp(nfp,nfaces,ne)
330 real(rp),
intent(in) :: pos_en(np,ne,1)
331 real(rp),
intent(in) :: xmin, xmax
332 integer,
intent(in) :: fmask(nfp,2)
340 real(rp),
parameter :: node_tol = 1.0e-12_rp
342 integer :: elemids(nfp*ne,2)
343 integer :: faceids(nfp*ne,2)
344 integer :: counterb(2)
345 integer :: mapb_counter
350 rdomx = 1.0_rp/(xmax - xmin)
354 x = sum(pos_en(fmask(:,f),k,1)/dble(nfp))
356 call eval_domain_boundary(1, x, xmin, k, f, rdomx)
357 call eval_domain_boundary(2, x, xmax, k, f, rdomx)
362 allocate( mapb(sum(counterb*nfp)) )
363 allocate( vmapb(
size(mapb)) )
374 k = elemids(i,b); f = faceids(i,b)
376 vmapp(j,f,k) = np*ne + mapb_counter
377 vmapb(mapb_counter) = fmask(j,f) + (k-1)*np
378 mapb_counter = mapb_counter + 1
396 subroutine eval_domain_boundary(domb_id, r, rbc, k_, f_, normalized_fac)
398 integer,
intent(in) :: domb_id
399 real(rp),
intent(in) :: r
400 real(rp),
intent(in) :: rbc
401 integer,
intent(in) :: k_, f_
402 real(rp),
intent(in) :: normalized_fac
405 if ( abs(r - rbc)*normalized_fac < node_tol )
then
406 counterb(domb_id) = counterb(domb_id) + 1
407 elemids(counterb(domb_id),domb_id) = k_
408 faceids(counterb(domb_id),domb_id) = f_
412 end subroutine eval_domain_boundary
417 xperiod, x, fx, fmask, ne, np, nfp, nfaces, nv )
421 integer,
intent(in) :: ne
422 integer,
intent(in) :: np
423 integer,
intent(in) :: nfp
424 integer,
intent(in) :: nfaces
425 integer,
intent(in) :: nv
426 integer,
intent(inout) :: etoe(ne, nfaces)
427 integer,
intent(inout) :: etof(ne, nfaces)
428 integer,
intent(inout) :: vmapp(nfp,nfaces,ne)
429 real(rp),
intent(in) :: xperiod
430 real(rp),
intent(in) :: x(np,ne)
431 real(rp),
intent(in) :: fx(nfp*ne)
432 integer,
intent(in) :: fmask(nfp,4)
442 integer :: vidl(nfp), vidr(nfp)
443 integer :: fidl(nfp), fidr(nfp)
446 real(rp) :: x1(nfp,nfp), x2(nfp,nfp)
447 real(rp) :: dist(nfp,nfp)
449 real(rp),
parameter :: node_tol = 1.0e-12_rp
455 cx1 = sum(x(fmask(:,f1),k1)/dble(nfp))
457 k2 = etoe(k1,f1); f2 = etof(k1,f1)
462 if (etoe(k2,f2) == k2)
then
463 cx2 = sum(x(fmask(:,f2),k2)/dble(nfp))
465 dx_pbc = sqrt( (abs(cx1-cx2)-xperiod)**2 )
467 if (dx_pbc < node_tol)
then
469 etoe(k1,f1) = k2; etoe(k2,f2) = k1
470 etof(k1,f1) = f2; etof(k2,f2) = f1
476 vidl(p) = fmask(p,f1) + (k1-1)*np
477 vidr(p) = fmask(p,f2) + (k2-1)*np
478 fidl(p) = p + (f1-1)*nfp + (k1-1)*nfp*nfaces
479 fidr(p) = p + (f2-1)*nfp + (k2-1)*nfp*nfaces
482 x1(:,:) = spread( fx(fidl(:)), 2, nfp )
483 x2(:,:) = spread( fx(fidr(:)), 1, nfp )
485 dist(:,:) = (abs(x1-x2) -xperiod)**2
489 if (dist(idm,idp) < node_tol)
then
490 vmapp(idm,f1,k1) = vidr(idp)
491 vmapp(idp,f2,k2) = vidl(idm)
521 panelID_table, pi_table, & ! (out)
522 tileid_map, tilefaceid_map, tilepanelid_map, &
525 use scale_prc,
only: prc_ismaster
528 integer,
intent(in) :: ntile
529 integer,
intent(out) :: panelid_table(ntile)
530 integer,
intent(out) :: pi_table(ntile)
531 integer,
intent(out) :: tileid_map(2,ntile)
532 integer,
intent(out) :: tilefaceid_map(2,ntile)
533 integer,
intent(out) :: tilepanelid_map(2,ntile)
535 integer :: ntileperpanel
537 integer,
allocatable :: nodesid_1d(:)
538 integer,
allocatable :: etov(:,:)
539 integer,
allocatable :: etoe(:,:)
540 integer,
allocatable :: etof(:,:)
543 integer :: tileid, tileid_r
549 ntileperpanel = ntile
552 allocate( nodesid_1d(nv) )
553 allocate( etov(ntile,2), etoe(ntile,2), etof(ntile,2) )
558 counter = counter + 1
559 nodesid_1d(i) = counter
568 panelid_table(tileid) = 1
570 etov(tileid,:) = (/ nodesid_1d(i), nodesid_1d(i+1) /)
575 tileid_map(:,:) = transpose(etoe)
576 tilefaceid_map(:,:) = transpose(etof)
580 tileid_r = tileid_map(f,tileid)
581 tilepanelid_map(f,tileid) = panelid_table(tileid_r)
subroutine, public meshutil1d_buildinteriormap(vmapm, vmapp, mapm, mapp, pos_en, pos_ev, etoe, etof, etov, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutil1d_genperiodicboundarymap(etoe, etof, vmapp, xperiod, x, fx, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutil1d_genpatchboundarymap(vmapb, mapb, vmapp, pos_en, xmin, xmax, fmask, ne, np, nfp, nfaces, nv)