10#include "scaleFElib.h"
44 real(rp),
public :: xmin_gl
45 real(rp),
public :: xmax_gl
46 real(rp),
public :: ymin_gl
47 real(rp),
public :: ymax_gl
49 integer,
allocatable :: rcdomij2lcmeshid(:,:)
51 logical :: isperiodicx
52 logical :: isperiodicy
55 procedure :: final => meshrectdom2d_final
56 procedure :: generate => meshrectdom2d_generate
57 procedure :: assigndomid => meshrectdom2d_assigndomid
83 dom_xmin, dom_xmax, dom_ymin, dom_ymax, &
84 isPeriodicX, isPeriodicY, &
85 refElem, NLocalMeshPerPrc, &
92 integer,
intent(in) :: NeGX
93 integer,
intent(in) :: NeGY
94 real(RP),
intent(in) :: dom_xmin
95 real(RP),
intent(in) :: dom_xmax
96 real(RP),
intent(in) :: dom_ymin
97 real(RP),
intent(in) :: dom_ymax
98 logical,
intent(in) :: isPeriodicX
99 logical,
intent(in) :: isPeriodicY
101 integer,
intent(in) :: NLocalMeshPerPrc
102 integer,
intent(in) :: NprcX
103 integer,
intent(in) :: NprcY
104 integer,
intent(in),
optional :: nproc
105 integer,
intent(in),
optional :: myrank
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)
118 this%isPeriodicX = isperiodicx
119 this%isPeriodicY = isperiodicy
132 subroutine meshrectdom2d_final( this )
139 if (this%isGenerated)
then
140 if (
allocated(this%rcdomIJ2LCMeshID) )
then
142 deallocate( this%rcdomIJ2LCMeshID )
149 end subroutine meshrectdom2d_final
153 subroutine meshrectdom2d_generate( this )
161 integer :: tileID_table(this%LOCAL_MESH_NUM, this%PRC_NUM)
162 integer :: panelID_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
163 integer :: pi_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
164 integer :: pj_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
166 integer :: TILE_NUM_PER_PANEL
167 real(RP) :: delx, dely
171 tile_num_per_panel = this%LOCAL_MESH_NUM_global / 1
176 call this%AssignDomID( &
177 tileid_table, panelid_table, &
182 do n=1, this%LOCAL_MESH_NUM
183 mesh => this%lcmesh_list(n)
184 tileid = tileid_table(n, mesh%PRC_myrank+1)
187 tileid, panelid_table(tileid), &
188 pi_table(tileid), pj_table(tileid), this%NprcX, this%NprcY, &
189 this%xmin_gl, this%xmax_gl, this%ymin_gl, this%ymax_gl, &
190 this%NeGX/this%NprcX, this%NeGY/this%NprcY )
205 this%isGenerated = .true.
208 end subroutine meshrectdom2d_generate
214 i, j, NprcX, NprcY, &
215 dom_xmin, dom_xmax, dom_ymin, dom_ymax, &
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
237 real(rp) :: delx, dely
241 elem => lcmesh%refElem2D
242 lcmesh%tileID = tileid
243 lcmesh%panelID = panelid
248 lcmesh%Ne = nex * ney
249 lcmesh%Nv = (nex + 1)*(ney + 1)
251 lcmesh%NeE = lcmesh%Ne
252 lcmesh%NeA = lcmesh%Ne + 2*(nex + ney)
259 delx = (dom_xmax - dom_xmin)/dble(nprcx)
260 dely = (dom_ymax - dom_ymin)/dble(nprcy)
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
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) )
286 lcmesh%NeX, lcmesh%xmin, lcmesh%xmax, &
287 lcmesh%NeY, lcmesh%ymin, lcmesh%ymax )
296 lcmesh%EToV, lcmesh%Ne, elem%Nfaces )
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 )
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)
313 subroutine meshrectdom2d_assigndomid( this, &
314 tileID_table, panelID_table, &
323 integer,
intent(out) :: tileid_table(this%local_mesh_num, this%prc_num)
324 integer,
intent(out) :: panelid_table(this%local_mesh_num*this%prc_num)
325 integer,
intent(out) :: pi_table(this%local_mesh_num*this%prc_num)
326 integer,
intent(out) :: pj_table(this%local_mesh_num*this%prc_num)
331 integer :: is_lc, js_lc
332 integer :: ilc_count, jlc_count
339 panelid_table, pi_table, pj_table, &
340 this%tileID_globalMap, this%tileFaceID_globalMap, this%tilePanelID_globalMap, &
341 this%LOCAL_MESH_NUM_global, this%isPeriodicX, this%isPeriodicY, &
342 this%NprcX, this%NprcY )
347 do prc=1, this%PRC_NUM
348 do n=1, this%LOCAL_MESH_NUM
349 tileid = n + (prc-1)*this%LOCAL_MESH_NUM
350 lcmesh => this%lcmesh_list(n)
352 tileid_table(n,prc) = tileid
353 this%tileID_global2localMap(tileid) = n
354 this%PRCRank_globalMap(tileid) = prc - 1
357 if ( this%PRCRank_globalMap(tileid) == lcmesh%PRC_myrank )
then
359 is_lc = pi_table(tileid); ilc_count = 1
360 js_lc = pj_table(tileid); jlc_count = 1
362 if(is_lc < pi_table(tileid)) ilc_count = ilc_count + 1
363 if(js_lc < pj_table(tileid)) jlc_count = jlc_count + 1
369 allocate( this%rcdomIJ2LCMeshID(ilc_count,jlc_count) )
372 this%rcdomIJ2LCMeshID(ilc,jlc) = ilc + (jlc - 1)*ilc_count
378 end subroutine meshrectdom2d_assigndomid
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)
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))
394 xr(:) = 0.5_rp*(vx(2) - vx(1))
397 ys(:) = 0.5_rp*(vy(3) - vy(1))
402 subroutine meshrectdom2d_calc_normal( normal_fn, &
403 Escale_f, fid, elem )
407 real(rp),
intent(out) :: normal_fn(elem%nfptot,2)
408 integer,
intent(in) :: fid(elem%nfp,elem%nfaces)
409 real(rp),
intent(in) :: escale_f(elem%nfptot,2,2)
415 normal_fn(fid(:,1),d) = - escale_f(fid(:,1),2,d)
416 normal_fn(fid(:,2),d) = + escale_f(fid(:,2),1,d)
417 normal_fn(fid(:,3),d) = + escale_f(fid(:,3),2,d)
418 normal_fn(fid(:,4),d) = - escale_f(fid(:,4),1,d)
422 end subroutine meshrectdom2d_calc_normal
module FElib / Element / Base
module FElib / Element / Quadrilateral
module FElib / Mesh / Local 2D
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 / Rectangle 2D domain
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)
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.
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_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)
Derived type representing a 2D reference element.
Derived type representing a quadrilateral element.
Derived type representing a local mesh for 2D domain.
Derived type to manage a computational mesh (base type for 2D domain)
Derived type to manage a rectangular 2D computational domain.