54 real(rp),
public :: xmin_gl, xmax_gl
55 real(rp),
public :: ymin_gl, ymax_gl
56 real(rp),
public :: zmin_gl, zmax_gl
58 real(rp),
allocatable :: fz(:)
60 integer,
allocatable :: rcdomijk2lcmeshid(:,:,:)
62 logical :: isperiodicx
63 logical :: isperiodicy
64 logical :: isperiodicz
70 procedure :: final => meshcubedom3d_final
71 procedure :: generate => meshcubedom3d_generate
72 procedure :: getmesh2d => meshcubedom3d_getmesh2d
73 procedure :: set_geometric_with_vcoord => meshcubedom3d_set_geometric_with_vcoord
98 dom_xmin, dom_xmax, dom_ymin, dom_ymax, dom_zmin, dom_zmax, &
99 isPeriodicX, isPeriodicY, isPeriodicZ, &
100 refElem, NLocalMeshPerPrc, NprcX, NprcY, &
107 integer,
intent(in) :: NeGX
108 integer,
intent(in) :: NeGY
109 integer,
intent(in) :: NeGZ
110 real(RP),
intent(in) :: dom_xmin
111 real(RP),
intent(in) :: dom_xmax
112 real(RP),
intent(in) :: dom_ymin
113 real(RP),
intent(in) :: dom_ymax
114 real(RP),
intent(in) :: dom_Zmin
115 real(RP),
intent(in) :: dom_zmax
116 logical,
intent(in) :: isPeriodicX
117 logical,
intent(in) :: isPeriodicY
118 logical,
intent(in) :: isPeriodicZ
120 integer,
intent(in) :: NLocalMeshPerPrc
121 integer,
intent(in) :: NprcX
122 integer,
intent(in) :: NprcY
123 integer,
intent(in),
optional :: nproc
124 integer,
intent(in),
optional :: myrank
125 real(RP),
intent(in),
optional :: FZ(NeGZ+1)
135 this%xmin_gl = dom_xmin
136 this%xmax_gl = dom_xmax
137 this%ymin_gl = dom_ymin
138 this%ymax_gl = dom_ymax
139 this%zmin_gl = dom_zmin
140 this%zmax_gl = dom_zmax
141 this%dom_vol = (this%xmax_gl - this%xmin_gl) * (this%ymax_gl - this%ymin_gl) * (this%zmax_gl - this%zmin_gl)
143 this%isPeriodicX = isperiodicx
144 this%isPeriodicY = isperiodicy
145 this%isPeriodicZ = isperiodicz
152 allocate( this%FZ(this%NeGZ+1) )
153 if (
present(fz) )
then
156 this%FZ(1 ) = dom_zmin
157 this%FZ(this%NeGZ+1) = dom_zmax
158 dz = (dom_zmax - dom_zmin) / dble(this%NeGZ)
160 this%FZ(k) = this%FZ(k-1) + dz
170 call this%refElem2D%Init( this%refElem3D%PolyOrder_h, refelem%IsLumpedMatrix() )
172 call this%mesh2D%Init( this%NeGX, this%NeGY, dom_xmin, dom_xmax, dom_ymin, dom_ymax, &
173 isperiodicx, isperiodicy, this%refElem2D, nlocalmeshperprc, &
174 nprcx, nprcy, nproc, myrank )
181 subroutine meshcubedom3d_final( this )
188 if (this%isGenerated)
then
189 if (
allocated(this%rcdomIJK2LCMeshID) )
then
190 deallocate( this%rcdomIJK2LCMeshID )
193 if (
allocated( this%FZ ) )
deallocate( this%FZ )
196 call this%mesh2D%Final()
197 call this%refElem2D%Final()
202 end subroutine meshcubedom3d_final
205 subroutine meshcubedom3d_getmesh2d( this, ptr_mesh2D )
208 class(
meshbase2d),
pointer,
intent(out) :: ptr_mesh2D
211 ptr_mesh2d => this%mesh2D
213 end subroutine meshcubedom3d_getmesh2d
217 subroutine meshcubedom3d_generate( this )
225 integer :: tileID_table(this%LOCAL_MESH_NUM, this%PRC_NUM)
226 integer :: panelID_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
227 integer :: pi_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
228 integer :: pj_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
229 integer :: pk_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
231 integer :: TILE_NUM_PER_PANEL
235 tile_num_per_panel = this%LOCAL_MESH_NUM_global / 1
240 call messhcubedom3d_assigndomid( this, &
241 tileid_table, panelid_table, &
242 pi_table, pj_table, pk_table )
246 do n=1, this%LOCAL_MESH_NUM
247 mesh => this%lcmesh_list(n)
248 tileid = tileid_table(n, mesh%PRC_myrank+1)
250 call meshcubedom3d_setuplocaldom( mesh, &
251 tileid, panelid_table(tileid), &
252 pi_table(tileid), pj_table(tileid), pk_table(tileid), this%NprcX, this%NprcY, this%NprcZ, &
253 this%xmin_gl, this%xmax_gl, this%ymin_gl, this%ymax_gl, this%zmin_gl, this%zmax_gl, &
254 this%NeGX/this%NprcX, this%NeGY/this%NprcY, this%NeGZ/this%NprcZ, this%FZ(:) )
257 tileid, panelid_table(tileid), &
258 pi_table(tileid), pj_table(tileid), this%NprcX, this%NprcY, &
259 this%xmin_gl, this%xmax_gl, this%ymin_gl, this%ymax_gl, &
260 this%NeGX/this%NprcX, this%NeGY/this%NprcY )
262 call mesh%SetLocalMesh2D( this%mesh2D%lcmesh_list(n) )
277 call this%mesh2D%AssignDomID( &
278 tileid_table, panelid_table, &
281 this%isGenerated = .true.
282 this%mesh2D%isGenerated = .true.
284 deallocate( this%FZ )
287 end subroutine meshcubedom3d_generate
290 subroutine meshcubedom3d_set_geometric_with_vcoord(this, lcdomID, GsqrtV_lc, zlev_lc, G13_lc, G23_lc)
293 integer,
intent(in) :: lcdomID
294 real(RP),
intent(in) :: GsqrtV_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
295 real(RP),
intent(in) :: zlev_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
296 real(RP),
intent(in) :: G13_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
297 real(RP),
intent(in) :: G23_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
303 lcmesh => this%lcmesh_list(lcdomid)
307 do ke=lcmesh%NeS, lcmesh%NeE
308 lcmesh%zlev(:,ke) = zlev_lc(:,ke)
311 do ke=lcmesh%NeS, lcmesh%NeA
312 lcmesh%Gsqrt(:,ke) = gsqrtv_lc(:,ke)
313 lcmesh%GI3(:,ke,1) = g13_lc(:,ke)
314 lcmesh%GI3(:,ke,2) = g23_lc(:,ke)
319 end subroutine meshcubedom3d_set_geometric_with_vcoord
324 subroutine meshcubedom3d_setuplocaldom( lcmesh, &
326 i, j, k, NprcX, NprcY, NprcZ, &
327 dom_xmin, dom_xmax, dom_ymin, dom_ymax, dom_zmin, dom_zmax, &
342 integer,
intent(in) :: tileID
343 integer,
intent(in) :: panelID
344 integer,
intent(in) :: i, j, k
345 integer,
intent(in) :: NprcX, NprcY, NprcZ
346 real(RP),
intent(in) :: dom_xmin, dom_xmax
347 real(RP),
intent(in) :: dom_ymin, dom_ymax
348 real(RP),
intent(in) :: dom_Zmin, dom_zmax
349 integer,
intent(in) :: NeX, NeY, NeZ
350 real(RP),
intent(in) :: FZ(NeZ*NprcZ+1)
353 real(RP) :: delx, dely
354 real(RP) :: FZ_lc(NeZ+1)
356 integer :: ii, jj, kk
360 elem => lcmesh%refElem3D
361 lcmesh%tileID = tileid
362 lcmesh%panelID = panelid
365 lcmesh%Ne = nex * ney * nez
366 lcmesh%Nv = (nex + 1)*(ney + 1)*(nez + 1)
368 lcmesh%NeE = lcmesh%Ne
369 lcmesh%NeA = lcmesh%Ne + 2*(nex + ney)*nez + 2*nex*ney
375 lcmesh%Ne2D = nex * ney
376 lcmesh%Ne2DA = nex * ney + 2*(nex + ney)
379 delx = (dom_xmax - dom_xmin)/dble(nprcx)
380 dely = (dom_ymax - dom_ymin)/dble(nprcy)
381 fz_lc(:) = fz((k-1)*nez+1:k*nez+1)
382 lcmesh%xmin = dom_xmin + (i-1)*delx
383 lcmesh%xmax = dom_xmin + i *delx
384 lcmesh%ymin = dom_ymin + (j-1)*dely
385 lcmesh%ymax = dom_ymin + j *dely
386 lcmesh%zmin = fz_lc(1)
387 lcmesh%zmax = fz_lc(nez+1)
390 allocate( lcmesh%pos_ev(lcmesh%Nv,3) )
391 allocate( lcmesh%EToV(lcmesh%Ne,elem%Nv) )
392 allocate( lcmesh%EToE(lcmesh%Ne,elem%Nfaces) )
393 allocate( lcmesh%EToF(lcmesh%Ne,elem%Nfaces) )
394 allocate( lcmesh%BCType(lcmesh%refElem%Nfaces,lcmesh%Ne) )
395 allocate( lcmesh%VMapM(elem%NfpTot, lcmesh%Ne) )
396 allocate( lcmesh%VMapP(elem%NfpTot, lcmesh%Ne) )
397 allocate( lcmesh%MapM(elem%NfpTot, lcmesh%Ne) )
398 allocate( lcmesh%MapP(elem%NfpTot, lcmesh%Ne) )
400 allocate( lcmesh%EMap3Dto2D(lcmesh%Ne) )
407 lcmesh%NeX, lcmesh%xmin, lcmesh%xmax, &
408 lcmesh%NeY, lcmesh%ymin, lcmesh%ymax, &
409 lcmesh%NeZ, lcmesh%zmin, lcmesh%zmax, fz=fz_lc )
416 lcmesh%EToV, lcmesh%Ne, elem%Nfaces )
420 lcmesh%pos_en, lcmesh%pos_ev, lcmesh%EToE, lcmesh%EtoF, lcmesh%EtoV, &
421 elem%Fmask_h, elem%Fmask_v, lcmesh%Ne, lcmesh%Nv, elem%Np, elem%Nfp_h, elem%Nfp_v, elem%NfpTot, &
422 elem%Nfaces_h, elem%Nfaces_v, elem%Nfaces )
425 lcmesh%pos_en, lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax, lcmesh%zmin, lcmesh%zmax, &
426 elem%Fmask_h, elem%Fmask_v, lcmesh%Ne, lcmesh%Nv, elem%Np, elem%Nfp_h, elem%Nfp_v, elem%NfpTot, &
427 elem%Nfaces_h, elem%Nfaces_v, elem%Nfaces )
434 ke = ii + (jj-1) * lcmesh%NeX + (kk-1) * lcmesh%NeX * lcmesh%NeY
435 lcmesh%EMap3Dto2D(ke) = ii + (jj-1) * lcmesh%NeX
441 end subroutine meshcubedom3d_setuplocaldom
444 subroutine messhcubedom3d_assigndomid( this, &
445 tileID_table, panelID_table, &
446 pi_table, pj_table, pk_table )
453 integer,
intent(out) :: tileID_table(this%LOCAL_MESH_NUM, this%PRC_NUM)
454 integer,
intent(out) :: panelID_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
455 integer,
intent(out) :: pi_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
456 integer,
intent(out) :: pj_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
457 integer,
intent(out) :: pk_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
462 integer :: is_lc, js_lc, ks_lc
463 integer :: ilc_count, jlc_count, klc_count
464 integer :: ilc, jlc, klc
470 panelid_table, pi_table, pj_table, pk_table, &
471 this%tileID_globalMap, this%tileFaceID_globalMap, this%tilePanelID_globalMap, &
472 this%LOCAL_MESH_NUM_global, 6, 8, &
473 this%isPeriodicX, this%isPeriodicY, this%isPeriodicZ, &
474 this%NprcX, this%NprcY, this%NprcZ )
479 do n=1, this%LOCAL_MESH_NUM
480 tileid = n + (p-1)*this%LOCAL_MESH_NUM
481 lcmesh => this%lcmesh_list(n)
483 tileid_table(n,p) = tileid
484 this%tileID_global2localMap(tileid) = n
485 this%PRCRank_globalMap(tileid) = p - 1
488 if ( this%PRCRank_globalMap(tileid) == lcmesh%PRC_myrank )
then
490 is_lc = pi_table(tileid); ilc_count = 1
491 js_lc = pj_table(tileid); jlc_count = 1
492 ks_lc = pk_table(tileid); klc_count = 1
494 if(is_lc < pi_table(tileid)) ilc_count = ilc_count + 1
495 if(js_lc < pj_table(tileid)) jlc_count = jlc_count + 1
496 if(ks_lc < pk_table(tileid)) klc_count = klc_count + 1
501 allocate( this%rcdomIJK2LCMeshID(ilc_count,jlc_count,klc_count) )
505 this%rcdomIJK2LCMeshID(ilc,jlc,klc) = ilc + (jlc - 1)*ilc_count + (klc - 1)*ilc_count*jlc_count
511 end subroutine messhcubedom3d_assigndomid
514 subroutine meshcubedom3d_coord_conv( x, y, z, xX, xY, xZ, yX, yY, yZ, zX, zY, zZ, &
520 real(rp),
intent(out) :: x(elem%np), y(elem%np), z(elem%np)
521 real(rp),
intent(out) :: xx(elem%np), xy(elem%np), xz(elem%np)
522 real(rp),
intent(out) :: yx(elem%np), yy(elem%np), yz(elem%np)
523 real(rp),
intent(out) :: zx(elem%np), zy(elem%np), zz(elem%np)
524 real(rp),
intent(in) :: vx(elem%nv), vy(elem%nv), vz(elem%nv)
528 x(:) = vx(1) + 0.5_rp*(elem%x1(:) + 1.0_rp)*(vx(2) - vx(1))
529 y(:) = vy(1) + 0.5_rp*(elem%x2(:) + 1.0_rp)*(vy(3) - vy(1))
530 z(:) = vz(1) + 0.5_rp*(elem%x3(:) + 1.0_rp)*(vz(5) - vz(1))
532 xx(:) = 0.5_rp*(vx(2) - vx(1))
536 yy(:) = 0.5_rp*(vy(3) - vy(1))
540 zz(:) = 0.5_rp*(vz(5) - vz(1))
546 subroutine meshcubedom3d_calc_normal( normal_fn, &
547 Escale_f, fid_h, fid_v, elem )
552 real(rp),
intent(out) :: normal_fn(elem%nfptot,3)
553 integer,
intent(in) :: fid_h(elem%nfp_h,elem%nfaces_h)
554 integer,
intent(in) :: fid_v(elem%nfp_v,elem%nfaces_v)
555 real(rp),
intent(in) :: escale_f(elem%nfptot,3,3)
561 normal_fn(fid_h(:,1),d) = - escale_f(fid_h(:,1),2,d)
562 normal_fn(fid_h(:,2),d) = + escale_f(fid_h(:,2),1,d)
563 normal_fn(fid_h(:,3),d) = + escale_f(fid_h(:,3),2,d)
564 normal_fn(fid_h(:,4),d) = - escale_f(fid_h(:,4),1,d)
566 normal_fn(fid_v(:,1),d) = - escale_f(fid_v(:,1),3,d)
567 normal_fn(fid_v(:,2),d) = + escale_f(fid_v(:,2),3,d)
571 end subroutine meshcubedom3d_calc_normal
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / Element / Quadrilateral
module FElib / Mesh / Local 3D
module FElib / Mesh / Local, Base
integer, parameter, public bctype_interior
module FElib / Mesh / Base 2D
subroutine, public meshbase2d_final(this)
subroutine, public meshbase2d_init(this, refelem, nlocalmeshperprc, nprocs, myrank)
subroutine, public meshbase2d_setgeometricinfo(lcmesh, coord_conv, calc_normal)
module FElib / Mesh / Base 3D
subroutine, public meshbase3d_init(this, refelem, nlocalmeshperprc, nsidetile, nproc, myrank)
subroutine, public meshbase3d_final(this)
subroutine, public meshbase3d_setgeometricinfo(lcmesh, coord_conv, calc_normal)
module FElib / Mesh / Cubic 3D domain
subroutine meshcubedom3d_init(this, negx, negy, negz, dom_xmin, dom_xmax, dom_ymin, dom_ymax, dom_zmin, dom_zmax, isperiodicx, isperiodicy, isperiodicz, refelem, nlocalmeshperprc, nprcx, nprcy, nproc, myrank, fz)
Initialize an object to manage a cubic 3D domain.
subroutine, public meshcubedom3d_coord_conv(x, y, z, xx, xy, xz, yx, yy, yz, zx, zy, zz, vx, vy, vz, elem)
module FElib / Mesh / Rectangle 2D domain
subroutine, public meshrectdom2d_setuplocaldom(lcmesh, tileid, panelid, i, j, nprcx, nprcy, dom_xmin, dom_xmax, dom_ymin, dom_ymax, nex, ney)
module FElib / Mesh / utility for 3D mesh
subroutine, public meshutil3d_buildglobalmap(panelid_table, pi_table, pj_table, pk_table, tileid_map, tilefaceid_map, tilepanelid_map, ntile, ntileface, ntilevertex, isperiodicx, isperiodicy, isperiodicz, ne_x, ne_y, ne_z)
subroutine, public meshutil3d_buildinteriormap(vmapm, vmapp, mapm, mapp, pos_en, pos_ev, etoe, etof, etov, fmask_h, fmask_v, ne, nv, np, nfp_h, nfp_v, nfptot, nfaces_h, nfaces_v, nfaces)
subroutine, public meshutil3d_genconnectivity(etoe, etof, etov, ne, nfaces)
subroutine, public meshutil3d_gencubedomain(pos_v, etov, ke_x, xmin, xmax, ke_y, ymin, ymax, ke_z, zmin, zmax, fz)
subroutine, public meshutil3d_genpatchboundarymap(vmapb, mapb, vmapp, pos_en, xmin, xmax, ymin, ymax, zmin, zmax, fmask_h, fmask_v, ne, nv, np, nfp_h, nfp_v, nfptot, nfaces_h, nfaces_v, nfaces)
Derived type representing a 3D reference element.
Derived type representing a hexahedral element.
Derived type representing a quadrilateral element.
Derived type to manage a local 3D computational domain.