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

module FElib / Mesh / Cubed-sphere 2D domain More...

Data Types

type  meshcubedspheredom2d
 Derived type to manage a cubed-sphere 2D computational domain. More...

Functions/Subroutines

subroutine meshcubedspheredom2d_init (this, negx, negy, rplanet, refelem, nlocalmeshperprc, nproc, myrank)
subroutine, public meshcubedspheredom2d_check_division_params (nprcx_lc, nprcy_lc, prc_num, local_mesh_num_global, call_prc_abort)
subroutine, public meshcubedspheredom2d_setuplocaldom (lcmesh, tileid, panelid, i, j, nprcx, nprcy, dom_xmin, dom_xmax, dom_ymin, dom_ymax, planet_radius, nex, ney)

Detailed Description

module FElib / Mesh / Cubed-sphere 2D domain

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

Function/Subroutine Documentation

◆ meshcubedspheredom2d_init()

subroutine scale_mesh_cubedspheredom2d::meshcubedspheredom2d_init ( class(meshcubedspheredom2d), intent(inout) this,
integer, intent(in) negx,
integer, intent(in) negy,
real(rp), intent(in) rplanet,
type(quadrilateralelement), intent(in), target refelem,
integer, intent(in) nlocalmeshperprc,
integer, intent(in), optional nproc,
integer, intent(in), optional myrank )

Definition at line 84 of file scale_mesh_cubedspheredom2d.F90.

88
89 use scale_const, only: &
90 pi => const_pi
91 implicit none
92
93 class(MeshCubedSphereDom2D), intent(inout) :: this
94 integer, intent(in) :: NeGX
95 integer, intent(in) :: NeGY
96 real(RP), intent(in) :: RPlanet
97 type(QuadrilateralElement), intent(in), target :: refElem
98 integer, intent(in) :: NLocalMeshPerPrc
99 integer, intent(in), optional :: nproc
100 integer, intent(in), optional :: myrank
101 !-----------------------------------------------------------------------------
102
103 this%NeGX = negx
104 this%NeGY = negy
105
106 this%xmin_gl = - 0.25_rp * pi
107 this%xmax_gl = + 0.25_rp * pi
108 this%ymin_gl = - 0.25_rp * pi
109 this%ymax_gl = + 0.25_rp * pi
110 this%RPlanet = rplanet
111 this%dom_vol = 4.0_rp * pi * rplanet**2
112
113
114 call meshbase2d_init( this, refelem, nlocalmeshperprc, &
115 nproc, myrank )
116
117 call this%SetDimInfo( meshbase2d_dimtypeid_x, "x", "1", "X-coordinate" )
118 call this%SetDimInfo( meshbase2d_dimtypeid_y, "y", "1", "Y-coordinate" )
119 call this%SetDimInfo( meshbase2d_dimtypeid_xy, "xy", "1", "XY-coordinate" )
120 call this%SetDimInfo( meshbase2d_dimtypeid_xyt, "xyt", "1", "XY-coordinate" )
121
122 return

References scale_mesh_base2d::meshbase2d_dimtypeid_x, scale_mesh_base2d::meshbase2d_dimtypeid_xy, scale_mesh_base2d::meshbase2d_dimtypeid_xyt, scale_mesh_base2d::meshbase2d_dimtypeid_y, scale_mesh_base2d::meshbase2d_final(), scale_mesh_base2d::meshbase2d_init(), meshcubedspheredom2d_check_division_params(), and meshcubedspheredom2d_setuplocaldom().

◆ meshcubedspheredom2d_check_division_params()

subroutine, public scale_mesh_cubedspheredom2d::meshcubedspheredom2d_check_division_params ( integer, intent(out) nprcx_lc,
integer, intent(out) nprcy_lc,
integer, intent(in) prc_num,
integer, intent(in) local_mesh_num_global,
logical, intent(in), optional call_prc_abort )

Definition at line 200 of file scale_mesh_cubedspheredom2d.F90.

