FE-Project
Loading...
Searching...
No Matches
scale_mesh_cubedom3d.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / Mesh / Cubic 3D domain
3!!
4!! @par Description
5!! Manage mesh data of cubic 3D domain for element-based methods
6!!
7!! @author Yuta Kawai, Team SCALE
8!<
9#include "scaleFElib.h"
11 !-----------------------------------------------------------------------------
12 !
13 !++ used modules
14 !
15 use scale_io
16 use scale_precision
17 use scale_prc
18
19 use scale_mesh_base3d, only: &
22
23 use scale_mesh_base2d, only: &
26
27 use scale_localmesh_3d, only: &
31
32 use scale_mesh_rectdom2d, only: &
34
36
37 !-----------------------------------------------------------------------------
38 implicit none
39 private
40
41 !-----------------------------------------------------------------------------
42 !
43 !++ Public type & procedure
44 !
45 !> Derived type to manage a cubic 3D computational domain
46 type, extends(meshbase3d), public :: meshcubedom3d
47 integer :: negx !< Number of elements in X direction for the global mesh
48 integer :: negy !< Number of elements in Y direction for the global mesh
49 integer :: negz !< Number of elements in Z direction for the global mesh
50
51 integer :: nprcx !< Number of processes in X direction for domain decomposition
52 integer :: nprcy !< Number of processes in Y direction for domain decomposition
53 integer :: nprcz !< Number of processes in Z direction for domain decomposition
54
55 real(rp), public :: xmin_gl !< Minimum X coordinate of the global domain
56 real(rp), public :: xmax_gl !< Maximum X coordinate of the global domain
57 real(rp), public :: ymin_gl !< Minimum Y coordinate of the global domain
58 real(rp), public :: ymax_gl !< Maximum Y coordinate of the global domain
59 real(rp), public :: zmin_gl !< Minimum Z coordinate of the global domain
60 real(rp), public :: zmax_gl !< Maximum Z coordinate of the global domain
61
62 real(rp), allocatable :: fz(:)
63
64 integer, allocatable :: rcdomijk2lcmeshid(:,:,:)
65
66 logical :: isperiodicx !< Flag whether the domain is periodic in X direction
67 logical :: isperiodicy !< Flag whether the domain is periodic in Y direction
68 logical :: isperiodicz !< Flag whether the domain is periodic in Z direction
69
70 type(meshrectdom2d) :: mesh2d !< 2D mesh for the horizontal plane (X-Y plane)
71 type(quadrilateralelement) :: refelem2d !< Reference element for the 2D mesh
72 contains
73 procedure :: init => meshcubedom3d_init
74 procedure :: final => meshcubedom3d_final
75 procedure :: generate => meshcubedom3d_generate
76 procedure :: getmesh2d => meshcubedom3d_getmesh2d
77 procedure :: set_geometric_with_vcoord => meshcubedom3d_set_geometric_with_vcoord
78 end type meshcubedom3d
79
81
82 !-----------------------------------------------------------------------------
83 !
84 !++ Public parameters & variables
85 !
86
87 !-----------------------------------------------------------------------------
88 !
89 !++ Private procedure
90 !
91
92 !-----------------------------------------------------------------------------
93 !
94 !++ Private parameters & variables
95 !
96
97contains
98!> Initialize an object to manage a cubic 3D domain
99!OCL SERIAL
100 subroutine meshcubedom3d_init( this, &
101 NeGX, NeGY, NeGZ, &
102 dom_xmin, dom_xmax, dom_ymin, dom_ymax, dom_zmin, dom_zmax, &
103 isPeriodicX, isPeriodicY, isPeriodicZ, &
104 refElem, NLocalMeshPerPrc, NprcX, NprcY, &
105 nproc, myrank, &
106 FZ )
107
108 implicit none
109
110 class(meshcubedom3d), intent(inout) :: this
111 integer, intent(in) :: NeGX !< Number of elements in X direction for the global mesh
112 integer, intent(in) :: NeGY !< Number of elements in Y direction for the global mesh
113 integer, intent(in) :: NeGZ !< Number of elements in Z direction for the global mesh
114 real(RP), intent(in) :: dom_xmin !< Minimum X coordinate of the global domain
115 real(RP), intent(in) :: dom_xmax !< Maximum X coordinate of the global domain
116 real(RP), intent(in) :: dom_ymin !< Minimum Y coordinate of the global domain
117 real(RP), intent(in) :: dom_ymax !< Maximum Y coordinate of the global domain
118 real(RP), intent(in) :: dom_zmin !< Minimum Z coordinate of the global domain
119 real(RP), intent(in) :: dom_zmax !< Maximum Z coordinate of the global domain
120 logical, intent(in) :: isPeriodicX !< Flag whether the domain is periodic in X direction
121 logical, intent(in) :: isPeriodicY !< Flag whether the domain is periodic in Y direction
122 logical, intent(in) :: isPeriodicZ !< Flag whether the domain is periodic in Z direction
123 type(hexahedralelement), intent(in), target :: refElem !< Reference element for the 3D mesh
124 integer, intent(in) :: NLocalMeshPerPrc !< Number of local meshes managed by each process
125 integer, intent(in) :: NprcX !< Number of processes in X direction for domain decomposition
126 integer, intent(in) :: NprcY !< Number of processes in Y direction for domain decomposition
127 integer, intent(in), optional :: nproc !< Total number of processes (if not provided, it will be determined from the parallel environment)
128 integer, intent(in), optional :: myrank !< Rank of the current process (if not provided, it will be determined from the parallel environment)
129 real(RP), intent(in), optional :: FZ(NeGZ+1) !< Optional array of Z coordinates for the mesh
130
131 integer :: k
132 real(RP) :: dz
133 !-----------------------------------------------------------------------------
134
135 this%NeGX = negx
136 this%NeGY = negy
137 this%NeGZ = negz
138
139 this%xmin_gl = dom_xmin
140 this%xmax_gl = dom_xmax
141 this%ymin_gl = dom_ymin
142 this%ymax_gl = dom_ymax
143 this%zmin_gl = dom_zmin
144 this%zmax_gl = dom_zmax
145 this%dom_vol = (this%xmax_gl - this%xmin_gl) * (this%ymax_gl - this%ymin_gl) * (this%zmax_gl - this%zmin_gl)
146
147 this%isPeriodicX = isperiodicx
148 this%isPeriodicY = isperiodicy
149 this%isPeriodicZ = isperiodicz
150
151 this%NprcX = nprcx
152 this%NprcY = nprcy
153 this%NprcZ = 1
154
155 !- Fz
156 allocate( this%FZ(this%NeGZ+1) )
157 if ( present(fz) ) then
158 this%FZ(:) = fz(:)
159 else
160 this%FZ(1 ) = dom_zmin
161 this%FZ(this%NeGZ+1) = dom_zmax
162 dz = (dom_zmax - dom_zmin) / dble(this%NeGZ)
163 do k=2, this%NeGZ
164 this%FZ(k) = this%FZ(k-1) + dz
165 end do
166 end if
167
168 !--
169 call meshbase3d_init( this, refelem, nlocalmeshperprc, 6, &
170 nproc, myrank )
171
172 !--- 2D mesh
173
174 call this%refElem2D%Init( this%refElem3D%PolyOrder_h, refelem%IsLumpedMatrix() )
175
176 call this%mesh2D%Init( this%NeGX, this%NeGY, dom_xmin, dom_xmax, dom_ymin, dom_ymax, &
177 isperiodicx, isperiodicy, this%refElem2D, nlocalmeshperprc, &
178 nprcx, nprcy, nproc, myrank )
179
180 return
181 end subroutine meshcubedom3d_init
182
183!> Finalize an object to manage a cubic 3D domain
184!OCL SERIAL
185 subroutine meshcubedom3d_final( this )
186 implicit none
187 class(meshcubedom3d), intent(inout) :: this
188 !-----------------------------------------------------------------------------
189
190 if (this%isGenerated) then
191 if ( allocated(this%rcdomIJK2LCMeshID) ) then
192 !$acc exit data delete( this%rcdomIJK2LCMeshID )
193 deallocate( this%rcdomIJK2LCMeshID )
194 end if
195 else
196 if ( allocated( this%FZ ) ) deallocate( this%FZ )
197 end if
198
199 call this%mesh2D%Final()
200 call this%refElem2D%Final()
201
202 call meshbase3d_final(this)
203
204 return
205 end subroutine meshcubedom3d_final
206
207!OCL SERIAL
208 subroutine meshcubedom3d_getmesh2d( this, ptr_mesh2D )
209 implicit none
210 class(meshcubedom3d), intent(in), target :: this
211 class(meshbase2d), pointer, intent(out) :: ptr_mesh2D
212 !-------------------------------------------------------
213
214 ptr_mesh2d => this%mesh2D
215 return
216 end subroutine meshcubedom3d_getmesh2d
217
218!> Generate a cubic 3D computational domain based on the parameters set in the initialization
219!OCL SERIAL
220 subroutine meshcubedom3d_generate( this )
221 implicit none
222
223 class(meshcubedom3d), intent(inout), target :: this
224
225 integer :: n
226 type(localmesh3d), pointer :: mesh
227
228 integer :: tileID_table(this%LOCAL_MESH_NUM, this%PRC_NUM)
229 integer :: panelID_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
230 integer :: pi_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
231 integer :: pj_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
232 integer :: pk_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
233
234 integer :: TILE_NUM_PER_PANEL
235 integer :: tileID
236 !-----------------------------------------------------------------------------
237
238 tile_num_per_panel = this%LOCAL_MESH_NUM_global / 1
239
240
241 !--- Construct the connectivity of patches (only master node)
242
243 call messhcubedom3d_assigndomid( this, & ! (in)
244 tileid_table, panelid_table, & ! (out)
245 pi_table, pj_table, pk_table ) ! (out)
246
247 !--- Setup local meshes managed by my process
248
249 do n=1, this%LOCAL_MESH_NUM
250 mesh => this%lcmesh_list(n)
251 tileid = tileid_table(n, mesh%PRC_myrank+1)
252
253 call meshcubedom3d_setuplocaldom( mesh, &
254 tileid, panelid_table(tileid), &
255 pi_table(tileid), pj_table(tileid), pk_table(tileid), this%NprcX, this%NprcY, this%NprcZ, &
256 this%xmin_gl, this%xmax_gl, this%ymin_gl, this%ymax_gl, this%zmin_gl, this%zmax_gl, &
257 this%NeGX/this%NprcX, this%NeGY/this%NprcY, this%NeGZ/this%NprcZ, this%FZ(:) )
258
259 call meshrectdom2d_setuplocaldom( this%mesh2D%lcmesh_list(n), &
260 tileid, panelid_table(tileid), &
261 pi_table(tileid), pj_table(tileid), this%NprcX, this%NprcY, &
262 this%xmin_gl, this%xmax_gl, this%ymin_gl, this%ymax_gl, &
263 this%NeGX/this%NprcX, this%NeGY/this%NprcY )
264
265 call mesh%SetLocalMesh2D( this%mesh2D%lcmesh_list(n) )
266 !---
267 ! write(*,*) "** my_rank=", mesh%PRC_myrank
268 ! write(*,*) " tileID:", mesh%tileID
269 ! write(*,*) " pnlID:", mesh%panelID, "-- i,j (within a panel)=", pi_table(tileID), pj_table(tileID)
270 ! write(*,*) " local mesh:", n, "( total", this%LOCAL_MESH_NUM, ")"
271 ! write(*,*) " panel_connect:", this%tilePanelID_globalMap(:,mesh%tileID)
272 ! write(*,*) " tile_connect:", this%tileID_globalMap(:,mesh%tileID)
273 ! write(*,*) " face_connect:", this%tileFaceID_globalMap(:,mesh%tileID)
274 ! write(*,*) " domain size"
275 ! write(*,*) " NeX, NeY:", mesh%NeX, mesh%NeY
276 ! write(*,*) " [X], [Y]:", mesh%xmin, mesh%xmax, ":", mesh%ymin, mesh%ymax
277 end do
278
279 ! To set rcdomIJP2LCMeshID, call AssignDomID for 2D mesh
280 call this%mesh2D%AssignDomID( &
281 tileid_table, panelid_table, & ! (out)
282 pi_table, pj_table ) ! (out)
283
284 this%isGenerated = .true.
285 this%mesh2D%isGenerated = .true.
286
287 return
288 end subroutine meshcubedom3d_generate
289
290 !> Set geometric information of the local mesh with the vertical coordinate transformation
291!OCL SERIAL
292 subroutine meshcubedom3d_set_geometric_with_vcoord(this, lcdomID, GsqrtV_lc, zlev_lc, G13_lc, G23_lc)
293 implicit none
294 class(meshcubedom3d), intent(inout), target :: this
295 integer, intent(in) :: lcdomID
296 real(RP), intent(in) :: GsqrtV_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
297 real(RP), intent(in) :: zlev_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
298 real(RP), intent(in) :: G13_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
299 real(RP), intent(in) :: G23_lc(this%refElem3D%Np,this%lcmesh_list(lcdomID)%NeA)
300
301 integer :: ke, p
302 class(localmesh3d), pointer :: lcmesh
303 integer :: Np
304 !-------------------------------------------------------
305
306 lcmesh => this%lcmesh_list(lcdomid)
307 np = lcmesh%refElem%Np
308
309 !$omp parallel private(ke)
310 !$omp do
311 !$acc parallel present(lcmesh%zlev, lcmesh%Gsqrt, lcmesh%GI3, zlev_lc, GsqrtV_lc, G13_lc, G23_lc)
312 !$acc loop gang
313 do ke=lcmesh%NeS, lcmesh%NeE
314 !$acc loop vector
315 do p=1, np
316 lcmesh%zlev(p,ke) = zlev_lc(p,ke)
317 end do
318 end do
319 !$omp do
320 !$acc loop gang
321 do ke=lcmesh%NeS, lcmesh%NeA
322 !$acc loop vector
323 do p=1, np
324 lcmesh%Gsqrt(p,ke) = gsqrtv_lc(p,ke)
325 lcmesh%GI3(p,ke,1) = g13_lc(p,ke)
326 lcmesh%GI3(p,ke,2) = g23_lc(p,ke)
327 end do
328 end do
329 !$acc end parallel
330 !$omp end parallel
331 !$acc update host(lcmesh%zlev, lcmesh%Gsqrt, lcmesh%GI3)
332
333 return
334 end subroutine meshcubedom3d_set_geometric_with_vcoord
335
336 !- private ------------------------------------------------------
337
338!OCL SERIAL
339 subroutine meshcubedom3d_setuplocaldom( lcmesh, &
340 tileID, panelID, &
341 i, j, k, NprcX, NprcY, NprcZ, &
342 dom_xmin, dom_xmax, dom_ymin, dom_ymax, dom_zmin, dom_zmax, &
343 NeX, NeY, NeZ, &
344 FZ )
345
346 use scale_prof
347 use scale_meshutil_3d, only: &
352
354 implicit none
355
356 type(localmesh3d), intent(inout) :: lcmesh
357 integer, intent(in) :: tileID
358 integer, intent(in) :: panelID
359 integer, intent(in) :: i, j, k
360 integer, intent(in) :: NprcX, NprcY, NprcZ
361 real(RP), intent(in) :: dom_xmin, dom_xmax
362 real(RP), intent(in) :: dom_ymin, dom_ymax
363 real(RP), intent(in) :: dom_Zmin, dom_zmax
364 integer, intent(in) :: NeX, NeY, NeZ
365 real(RP), intent(in) :: FZ(NeZ*NprcZ+1)
366
367 class(elementbase3d), pointer :: elem
368 real(RP) :: delx, dely
369 real(RP) :: FZ_lc(NeZ+1)
370
371 integer :: ii, jj, kk
372 integer :: ke
373 !-----------------------------------------------------------------------------
374
375 elem => lcmesh%refElem3D
376
377 lcmesh%tileID = tileid
378 lcmesh%panelID = panelid
379 !$acc update device(lcmesh%tileID, lcmesh%panelID)
380
381 !--
382 lcmesh%Ne = nex * ney * nez
383 lcmesh%Nv = (nex + 1)*(ney + 1)*(nez + 1)
384 lcmesh%NeS = 1
385 lcmesh%NeE = lcmesh%Ne
386 lcmesh%NeA = lcmesh%Ne + 2*(nex + ney)*nez + 2*nex*ney
387 !$acc update device(lcmesh%Ne, lcmesh%Nv, lcmesh%NeS, lcmesh%NeE, lcmesh%NeA)
388
389 lcmesh%NeX = nex
390 lcmesh%NeY = ney
391 lcmesh%NeZ = nez
392 !$acc update device(lcmesh%NeX, lcmesh%NeY, lcmesh%NeZ)
393
394 lcmesh%Ne2D = nex * ney
395 lcmesh%Ne2DA = nex * ney + 2*(nex + ney)
396 !$acc update device(lcmesh%Ne2D, lcmesh%Ne2DA)
397
398 !--
399 delx = (dom_xmax - dom_xmin)/dble(nprcx)
400 dely = (dom_ymax - dom_ymin)/dble(nprcy)
401 fz_lc(:) = fz((k-1)*nez+1:k*nez+1)
402 lcmesh%xmin = dom_xmin + (i-1)*delx
403 lcmesh%xmax = dom_xmin + i *delx
404 lcmesh%ymin = dom_ymin + (j-1)*dely
405 lcmesh%ymax = dom_ymin + j *dely
406 lcmesh%zmin = fz_lc(1)
407 lcmesh%zmax = fz_lc(nez+1)
408 !$acc update device(lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax, lcmesh%zmin, lcmesh%zmax)
409
410 !-
411 allocate( lcmesh%pos_ev(lcmesh%Nv,3) )
412 allocate( lcmesh%EToV(lcmesh%Ne,elem%Nv) )
413 allocate( lcmesh%EToE(lcmesh%Ne,elem%Nfaces) )
414 allocate( lcmesh%EToF(lcmesh%Ne,elem%Nfaces) )
415 allocate( lcmesh%BCType(lcmesh%refElem%Nfaces,lcmesh%Ne) )
416 allocate( lcmesh%VMapM(elem%NfpTot, lcmesh%Ne) )
417 allocate( lcmesh%VMapP(elem%NfpTot, lcmesh%Ne) )
418 allocate( lcmesh%MapM(elem%NfpTot, lcmesh%Ne) )
419 allocate( lcmesh%MapP(elem%NfpTot, lcmesh%Ne) )
420 !$acc enter data create( lcmesh%pos_ev, lcmesh%EToV, lcmesh%EToE, lcmesh%EToF, lcmesh%BCType, &
421 !$acc lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP )
422
423 allocate( lcmesh%EMap3Dto2D(lcmesh%Ne) )
424 !$acc enter data create( lcmesh%EMap3Dto2D )
425
426 lcmesh%BCType(:,:) = bctype_interior
427 !$acc update device(lcmesh%BCType)
428
429 !----
430
431 call meshutil3d_gencubedomain( lcmesh%pos_ev, lcmesh%EToV, & ! (out)
432 lcmesh%NeX, lcmesh%xmin, lcmesh%xmax, & ! (in)
433 lcmesh%NeY, lcmesh%ymin, lcmesh%ymax, & ! (in)
434 lcmesh%NeZ, lcmesh%zmin, lcmesh%zmax, fz=fz_lc ) ! (in)
435 !$acc update device(lcmesh%pos_ev, lcmesh%EToV)
436
437 !---
438 call meshbase3d_setgeometricinfo( lcmesh, meshcubedom3d_coord_conv, meshcubedom3d_calc_normal )
439
440 !---
441 call meshutil3d_genconnectivity( lcmesh%EToE, lcmesh%EToF, & ! (out)
442 lcmesh%EToV, lcmesh%Ne, elem%Nfaces ) ! (in)
443 !$acc update device(lcmesh%EToE, lcmesh%EToF)
444
445 !---
446 call meshutil3d_buildinteriormap( lcmesh%VmapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP, & ! (out)
447 lcmesh%pos_en, lcmesh%pos_ev, lcmesh%EToE, lcmesh%EtoF, lcmesh%EtoV, & ! (in)
448 elem%Fmask_h, elem%Fmask_v, lcmesh%Ne, lcmesh%Nv, elem%Np, elem%Nfp_h, elem%Nfp_v, elem%NfpTot, & ! (in)
449 elem%Nfaces_h, elem%Nfaces_v, elem%Nfaces ) ! (in)
450
451 call meshutil3d_genpatchboundarymap( lcmesh%VMapB, lcmesh%MapB, lcmesh%VMapP, & !(out)
452 lcmesh%pos_en, lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax, lcmesh%zmin, lcmesh%zmax, & ! (in)
453 elem%Fmask_h, elem%Fmask_v, lcmesh%Ne, lcmesh%Nv, elem%Np, elem%Nfp_h, elem%Nfp_v, elem%NfpTot, & ! (in)
454 elem%Nfaces_h, elem%Nfaces_v, elem%Nfaces ) ! (in)
455 !$acc update device(lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP)
456 !$acc enter data copyin(lcmesh%VMapB, lcmesh%MapB)
457
458 !---
459 !$omp parallel do collapse(2) private(ii,ke)
460 do kk=1, lcmesh%NeZ
461 do jj=1, lcmesh%NeY
462 do ii=1, lcmesh%NeX
463 ke = ii + (jj-1) * lcmesh%NeX + (kk-1) * lcmesh%NeX * lcmesh%NeY
464 lcmesh%EMap3Dto2D(ke) = ii + (jj-1) * lcmesh%NeX
465 end do
466 end do
467 end do
468 !$acc update device(lcmesh%EMap3Dto2D)
469
470 return
471 end subroutine meshcubedom3d_setuplocaldom
472
473!OCL SERIAL
474 subroutine messhcubedom3d_assigndomid( this, &
475 tileID_table, panelID_table, &
476 pi_table, pj_table, pk_table )
477
478 use scale_meshutil_3d, only: &
480 implicit none
481
482 type(meshcubedom3d), target, intent(inout) :: this
483 integer, intent(out) :: tileID_table(this%LOCAL_MESH_NUM, this%PRC_NUM)
484 integer, intent(out) :: panelID_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
485 integer, intent(out) :: pi_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
486 integer, intent(out) :: pj_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
487 integer, intent(out) :: pk_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
488
489 integer :: n
490 integer :: p
491 integer :: tileID
492 integer :: is_lc, js_lc, ks_lc
493 integer :: ilc_count, jlc_count, klc_count
494 integer :: ilc, jlc, klc
495
496 type(localmesh3d), pointer :: lcmesh
497 !-----------------------------------------------------------------------------
498
500 panelid_table, pi_table, pj_table, pk_table, & ! (out)
501 this%tileID_globalMap, this%tileFaceID_globalMap, this%tilePanelID_globalMap, & ! (out)
502 this%LOCAL_MESH_NUM_global, 6, 8, & ! (in)
503 this%isPeriodicX, this%isPeriodicY, this%isPeriodicZ, & ! (in)
504 this%NprcX, this%NprcY, this%NprcZ ) ! (in)
505 !$acc update device(this%tileID_globalMap, this%tileFaceID_globalMap, this%tilePanelID_globalMap)
506
507 !----
508
509 do p=1, this%PRC_NUM
510 do n=1, this%LOCAL_MESH_NUM
511 tileid = n + (p-1)*this%LOCAL_MESH_NUM
512 lcmesh => this%lcmesh_list(n)
513 !-
514 tileid_table(n,p) = tileid
515 this%tileID_global2localMap(tileid) = n
516 this%PRCRank_globalMap(tileid) = p - 1
517
518 !-
519 if ( this%PRCRank_globalMap(tileid) == lcmesh%PRC_myrank ) then
520 if (n==1) then
521 is_lc = pi_table(tileid); ilc_count = 1
522 js_lc = pj_table(tileid); jlc_count = 1
523 ks_lc = pk_table(tileid); klc_count = 1
524 end if
525 if(is_lc < pi_table(tileid)) ilc_count = ilc_count + 1
526 if(js_lc < pj_table(tileid)) jlc_count = jlc_count + 1
527 if(ks_lc < pk_table(tileid)) klc_count = klc_count + 1
528 end if
529 end do
530 end do
531 !$acc update device(this%tileID_global2localMap, this%PRCRank_globalMap)
532
533 allocate( this%rcdomIJK2LCMeshID(ilc_count,jlc_count,klc_count) )
534 do klc=1, klc_count
535 do jlc=1, jlc_count
536 do ilc=1, ilc_count
537 this%rcdomIJK2LCMeshID(ilc,jlc,klc) = ilc + (jlc - 1)*ilc_count + (klc - 1)*ilc_count*jlc_count
538 end do
539 end do
540 end do
541 !$acc enter data copyin(this%rcdomIJK2LCMeshID)
542
543 return
544 end subroutine messhcubedom3d_assigndomid
545
546!OCL SERIAL
547 subroutine meshcubedom3d_coord_conv( x, y, z, xX, xY, xZ, yX, yY, yZ, zX, zY, zZ, &
548 vx, vy, vz, elem )
549
550 implicit none
551
552 type(elementbase3d), intent(in) :: elem
553 real(rp), intent(out) :: x(elem%np), y(elem%np), z(elem%np)
554 real(rp), intent(out) :: xx(elem%np), xy(elem%np), xz(elem%np)
555 real(rp), intent(out) :: yx(elem%np), yy(elem%np), yz(elem%np)
556 real(rp), intent(out) :: zx(elem%np), zy(elem%np), zz(elem%np)
557 real(rp), intent(in) :: vx(elem%nv), vy(elem%nv), vz(elem%nv)
558
559 !-------------------------------------------------
560
561 x(:) = vx(1) + 0.5_rp*(elem%x1(:) + 1.0_rp)*(vx(2) - vx(1))
562 y(:) = vy(1) + 0.5_rp*(elem%x2(:) + 1.0_rp)*(vy(3) - vy(1))
563 z(:) = vz(1) + 0.5_rp*(elem%x3(:) + 1.0_rp)*(vz(5) - vz(1))
564
565 xx(:) = 0.5_rp*(vx(2) - vx(1)) !matmul(refElem%Dx1,mesh%x1(:,n))
566 xy(:) = 0.0_rp !matmul(refElem%Dx2,mesh%x1(:,n))
567 xz(:) = 0.0_rp !matmul(refElem%Dx3,mesh%x1(:,n))
568 yx(:) = 0.0_rp !matmul(refElem%Dx1,mesh%x2(:,n))
569 yy(:) = 0.5_rp*(vy(3) - vy(1)) !matmul(refElem%Dx2,mesh%x2(:,n))
570 yz(:) = 0.0_rp !matmul(refElem%Dx3,mesh%x2(:,n))
571 zx(:) = 0.0_rp !matmul(refElem%Dx1,mesh%x3(:,n))
572 zy(:) = 0.0_rp !matmul(refElem%Dx2,mesh%x3(:,n))
573 zz(:) = 0.5_rp*(vz(5) - vz(1)) !matmul(refElem%Dx3,mesh%x3(:,n))
574
575 return
576 end subroutine meshcubedom3d_coord_conv
577
578!OCL SERIAL
579 subroutine meshcubedom3d_calc_normal( normal_fn, &
580 Escale_f, fid_h, fid_v, elem )
581
582 implicit none
583
584 type(elementbase3d), intent(in) :: elem
585 real(rp), intent(out) :: normal_fn(elem%nfptot,3)
586 integer, intent(in) :: fid_h(elem%nfp_h,elem%nfaces_h)
587 integer, intent(in) :: fid_v(elem%nfp_v,elem%nfaces_v)
588 real(rp), intent(in) :: escale_f(elem%nfptot,3,3)
589
590 integer :: d
591 !-------------------------------------------------
592
593 do d=1, 3
594 normal_fn(fid_h(:,1),d) = - escale_f(fid_h(:,1),2,d)
595 normal_fn(fid_h(:,2),d) = + escale_f(fid_h(:,2),1,d)
596 normal_fn(fid_h(:,3),d) = + escale_f(fid_h(:,3),2,d)
597 normal_fn(fid_h(:,4),d) = - escale_f(fid_h(:,4),1,d)
598
599 normal_fn(fid_v(:,1),d) = - escale_f(fid_v(:,1),3,d)
600 normal_fn(fid_v(:,2),d) = + escale_f(fid_v(:,2),3,d)
601 end do
602
603 return
604 end subroutine meshcubedom3d_calc_normal
605
606end module scale_mesh_cubedom3d
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)
Finalize an object to manage a 2D computational mesh.
subroutine, public meshbase2d_init(this, refelem, nlocalmeshperprc, nprocs, myrank)
Initialize an object to manage a 2D computational mesh.
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)
Calculate position of vertices and generate array to map element to vertices for 3D cubic mesh.
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.
Derived type to manage a computational mesh (base type for 2D domain)
Derived type to manage a computational mesh (base type for 3D domain)
Derived type to manage a cubic 3D computational domain.
Derived type to manage a rectangular 2D computational domain.