FE-Project
Loading...
Searching...
No Matches
scale_mesh_rectdom2d Module Reference

module FElib / Mesh / Rectangle 2D domain More...

Data Types

type  meshrectdom2d
 Derived type to manage a rectangular 2D computational domain. More...

Functions/Subroutines

subroutine meshrectdom2d_init (this, negx, negy, dom_xmin, dom_xmax, dom_ymin, dom_ymax, isperiodicx, isperiodicy, refelem, nlocalmeshperprc, nprcx, nprcy, nproc, myrank)
 Initialize an object to manage a 2D rectangular computational mesh.
subroutine, public meshrectdom2d_setuplocaldom (lcmesh, tileid, panelid, i, j, nprcx, nprcy, dom_xmin, dom_xmax, dom_ymin, dom_ymax, nex, ney)
subroutine, public meshrectdom2d_coord_conv (x, y, xr, xs, yr, ys, vx, vy, elem)

Detailed Description

module FElib / Mesh / Rectangle 2D domain

Description
Manage mesh data of rectangle 2D domain for element-based methods
Author
Yuta Kawai, Team SCALE

Function/Subroutine Documentation

◆ meshrectdom2d_init()

subroutine scale_mesh_rectdom2d::meshrectdom2d_init ( class(meshrectdom2d), intent(inout) this,
integer, intent(in) negx,
integer, intent(in) negy,
real(rp), intent(in) dom_xmin,
real(rp), intent(in) dom_xmax,
real(rp), intent(in) dom_ymin,
real(rp), intent(in) dom_ymax,
logical, intent(in) isperiodicx,
logical, intent(in) isperiodicy,
type(quadrilateralelement), intent(in), target refelem,
integer, intent(in) nlocalmeshperprc,
integer, intent(in) nprcx,
integer, intent(in) nprcy,
integer, intent(in), optional nproc,
integer, intent(in), optional myrank )

Initialize an object to manage a 2D rectangular computational mesh.

Parameters
[in]negxNumber of elements in X direction (global)
[in]negyNumber of elements in Y direction (global)
[in]dom_xminMinimum X coordinate of the global domain
[in]dom_xmaxMaximum X coordinate of the global domain
[in]dom_yminMinimum Y coordinate of the global domain
[in]dom_ymaxMaximum Y coordinate of the global domain
[in]isperiodicxFlag whether the domain is periodic in X direction
[in]isperiodicyFlag whether the domain is periodic in Y direction
[in]refelemReference element for the 2D mesh
[in]nlocalmeshperprcNumber of local meshes managed by each process
[in]nprcxNumber of processes in X direction for domain decomposition
[in]nprcyNumber of processes in Y direction for domain decomposition
[in]nprocTotal number of processes (if not provided, it will be determined from the parallel environment)
[in]myrankRank of the current process (if not provided, it will be determined from the parallel environment)

Definition at line 81 of file scale_mesh_rectdom2d.F90.

88
89 implicit none
90
91 class(MeshRectDom2D), intent(inout) :: this
92 integer, intent(in) :: NeGX !< Number of elements in X direction (global)
93 integer, intent(in) :: NeGY !< Number of elements in Y direction (global)
94 real(RP), intent(in) :: dom_xmin !< Minimum X coordinate of the global domain
95 real(RP), intent(in) :: dom_xmax !< Maximum X coordinate of the global domain
96 real(RP), intent(in) :: dom_ymin !< Minimum Y coordinate of the global domain
97 real(RP), intent(in) :: dom_ymax !< Maximum Y coordinate of the global domain
98 logical, intent(in) :: isPeriodicX !< Flag whether the domain is periodic in X direction
99 logical, intent(in) :: isPeriodicY !< Flag whether the domain is periodic in Y direction
100 type(QuadrilateralElement), intent(in), target :: refElem !< Reference element for the 2D mesh
101 integer, intent(in) :: NLocalMeshPerPrc !< Number of local meshes managed by each process
102 integer, intent(in) :: NprcX !< Number of processes in X direction for domain decomposition
103 integer, intent(in) :: NprcY !< Number of processes in Y direction for domain decomposition
104 integer, intent(in), optional :: nproc !< Total number of processes (if not provided, it will be determined from the parallel environment)
105 integer, intent(in), optional :: myrank !< Rank of the current process (if not provided, it will be determined from the parallel environment)
106
107 !-----------------------------------------------------------------------------
108
109 this%NeGX = negx
110 this%NeGY = negy
111
112 this%xmin_gl = dom_xmin
113 this%xmax_gl = dom_xmax
114 this%ymin_gl = dom_ymin
115 this%ymax_gl = dom_ymax
116 this%dom_vol = (this%xmax_gl - this%xmin_gl) * (this%ymax_gl - this%ymin_gl)
117
118 this%isPeriodicX = isperiodicx
119 this%isPeriodicY = isperiodicy
120
121 this%NprcX = nprcx
122 this%NprcY = nprcy
123
124 call meshbase2d_init( this, refelem, nlocalmeshperprc, &
125 nproc, myrank )
126
127 return

