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

module FElib / Mesh / Base 1D More...

Data Types

type  meshbase1d
 Derived type to manage a computational mesh (base type for 1D domain) More...
interface  meshbase1d_generate

Functions/Subroutines

subroutine, public meshbase1d_init (this, neg, dom_xmin, dom_xmax, refelem, nlocalmeshperprc, nprocs, myrank, fx)
 Initialize an object to manage a 1D computational mesh.
subroutine, public meshbase1d_final (this)
 Finalize an object to manage a 1D computational mesh.
subroutine, public meshbase1d_setgeometricinfo (lcmesh)
subroutine, public meshbase1d_assigndomid (this, tileid_table, panelid_table, pi_table)
subroutine, public meshbase1d_setuplocaldom (lcmesh, tileid, panelid, i, nprc, dom_xmin, dom_xmax, ne, fx)

Variables

integer, public meshbase1d_dimtype_num = 2
integer, public meshbase1d_dimtypeid_x = 1
integer, public meshbase1d_dimtypeid_xt = 2

Detailed Description

module FElib / Mesh / Base 1D

Description
Base module to manage 1D meshes for element-based methods
Author
Yuta Kawai, Team SCALE

Function/Subroutine Documentation

◆ meshbase1d_init()

subroutine, public scale_mesh_base1d::meshbase1d_init ( class(meshbase1d), intent(inout) this,
integer, intent(in) neg,
real(rp), intent(in) dom_xmin,
real(rp), intent(in) dom_xmax,
class(elementbase1d), intent(in), target refelem,
integer, intent(in) nlocalmeshperprc,
integer, intent(in), optional nprocs,
integer, intent(in), optional myrank,
real(rp), dimension(neg+1), intent(in), optional fx )

Initialize an object to manage a 1D computational mesh.

Definition at line 84 of file scale_mesh_base1d.F90.

89
90 implicit none
91
92 class(MeshBase1D), intent(inout) :: this
93 integer, intent(in) :: NeG
94 real(RP), intent(in) :: dom_xmin
95 real(RP), intent(in) :: dom_xmax
96 class(ElementBase1D), intent(in), target :: refElem
97 integer, intent(in) :: NLocalMeshPerPrc
98 integer, intent(in), optional :: nprocs
99 integer, intent(in), optional :: myrank
100 real(RP), intent(in), optional :: FX(NeG+1)
101
102 integer :: n
103 integer :: k
104 real(RP) :: dx
105 !-----------------------------------------------------------------------------
106
107 this%NeG = neg
108
109 this%xmin_gl = dom_xmin
110 this%xmax_gl = dom_xmax
111
112 !- Fx
113 allocate( this%FX(neg+1) )
114 if ( present(fx) ) then
115 this%FX(:) = fx(:)
116 else
117 this%FX(1 ) = dom_xmin
118 this%FX(neg+1) = dom_xmax
119 dx = (dom_xmax - dom_xmin) / dble(neg)
120 do k=2, neg
121 this%FX(k) = this%FX(k-1) + dx
122 end do
123 end if
124 !$acc enter data create(this%FX)
125
126 this%refElem1D => refelem
127 call meshbase_init( this, &
128 meshbase1d_dimtype_num, refelem, &
129 nlocalmeshperprc, 2, &
130 nprocs )
131
132 this%Nprc = this%PRC_NUM
133
134 allocate( this%lcmesh_list(this%LOCAL_MESH_NUM) )
135 do n=1, this%LOCAL_MESH_NUM
136 call localmesh1d_init( this%lcmesh_list(n), n, refelem, myrank )
137 end do
138
139 call this%SetDimInfo( meshbase1d_dimtypeid_x, "x", "m", "X-coordinate" )
140 call this%SetDimInfo( meshbase1d_dimtypeid_xt, "xt", "m", "X-coordinate" )
141
142 return

References scale_localmesh_1d::localmesh1d_init(), meshbase1d_dimtype_num, meshbase1d_dimtypeid_x, meshbase1d_dimtypeid_xt, and scale_mesh_base::meshbase_init().

Referenced by scale_mesh_base1d::meshbase1d_generate::meshbase1d_generate(), and scale_mesh_linedom1d::meshlinedom1d_init().

◆ meshbase1d_final()

subroutine, public scale_mesh_base1d::meshbase1d_final ( class(meshbase1d), intent(inout) this)

