35 Ke_x, xmin, xmax, Ke_y, ymin, ymax )
39 integer,
intent(in) :: ke_x
40 real(rp),
intent(in) :: xmin, xmax
41 integer,
intent(in) :: ke_y
42 real(rp),
intent(in) :: ymin, ymax
44 real(rp),
intent(out) :: pos_v((ke_x+1)*(ke_y+1),2)
45 integer,
intent(out) :: etov(ke_x*ke_y,4)
58 pos_v(n,1) = (xmax - xmin)*dble(i - 1)/dble(nvx - 1) + xmin
59 pos_v(n,2) = (ymax - ymin)*dble(j - 1)/dble(nvy - 1) + ymin
66 etov(n,1:4) = (j-1)*nvx + &
68 & i + nvx, i+1 + nvx /)
100 integer,
intent(in) :: ne
101 integer,
intent(in) :: nfaces
102 integer,
intent(out) :: etoe(ne, nfaces)
103 integer,
intent(out) :: etof(ne, nfaces)
104 integer,
intent(in) :: etov(ne,4)
106 integer :: nodes(ne*nfaces,2)
107 integer(kind=8) :: face_ids(ne*nfaces)
114 integer :: nnodes_row
115 integer :: matchl(2,3), matchr(2,3)
117 real(rp) :: etoe_1d(ne*nfaces)
118 real(rp) :: etof_1d(ne*nfaces)
120 integer :: spnodetonode(3,ne*nfaces)
121 integer :: spnodetonoderowtmp(3,ne*nfaces)
122 integer :: sort_indx(ne*nfaces)
123 integer(kind=8) :: sorted_faceid(ne*nfaces)
126 nnodes = maxval( etov )
127 nnodes_row =
size(nodes,1)
131 nodes(ke ,:) = etov(ke,(/ 1, 2 /))
132 nodes(ke+ne ,:) = etov(ke,(/ 2, 4 /))
133 nodes(ke+2*ne,:) = etov(ke,(/ 4, 3 /))
134 nodes(ke+3*ne,:) = etov(ke,(/ 3, 1 /))
139 if (nodes(n,1) > nodes(n,2) )
then
141 nodes(n,1) = nodes(n,2)
151 etof(ke,:) = (/ 1, 2, 3, 4 /)
154 face_ids(:) = nodes(:,1)*nnodes + nodes(:,2) + 1
159 spnodetonode(:,n) = (/ n, etoe(ke,f), etof(ke,f) /)
160 sorted_faceid(n) = face_ids(n)
168 spnodetonoderowtmp(:,:) = spnodetonode(:,:)
170 spnodetonode(:,n) = spnodetonoderowtmp(:,sort_indx(n))
177 if ( sorted_faceid(n) - sorted_faceid(n+1) == 0 )
then
178 matchl(:,:) = transpose( spnodetonode(:,(/ n, n+1 /)) )
179 matchr(:,:) = transpose( spnodetonode(:,(/ n+1, n /)) )
181 etoe_1d(matchl(:,1)) = matchr(:,2)
182 etof_1d(matchl(:,1)) = matchr(:,3)
189 if ( etoe_1d(n) /= -1 )
then
190 etoe(ke,f) = etoe_1d(n)
191 etof(ke,f) = etof_1d(n)
212 pos_en, pos_ev, EtoE, EtoF, EtoV, Fmask, Ne, Np, Nfp, Nfaces, Nv)
216 integer,
intent(in) :: ne
217 integer,
intent(in) :: np
218 integer,
intent(in) :: nfp
219 integer,
intent(in) :: nfaces
220 integer,
intent(in) :: nv
222 integer,
intent(out) :: vmapm(nfp,nfaces,ne)
223 integer,
intent(out) :: vmapp(nfp,nfaces,ne)
224 integer,
intent(out) :: mapm(nfp,nfaces,ne)
225 integer,
intent(out) :: mapp(nfp,nfaces,ne)
227 real(rp),
intent(in) :: pos_en(np,ne,2)
228 real(rp),
intent(in) :: pos_ev(nv,2)
229 integer,
intent(in) :: etoe(ne, nfaces)
230 integer,
intent(in) :: etof(ne, nfaces)
231 integer,
intent(in) :: etov(ne, 4)
232 integer,
intent(in) :: fmask(nfp,4)
235 integer :: ke, ke1, ke2
241 integer :: nodeids(np,ne)
242 real(rp) :: x1(nfp,nfp), x2(nfp,nfp)
243 real(rp) :: y1(nfp,nfp), y2(nfp,nfp)
244 real(rp) :: dist(nfp,nfp)
245 real(rp) :: x(np*ne), y(np*ne)
247 integer :: mindist_indx(1)
256 x(n) = pos_en(p,ke,1)
257 y(n) = pos_en(p,ke,2)
265 n = p + (f-1)*nfp + (ke-1)*nfp*nfaces
268 vmapm(p,f,ke) = nodeids(fmask(p,f),ke)
285 ke2 = etoe(ke1,f1); f2 = etof(ke1,f1)
287 v1 = etov(ke1,f1); v2 = etov(ke1,1+mod(f1,nfaces))
289 x1(:,:) = spread( x(vmapm(:,f1,ke1)), 2, nfp )
290 x2(:,:) = spread( x(vmapm(:,f2,ke2)), 1, nfp )
291 y1(:,:) = spread( y(vmapm(:,f1,ke1)), 2, nfp )
292 y2(:,:) = spread( y(vmapm(:,f2,ke2)), 1, nfp )
294 dist(:,:) = (x1(:,:) - x2(:,:))**2 &
295 + (y1(:,:) - y2(:,:))**2
297 mindist_indx(:) = minloc(dist(idm,:))
298 idp = mindist_indx(1)
299 vmapp(idm,f1,ke1) = vmapm(idp,f2,ke2)
300 mapp(idm,f1,ke1) = idp + (f2-1)*nfp + (ke2-1)*nfp*nfaces
344 pos_en, xmin, xmax, ymin, ymax, Fmask, Ne, Np, Nfp, Nfaces, Nv)
348 integer,
intent(in) :: ne
349 integer,
intent(in) :: np
350 integer,
intent(in) :: nfp
351 integer,
intent(in) :: nfaces
352 integer,
intent(in) :: nv
354 integer,
intent(inout),
allocatable :: vmapb(:)
355 integer,
intent(inout),
allocatable :: mapb(:)
356 integer,
intent(inout) :: vmapp(nfp,nfaces,ne)
358 real(rp),
intent(in) :: pos_en(np,ne,2)
359 real(rp),
intent(in) :: xmin, xmax
360 real(rp),
intent(in) :: ymin, ymax
361 integer,
intent(in) :: fmask(nfp,4)
370 real(rp),
parameter :: node_tol = 1.0e-12_rp
372 real(rp) :: ordinfo(nfp*ne,4)
373 integer :: elemids(nfp*ne,4)
374 integer :: faceids(nfp*ne,4)
375 integer :: counterb(4)
376 integer :: mapb_counter
377 real(rp) :: rdomx, rdomy
382 rdomx = 1.0_rp/(xmax - xmin)
383 rdomy = 1.0_rp/(ymax - ymin)
387 x = sum(pos_en(fmask(:,f),ke,1)/dble(nfp))
388 y = sum(pos_en(fmask(:,f),ke,2)/dble(nfp))
390 call eval_domain_boundary(1, y, ymin, x, ke, f, rdomy)
391 call eval_domain_boundary(2, x, xmax, y, ke, f, rdomx)
392 call eval_domain_boundary(3, y, ymax, x, ke, f, rdomy)
393 call eval_domain_boundary(4, x, xmin, y, ke, f, rdomx)
397 allocate( mapb(sum(counterb*nfp)) )
398 allocate( vmapb(
size(mapb)) )
409 ke = elemids(i,b); f = faceids(i,b)
411 vmapp(j,f,ke) = np*ne + mapb_counter
412 vmapb(mapb_counter) = fmask(j,f) + (ke-1)*np
413 mapb_counter = mapb_counter + 1
431 subroutine eval_domain_boundary(domb_id, r, rbc, ord_info, ke_, f_, normalized_fac)
432 integer,
intent(in) :: domb_id
433 real(rp),
intent(in) :: r
434 real(rp),
intent(in) :: rbc
435 real(rp),
intent(in) :: ord_info
436 integer,
intent(in) :: ke_, f_
437 real(rp),
intent(in) :: normalized_fac
440 if ( abs(r - rbc)*normalized_fac < node_tol )
then
441 counterb(domb_id) = counterb(domb_id) + 1
442 ordinfo(counterb(domb_id),domb_id) = ord_info
443 elemids(counterb(domb_id),domb_id) = ke_
444 faceids(counterb(domb_id),domb_id) = f_
448 end subroutine eval_domain_boundary
454 panelID_table, pi_table, pj_table, &
455 tileID_map, tileFaceID_map, tilePanelID_map, &
456 Ntile, isPeriodicX, isPeriodicY, &
461 integer,
intent(in) :: ntile
462 integer,
intent(out) :: panelid_table(ntile)
463 integer,
intent(out) :: pi_table(ntile)
464 integer,
intent(out) :: pj_table(ntile)
465 integer,
intent(out) :: tileid_map(4,ntile)
466 integer,
intent(out) :: tilefaceid_map(4,ntile)
467 integer,
intent(out) :: tilepanelid_map(4,ntile)
468 logical,
intent(in) :: isperiodicx
469 logical,
intent(in) :: isperiodicy
470 integer,
intent(in) :: ne_x
471 integer,
intent(in) :: ne_y
473 integer :: ntileperpanel
475 integer,
allocatable :: nodesid_2d(:,:)
476 integer,
allocatable :: etov(:,:)
477 integer,
allocatable :: etoe(:,:)
478 integer,
allocatable :: etof(:,:)
481 integer :: tileid, tileid_r
486 ntileperpanel = ntile/1
489 allocate( nodesid_2d(nvx, nvy) )
490 allocate( etov(ntile,4), etoe(ntile,4), etof(ntile,4) )
495 counter = counter + 1
496 nodesid_2d(i,j) = counter
506 panelid_table(tileid) = 1
507 pi_table(tileid) = i; pj_table(tileid) = j
508 etov(tileid,:) = (/ nodesid_2d(i,j ), nodesid_2d(i+1,j ), &
509 & nodesid_2d(i,j+1), nodesid_2d(i+1,j+1)/)
515 tileid_map(:,:) = transpose(etoe)
516 tilefaceid_map(:,:) = transpose(etof)
520 tileid_r = tileid_map(f,tileid)
521 tilepanelid_map(f,tileid) = panelid_table(tileid_r)
525 if (isperiodicx)
then
527 if (pi_table(tileid) == 1 .and. tilefaceid_map(4,tileid) == 4)
then
528 tileid_map(4,tileid) = ne_x + (pj_table(tileid) - 1)*ne_x
529 tilefaceid_map(4,tileid) = 2
531 if (pi_table(tileid) == ne_x .and. tilefaceid_map(2,tileid) == 2)
then
532 tileid_map(2,tileid) = 1 + (pj_table(tileid) - 1)*ne_x
533 tilefaceid_map(2,tileid) = 4
538 if (isperiodicy)
then
540 if (pj_table(tileid) == 1 .and. tilefaceid_map(1,tileid) == 1)
then
541 tileid_map(1,tileid) = pi_table(tileid) + (ne_y - 1)*ne_x
542 tilefaceid_map(1,tileid) = 3
544 if (pj_table(tileid) == ne_y .and. tilefaceid_map(3,tileid) == 3)
then
545 tileid_map(3,tileid) = pi_table(tileid)
546 tilefaceid_map(3,tileid) = 1
subroutine, public meshutil2d_buildinteriormap(vmapm, vmapp, mapm, mapp, pos_en, pos_ev, etoe, etof, etov, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutil2d_buildglobalmap(panelid_table, pi_table, pj_table, tileid_map, tilefaceid_map, tilepanelid_map, ntile, isperiodicx, isperiodicy, ne_x, ne_y)
subroutine, public meshutil2d_genpatchboundarymap(vmapb, mapb, vmapp, pos_en, xmin, xmax, ymin, ymax, fmask, ne, np, nfp, nfaces, nv)