References scale_mesh_base2d::meshbase2d_final(), scale_mesh_base2d::meshbase2d_init(), and meshrectdom2d_setuplocaldom().

◆ meshrectdom2d_setuplocaldom()

subroutine, public scale_mesh_rectdom2d::meshrectdom2d_setuplocaldom ( type(localmesh2d), intent(inout) lcmesh,
integer, intent(in) tileid,
integer, intent(in) panelid,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) nprcx,
integer, intent(in) nprcy,
real(rp), intent(in) dom_xmin,
real(rp), intent(in) dom_xmax,
real(rp), intent(in) dom_ymin,
real(rp), intent(in) dom_ymax,
integer, intent(in) nex,
integer, intent(in) ney )

Definition at line 212 of file scale_mesh_rectdom2d.F90.

217
218 use scale_meshutil_2d, only: &
223
225 implicit none
226
227 type(LocalMesh2D), intent(inout) :: lcmesh
228 integer, intent(in) :: tileID
229 integer, intent(in) :: panelID
230 integer, intent(in) :: i, j
231 integer, intent(in) :: NprcX, NprcY
232 real(RP), intent(in) :: dom_xmin, dom_xmax
233 real(RP), intent(in) :: dom_ymin, dom_ymax
234 integer, intent(in) ::NeX, NeY
235
236 class(ElementBase2D), pointer :: elem
237 real(RP) :: delx, dely
238
239 !-----------------------------------------------------------------------------
240
241 elem => lcmesh%refElem2D
242 lcmesh%tileID = tileid
243 lcmesh%panelID = panelid
244 !$acc update device(lcmesh%tileID, lcmesh%panelID)
245
246 !--
247
248 lcmesh%Ne = nex * ney
249 lcmesh%Nv = (nex + 1)*(ney + 1)
250 lcmesh%NeS = 1
251 lcmesh%NeE = lcmesh%Ne
252 lcmesh%NeA = lcmesh%Ne + 2*(nex + ney)
253 !$acc update device(lcmesh%Ne, lcmesh%Nv, lcmesh%NeS, lcmesh%NeE, lcmesh%NeA)
254
255 lcmesh%NeX = nex
256 lcmesh%NeY = ney
257 !$acc update device(lcmesh%NeX, lcmesh%NeY)
258
259 delx = (dom_xmax - dom_xmin)/dble(nprcx)
260 dely = (dom_ymax - dom_ymin)/dble(nprcy)
261
262 lcmesh%xmin = dom_xmin + (i-1)*delx
263 lcmesh%xmax = dom_xmin + i *delx
264 lcmesh%ymin = dom_ymin + (j-1)*dely
265 lcmesh%ymax = dom_ymin + j *dely
266 !$acc update device(lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax)
267
268 allocate( lcmesh%pos_ev(lcmesh%Nv,2) )
269 allocate( lcmesh%EToV(lcmesh%Ne,elem%Nv) )
270 allocate( lcmesh%EToE(lcmesh%Ne,elem%Nfaces) )
271 allocate( lcmesh%EToF(lcmesh%Ne,elem%Nfaces) )
272 allocate( lcmesh%BCType(lcmesh%refElem%Nfaces,lcmesh%Ne) )
273 allocate( lcmesh%VMapM(elem%NfpTot, lcmesh%Ne) )
274 allocate( lcmesh%VMapP(elem%NfpTot, lcmesh%Ne) )
275 allocate( lcmesh%MapM(elem%NfpTot, lcmesh%Ne) )
276 allocate( lcmesh%MapP(elem%NfpTot, lcmesh%Ne) )
277 !$acc enter data create(lcmesh%pos_ev, lcmesh%EToV, lcmesh%EToE, lcmesh%EToF, lcmesh%BCType, &
278 !$acc lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP)
279
280 lcmesh%BCType(:,:) = bctype_interior
281 !$acc update device(lcmesh%BCType)
282
283 !----
284
285 call meshutil2d_genrectdomain( lcmesh%pos_ev, lcmesh%EToV, & ! (out)
286 lcmesh%NeX, lcmesh%xmin, lcmesh%xmax, & ! (in)
287 lcmesh%NeY, lcmesh%ymin, lcmesh%ymax ) ! (in)
288 !$acc update device(lcmesh%pos_ev, lcmesh%EToV)
289
290 !---
291 call meshbase2d_setgeometricinfo( lcmesh, meshrectdom2d_coord_conv, meshrectdom2d_calc_normal )
292
293 !---
294
295 call meshutil2d_genconnectivity( lcmesh%EToE, lcmesh%EToF, & ! (out)
296 lcmesh%EToV, lcmesh%Ne, elem%Nfaces ) ! (in)
297 !$acc update device(lcmesh%EToE, lcmesh%EToF)
298
299 !---
300 call meshutil2d_buildinteriormap( lcmesh%VmapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP, &
301 lcmesh%pos_en, lcmesh%pos_ev, lcmesh%EToE, lcmesh%EtoF, lcmesh%EtoV, &
302 elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv )
303
304 call meshutil2d_genpatchboundarymap( lcmesh%VMapB, lcmesh%MapB, lcmesh%VMapP, &
305 lcmesh%pos_en, lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax, &
306 elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv)
307 !$acc update device(lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP)
308 !$acc enter data copyin(lcmesh%VMapB, lcmesh%MapB)
309
310 return
module FElib / Mesh / Local, Base
integer, parameter, public bctype_interior
module FElib / Mesh / utility for 2D mesh
subroutine, public meshutil2d_buildinteriormap(vmapm, vmapp, mapm, mapp, pos_en, pos_ev, etoe, etof, etov, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutil2d_genconnectivity(etoe, etof, etov, ne, nfaces)
subroutine, public meshutil2d_genrectdomain(pos_v, etov, ke_x, xmin, xmax, ke_y, ymin, ymax)
subroutine, public meshutil2d_genpatchboundarymap(vmapb, mapb, vmapp, pos_en, xmin, xmax, ymin, ymax, fmask, ne, np, nfp, nfaces, nv)

References scale_localmesh_base::bctype_interior, scale_mesh_base2d::meshbase2d_setgeometricinfo(), meshrectdom2d_coord_conv(), scale_meshutil_2d::meshutil2d_buildglobalmap(), scale_meshutil_2d::meshutil2d_buildinteriormap(), scale_meshutil_2d::meshutil2d_genconnectivity(), scale_meshutil_2d::meshutil2d_genpatchboundarymap(), and scale_meshutil_2d::meshutil2d_genrectdomain().

Referenced by scale_mesh_rectdom2d::meshrectdom2d::assigndomid(), scale_mesh_cubedom3d::meshcubedom3d_init(), and meshrectdom2d_init().

◆ meshrectdom2d_coord_conv()

subroutine, public scale_mesh_rectdom2d::meshrectdom2d_coord_conv ( real(rp), dimension(elem%np), intent(out) x,
real(rp), dimension(elem%np), intent(out) y,
real(rp), dimension(elem%np), intent(out) xr,
real(rp), dimension(elem%np), intent(out) xs,
real(rp), dimension(elem%np), intent(out) yr,
real(rp), dimension(elem%np), intent(out) ys,
real(rp), dimension(elem%nv), intent(in) vx,
real(rp), dimension(elem%nv), intent(in) vy,
type(elementbase2d), intent(in) elem )

Definition at line 380 of file scale_mesh_rectdom2d.F90.

382 implicit none
383
384 type(ElementBase2D), intent(in) :: elem
385 real(RP), intent(out) :: x(elem%Np), y(elem%Np)
386 real(RP), intent(out) :: xr(elem%Np), xs(elem%Np), yr(elem%Np), ys(elem%Np)
387 real(RP), intent(in) :: vx(elem%Nv), vy(elem%Nv)
388
389 !-------------------------------------------------
390
391 x(:) = vx(1) + 0.5_rp*(elem%x1(:) + 1.0_rp)*(vx(2) - vx(1))
392 y(:) = vy(1) + 0.5_rp*(elem%x2(:) + 1.0_rp)*(vy(3) - vy(1))
393
394 xr(:) = 0.5_rp*(vx(2) - vx(1)) !matmul(refElem%Dx1,mesh%x1(:,n))
395 xs(:) = 0.0_rp !matmul(refElem%Dx2,mesh%x1(:,n))
396 yr(:) = 0.0_rp !matmul(refElem%Dx1,mesh%x2(:,n))
397 ys(:) = 0.5_rp*(vy(3) - vy(1)) !matmul(refElem%Dx2,mesh%x2(:,n))
398
399 return

Referenced by scale_mesh_rectdom2d::meshrectdom2d::assigndomid(), and meshrectdom2d_setuplocaldom().