Finalize an object to manage a 1D computational mesh.

Definition at line 147 of file scale_mesh_base1d.F90.

148 implicit none
149 class(MeshBase1D), intent(inout) :: this
150
151 integer :: n
152 !-----------------------------------------------------------------------------
153
154 if ( allocated ( this%lcmesh_list ) ) then
155 do n=1, this%LOCAL_MESH_NUM
156 call localmesh1d_final( this%lcmesh_list(n), this%isGenerated )
157 end do
158
159 deallocate( this%lcmesh_list )
160 end if
161
162 call meshbase_final(this)
163
164 return

References scale_localmesh_1d::localmesh1d_final(), and scale_mesh_base::meshbase_final().

Referenced by scale_mesh_base1d::meshbase1d_generate::meshbase1d_generate(), and scale_mesh_linedom1d::meshlinedom1d_final().

◆ meshbase1d_setgeometricinfo()

subroutine, public scale_mesh_base1d::meshbase1d_setgeometricinfo ( type(localmesh1d), intent(inout) lcmesh)

Definition at line 182 of file scale_mesh_base1d.F90.

183 implicit none
184
185 type(LocalMesh1D), intent(inout) :: lcmesh
186
187 class(ElementBase1D), pointer :: refElem
188 integer :: ke
189 integer :: f
190 integer :: i
191
192 integer :: node_ids(lcmesh%refElem%Nv)
193 real(RP) :: vx(lcmesh%refElem%Nv)
194 real(RP) :: xr(lcmesh%refElem%Np)
195 real(DP) :: Escale(1,1,lcmesh%refElem%Np)
196 integer :: fmask(lcmesh%refElem%NfpTot)
197 integer :: fid(lcmesh%refElem1D%Nfp,lcmesh%refElem1D%Nfaces)
198
199 !-----------------------------------------------------------------------------
200
201 call meshbase_setgeometricinfo(lcmesh, 1)
202 refelem => lcmesh%refElem1D
203
204 fmask(:) = reshape(refelem%Fmask, shape(fmask))
205 do f=1, refelem%Nfaces
206 do i=1, refelem%Nfp
207 fid(i,f) = i + (f-1)*refelem%Nfp
208 end do
209 end do
210
211 do ke=1, lcmesh%Ne
212 node_ids(:) = lcmesh%EToV(ke,:)
213 vx(:) = lcmesh%pos_ev(node_ids(:),1)
214 lcmesh%pos_en(:,ke,1) = vx(1) + 0.5_rp*(refelem%x1(:) + 1.0_rp)*(vx(2) - vx(1))
215
216 xr(:) = 0.5_rp*(vx(2) - vx(1)) !matmul(refElem%Dr,mesh%x(:,n))
217
218 lcmesh%J(:,ke) = xr
219 lcmesh%Escale(:,ke,1,1) = 1.0_rp/lcmesh%J(:,ke)
220
221 !* Face
222
223 !
224 !mesh%fx(:,n) = mesh%x(fmask(:),n)
225 !mesh%fy(:,n) = mesh%y(fmask(:),n)
226
227 ! Calculate normal vectors
228 lcmesh%normal_fn(fid(:,1),ke,1) = - 1.0_rp
229 lcmesh%normal_fn(fid(:,2),ke,1) = + 1.0_rp
230 lcmesh%sJ(:,ke) = 1.0_rp
231 lcmesh%Fscale(:,ke) = lcmesh%sJ(:,ke)/lcmesh%J(fmask(:),ke)
232 lcmesh%Gsqrt(:,ke) = 1.0_rp
233 end do
234 !$acc update device(lcmesh%pos_en, lcmesh%normal_fn, lcmesh%sJ, lcmesh%J, lcmesh%Escale, lcmesh%Fscale, lcmesh%Gsqrt)
235
236 return

References scale_mesh_base::meshbase_setgeometricinfo().

Referenced by scale_mesh_base1d::meshbase1d_generate::meshbase1d_generate(), and meshbase1d_setuplocaldom().

◆ meshbase1d_assigndomid()

subroutine, public scale_mesh_base1d::meshbase1d_assigndomid ( class(meshbase1d), intent(inout) this,
integer, dimension(this%local_mesh_num, this%prc_num), intent(out) tileid_table,
integer, dimension(this%local_mesh_num*this%prc_num), intent(out) panelid_table,
integer, dimension(this%local_mesh_num*this%prc_num), intent(out) pi_table )