204
205 use scale_prc, only: prc_abort
206 implicit none
207
208 integer, intent(in) :: PRC_NUM
209 integer, intent(in) :: LOCAL_MESH_NUM_global
210 integer, intent(out) :: NprcX_lc
211 integer, intent(out) :: NprcY_lc
212 logical, intent(in), optional :: call_prc_abort
213
214 integer :: TILE_NUM_PER_PANEL
215 logical :: call_prc_abort_
216 !-----------------------------------------------------------------------------
217
218 if (present(call_prc_abort)) then
219 call_prc_abort_ = call_prc_abort
220 else
221 call_prc_abort_ = .false.
222 end if
223
224 if ( mod(local_mesh_num_global, 6) /= 0 ) then
225 log_error("MeshCubedSphereDom2D_division_params",*) "The total number of local mesh must be a multiple of 6. Check!"
226 if (call_prc_abort_) call prc_abort
227 end if
228
229 tile_num_per_panel = local_mesh_num_global / 6
230
231 if ( prc_num <= 6 ) then
232 if ( ( prc_num == 1 ) .or. &
233 ( prc_num <= 6 .and. (mod(prc_num,2)==0 .or. mod(prc_num,3)==0)) ) then
234 nprcx_lc = 1; nprcy_lc = 1
235 else
236 log_error("MeshCubedSphereDom2D_division_params",*) "The number of proceses is inappropriate. Check!"
237 if (call_prc_abort_) call prc_abort
238 end if
239 else
240 if ( mod(prc_num,6) == 0 ) then
241 nprcx_lc = int(sqrt(dble(tile_num_per_panel)))
242 nprcy_lc = tile_num_per_panel / nprcx_lc
243 if ( nprcx_lc /= nprcy_lc ) then
244 log_error("MeshCubedSphereDom2D_division_params",*) "The number of proceses is inappropriate. Check!"
245 if (call_prc_abort_) call prc_abort
246 end if
247 else
248 log_error("MeshCubedSphereDom2D_division_params",*) "The number of proceses is inappropriate. Check!"
249 if (call_prc_abort_) call prc_abort
250 end if
251 end if
252
253 return

Referenced by scale_mesh_cubedspheredom2d::meshcubedspheredom2d::assigndomid(), meshcubedspheredom2d_init(), and scale_mesh_cubedspheredom3d::meshcubedspheredom3d_init().

◆ meshcubedspheredom2d_setuplocaldom()

subroutine, public scale_mesh_cubedspheredom2d::meshcubedspheredom2d_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,
real(rp), intent(in) planet_radius,
integer, intent(in) nex,
integer, intent(in) ney )

Definition at line 256 of file scale_mesh_cubedspheredom2d.F90.