Definition at line 240 of file scale_mesh_base1d.F90.

243
244 use scale_meshutil_1d, only: &
246 implicit none
247
248 class(MeshBase1D), intent(inout) :: this
249 integer, intent(out) :: tileID_table(this%LOCAL_MESH_NUM, this%PRC_NUM)
250 integer, intent(out) :: panelID_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
251 integer, intent(out) :: pi_table(this%LOCAL_MESH_NUM*this%PRC_NUM)
252
253 integer :: n
254 integer :: p
255 integer :: tileID
256 !-----------------------------------------------------------------------------
257
259 panelid_table, pi_table, & ! (out)
260 this%tileID_globalMap, this%tileFaceID_globalMap, this%tilePanelID_globalMap, & ! (out)
261 this%LOCAL_MESH_NUM_global ) ! (in)
262
263 do p=1, this%PRC_NUM
264 do n=1, this%LOCAL_MESH_NUM
265 tileid = n + (p-1)*this%LOCAL_MESH_NUM
266
267 tileid_table(n,p) = tileid
268 this%tileID_global2localMap(tileid) = n
269 this%PRCRank_globalMap(tileid) = p - 1
270 end do
271 end do
272 !$acc update device(this%tileID_globalMap, this%tileFaceID_globalMap, &
273 !$acc this%tilePanelID_globalMap, this%tileID_global2localMap, this%PRCRank_globalMap)
274
275 return
module FElib / Mesh / utility for 1D mesh
subroutine, public meshutil1d_buildglobalmap(panelid_table, pi_table, tileid_map, tilefaceid_map, tilepanelid_map, ntile)

References scale_meshutil_1d::meshutil1d_buildglobalmap().

Referenced by scale_mesh_base1d::meshbase1d_generate::meshbase1d_generate(), and scale_mesh_linedom1d::meshlinedom1d_generate().

◆ meshbase1d_setuplocaldom()

subroutine, public scale_mesh_base1d::meshbase1d_setuplocaldom ( type(localmesh1d), intent(inout) lcmesh,
integer, intent(in) tileid,
integer, intent(in) panelid,
integer, intent(in) i,
integer, intent(in) nprc,
real(rp) dom_xmin,
real(rp) dom_xmax,
integer, intent(in) ne,
real(rp), dimension(ne*nprc+1), intent(in) fx )

Definition at line 279 of file scale_mesh_base1d.F90.