261
263 meshutilcubedsphere2d_genconnectivity, &
264 meshutilcubedsphere2d_genrectdomain, &
265 meshutilcubedsphere2d_buildinteriormap, &
266 meshutilcubedsphere2d_genpatchboundarymap
267
268 use scale_cubedsphere_coord_cnv, only: &
271
273
274 implicit none
275
276 type(LocalMesh2D), intent(inout) :: lcmesh
277 integer, intent(in) :: tileID
278 integer, intent(in) :: panelID
279 integer, intent(in) :: i, j
280 integer, intent(in) :: NprcX, NprcY
281 real(RP), intent(in) :: dom_xmin, dom_xmax
282 real(RP), intent(in) :: dom_ymin, dom_ymax
283 real(RP), intent(in) :: planet_radius
284 integer, intent(in) :: NeX, NeY
285
286 class(ElementBase2D), pointer :: elem
287 real(RP) :: delx, dely
288 integer :: ke
289
290 real(RP), allocatable :: gam(:,:)
291 !-----------------------------------------------------------------------------
292
293 elem => lcmesh%refElem2D
294
295 lcmesh%tileID = tileid
296 lcmesh%panelID = panelid
297 !$acc update device(lcmesh%tileID, lcmesh%panelID)
298
299 !--
300 lcmesh%Ne = nex * ney
301 lcmesh%Nv = (nex + 1)*(ney + 1)
302 lcmesh%NeS = 1
303 lcmesh%NeE = lcmesh%Ne
304 lcmesh%NeA = lcmesh%Ne + 2*(nex + ney)
305 !$acc update device(lcmesh%Ne, lcmesh%Nv, lcmesh%NeS, lcmesh%NeE, lcmesh%NeA)
306
307 lcmesh%NeX = nex
308 lcmesh%NeY = ney
309 !$acc update device(lcmesh%NeX, lcmesh%NeY)
310
311 !--
312 delx = ( dom_xmax - dom_xmin ) / dble(nprcx)
313 dely = ( dom_ymax - dom_ymin ) / dble(nprcy)
314
315 lcmesh%xmin = dom_xmin + (i-1)*delx
316 lcmesh%xmax = dom_xmin + i *delx
317 lcmesh%ymin = dom_ymin + (j-1)*dely
318 lcmesh%ymax = dom_ymin + j *dely
319 !$acc update device(lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax)
320
321 !--
322 allocate( lcmesh%pos_ev(lcmesh%Nv,2) )
323 allocate( lcmesh%EToV(lcmesh%Ne,elem%Nv) )
324 allocate( lcmesh%EToE(lcmesh%Ne,elem%Nfaces) )
325 allocate( lcmesh%EToF(lcmesh%Ne,elem%Nfaces) )
326 allocate( lcmesh%BCType(lcmesh%refElem%Nfaces,lcmesh%Ne) )
327 allocate( lcmesh%VMapM(elem%NfpTot, lcmesh%Ne) )
328 allocate( lcmesh%VMapP(elem%NfpTot, lcmesh%Ne) )
329 allocate( lcmesh%MapM(elem%NfpTot, lcmesh%Ne) )
330 allocate( lcmesh%MapP(elem%NfpTot, lcmesh%Ne) )
331 !$acc enter data create(lcmesh%pos_ev, lcmesh%EToV, lcmesh%EToE, lcmesh%EToF, lcmesh%BCType, &
332 !$acc lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP)
333
334 lcmesh%BCType(:,:) = bctype_interior
335 !$acc update device(lcmesh%BCType)
336
337 !----
338
339 call meshutilcubedsphere2d_genrectdomain( lcmesh%pos_ev, lcmesh%EToV, & ! (out)
340 lcmesh%NeX, lcmesh%xmin, lcmesh%xmax, & ! (in)
341 lcmesh%NeY, lcmesh%ymin, lcmesh%ymax ) ! (in)
342 !$acc update device(lcmesh%pos_ev, lcmesh%EToV)
343
344 !---
345 call meshbase2d_setgeometricinfo(lcmesh, meshcubedspheredom2d_coord_conv, meshcubedspheredom2d_calc_normal )
346
348 lcmesh%pos_en(:,:,1), lcmesh%pos_en(:,:,2), elem%Np * lcmesh%Ne, planet_radius, & ! (in)
349 lcmesh%G_ij, lcmesh%GIJ, lcmesh%Gsqrt(:,lcmesh%NeS:lcmesh%NeE) ) ! (out)
350 !$acc update host(lcmesh%G_ij, lcmesh%GIJ)
351
352 allocate( gam(elem%Np,lcmesh%Ne) )
353 gam(:,:) = 1.0_rp
354 !$acc data copyin(gam)
355
357 lcmesh%panelID, lcmesh%pos_en(:,:,1), lcmesh%pos_en(:,:,2), gam(:,:), & ! (in)
358 lcmesh%Ne * lcmesh%refElem2D%Np, & ! (in)
359 lcmesh%lon(:,:), lcmesh%lat(:,:) ) ! (out)
360 !$acc update host(lcmesh%lon, lcmesh%lat)
361
362 !$acc end data
363
364 !---
365
366 call meshutilcubedsphere2d_genconnectivity( lcmesh%EToE, lcmesh%EToF, & ! (out)
367 lcmesh%EToV, lcmesh%Ne, elem%Nfaces ) ! (in)
368 !$acc update device(lcmesh%EToE, lcmesh%EToF)
369
370 !---
371 call meshutilcubedsphere2d_buildinteriormap( &
372 lcmesh%VmapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP, &
373 lcmesh%pos_en, lcmesh%pos_ev, lcmesh%EToE, lcmesh%EtoF, lcmesh%EtoV, &
374 elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv )
375
376 call meshutilcubedsphere2d_genpatchboundarymap( &
377 lcmesh%VMapB, lcmesh%MapB, lcmesh%VMapP, &
378 lcmesh%pos_en, lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax, &
379 elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv )
380 !$acc update device(lcmesh%VMapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP)
381 !$acc enter data copyin(lcmesh%VMapB, lcmesh%MapB)
382
383 !--
384 call fill_halo_metric( lcmesh%Gsqrt, &
385 lcmesh%VMapM, lcmesh%VMapP, lcmesh, elem )
386 !$acc update host(lcmesh%Gsqrt)
387
388 return
Module common / Coordinate conversion with cubed-sphere projection.
subroutine, public cubedspherecoordcnv_cs2lonlatpos(panelid, alpha, beta, gam, np, lon, lat)
Calculate longitude and latitude coordinates from local coordinates using the central angles in an eq...
subroutine, public cubedspherecoordcnv_getmetric(alpha, beta, np, radius, g_ij, gij, gsqrt)
Calculate the metrics associated with an equiangular gnomonic cubed-sphere projection to those in lon...
module FElib / Mesh / Local, Base
integer, parameter, public bctype_interior
module FElib / Mesh / utility for 2D cubed-sphere mesh

References scale_localmesh_base::bctype_interior, scale_cubedsphere_coord_cnv::cubedspherecoordcnv_cs2lonlatpos(), scale_cubedsphere_coord_cnv::cubedspherecoordcnv_getmetric(), scale_mesh_base2d::meshbase2d_setgeometricinfo(), and scale_meshutil_cubedsphere2d::meshutilcubedsphere2d_buildglobalmap().

Referenced by scale_mesh_cubedspheredom2d::meshcubedspheredom2d::assigndomid(), meshcubedspheredom2d_init(), and scale_mesh_cubedspheredom3d::meshcubedspheredom3d_init().