284
285 use scale_meshutil_1d, only: &
290
292 implicit none
293
294 type(LocalMesh1D), intent(inout) :: lcmesh
295 integer, intent(in) :: tileID
296 integer, intent(in) :: panelID
297 integer, intent(in) :: i
298 integer, intent(in) :: Nprc
299 real(RP) :: dom_xmin, dom_xmax
300 integer, intent(in) ::Ne
301 real(RP), intent(in) :: FX(Ne*Nprc+1)
302
303 class(ElementBase1D), pointer :: elem
304 real(RP) :: delx
305 real(RP) :: FX_lc(Ne+1)
306 !-----------------------------------------------------------------------------
307
308 elem => lcmesh%refElem1D
309 lcmesh%tileID = tileid
310 lcmesh%panelID = panelid
311 !$acc update device(lcmesh%tileID, lcmesh%panelID)
312
313 !--
314
315 lcmesh%Ne = ne
316 lcmesh%Nv = ne + 1
317 lcmesh%NeS = 1
318 lcmesh%NeE = lcmesh%Ne
319 lcmesh%NeA = lcmesh%Ne + 2
320 !$acc update device(lcmesh%Ne, lcmesh%Nv, lcmesh%NeS, lcmesh%NeE, lcmesh%NeA)
321
322 !delx = (dom_xmax - dom_xmin)/dble(Nprc)
323 fx_lc(:) = fx((i-1)*ne+1:i*ne+1)
324 lcmesh%xmin = fx_lc(1)
325 lcmesh%xmax = fx_lc(ne+1)
326 !$acc update device(lcmesh%xmin, lcmesh%xmax)
327
328 allocate( lcmesh%pos_ev(lcmesh%Nv,1) )
329 allocate( lcmesh%EToV(lcmesh%Ne,2) )
330 allocate( lcmesh%EToE(lcmesh%Ne,elem%Nfaces) )
331 allocate( lcmesh%EToF(lcmesh%Ne,elem%Nfaces) )
332 allocate( lcmesh%BCType(lcmesh%refElem%Nfaces,lcmesh%Ne) )
333 allocate( lcmesh%VMapM(elem%NfpTot, lcmesh%Ne) )
334 allocate( lcmesh%VMapP(elem%NfpTot, lcmesh%Ne) )
335 allocate( lcmesh%MapM(elem%NfpTot, lcmesh%Ne) )
336 allocate( lcmesh%MapP(elem%NfpTot, lcmesh%Ne) )
337 !$acc enter data create(lcmesh%pos_ev, lcmesh%EToV, lcmesh%EToE, lcmesh%EToF, lcmesh%BCType, &
338 !$acc lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP)
339
340 lcmesh%BCType(:,:) = bctype_interior
341 !$acc update device(lcmesh%BCType)
342
343 !----
344
345 call meshutil1d_genlinedomain( lcmesh%pos_ev, lcmesh%EToV, & ! (out)
346 lcmesh%Ne, lcmesh%xmin, lcmesh%xmax, fx=fx_lc ) ! (in)
347 !$acc update device(lcmesh%pos_ev, lcmesh%EToV)
348
349 !---
350 call meshbase1d_setgeometricinfo( lcmesh )
351
352 !---
353
354 call meshutil1d_genconnectivity( lcmesh%EToE, lcmesh%EToF, & ! (out)
355 & lcmesh%EToV, lcmesh%Ne, elem%Nfaces ) ! (in)
356 !$acc update device(lcmesh%EToE, lcmesh%EToF)
357
358 !---
359 call meshutil1d_buildinteriormap( lcmesh%VmapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP, & ! (out)
360 & lcmesh%pos_en, lcmesh%pos_ev, lcmesh%EToE, lcmesh%EtoF, lcmesh%EtoV, & ! (in)
361 & elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv ) ! (in)
362
363 call meshutil1d_genpatchboundarymap( lcmesh%VMapB, lcmesh%MapB, lcmesh%VMapP, & ! (inout)
364 & lcmesh%pos_en, lcmesh%xmin, lcmesh%xmax, & ! (in)
365 & elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv ) ! (in)
366 !$acc update device(lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP)
367 !$acc enter data copyin(lcmesh%VMapB, lcmesh%MapB)
368
369 return
module FElib / Mesh / Local, Base
integer, parameter, public bctype_interior
subroutine, public meshutil1d_buildinteriormap(vmapm, vmapp, mapm, mapp, pos_en, pos_ev, etoe, etof, etov, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutil1d_genconnectivity(etoe, etof, etov, ne, nfaces)
subroutine, public meshutil1d_genpatchboundarymap(vmapb, mapb, vmapp, pos_en, xmin, xmax, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutil1d_genlinedomain(pos_v, etov, ke_x, xmin, xmax, fx)

References scale_localmesh_base::bctype_interior, meshbase1d_setgeometricinfo(), scale_meshutil_1d::meshutil1d_buildinteriormap(), scale_meshutil_1d::meshutil1d_genconnectivity(), scale_meshutil_1d::meshutil1d_genlinedomain(), and scale_meshutil_1d::meshutil1d_genpatchboundarymap().

Referenced by scale_mesh_base1d::meshbase1d_generate::meshbase1d_generate(), and scale_mesh_linedom1d::meshlinedom1d_generate().

Variable Documentation

◆ meshbase1d_dimtype_num

integer, public scale_mesh_base1d::meshbase1d_dimtype_num = 2

Definition at line 67 of file scale_mesh_base1d.F90.

67 integer, public :: MESHBASE1D_DIMTYPE_NUM = 2

Referenced by scale_file_history_meshfield::file_history_meshfield_in::file_history_meshfield_in3d(), and meshbase1d_init().

◆ meshbase1d_dimtypeid_x

integer, public scale_mesh_base1d::meshbase1d_dimtypeid_x = 1

◆ meshbase1d_dimtypeid_xt

integer, public scale_mesh_base1d::meshbase1d_dimtypeid_xt = 2

Definition at line 69 of file scale_mesh_base1d.F90.

69 integer, public :: MESHBASE1D_DIMTYPEID_XT = 2

Referenced by scale_file_common_meshfield::file_common_meshfield_get_dims::file_common_meshfield_get_dims1d(), and meshbase1d_init().