FE-Project
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines
scale_mesh_cubedspheredom2d Module Reference

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

Data Types

type  meshcubedspheredom2d
 

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 78 of file scale_mesh_cubedspheredom2d.F90.

82
83 use scale_const, only: &
84 pi => const_pi
85 implicit none
86
87 class(MeshCubedSphereDom2D), intent(inout) :: this
88 integer, intent(in) :: NeGX
89 integer, intent(in) :: NeGY
90 real(RP), intent(in) :: RPlanet
91 type(QuadrilateralElement), intent(in), target :: refElem
92 integer, intent(in) :: NLocalMeshPerPrc
93 integer, intent(in), optional :: nproc
94 integer, intent(in), optional :: myrank
95 !-----------------------------------------------------------------------------
96
97 this%NeGX = negx
98 this%NeGY = negy
99
100 this%xmin_gl = - 0.25_rp * pi
101 this%xmax_gl = + 0.25_rp * pi
102 this%ymin_gl = - 0.25_rp * pi
103 this%ymax_gl = + 0.25_rp * pi
104 this%RPlanet = rplanet
105 this%dom_vol = 4.0_rp * pi * rplanet**2
106
107
108 call meshbase2d_init( this, refelem, nlocalmeshperprc, &
109 nproc, myrank )
110
111 call this%SetDimInfo( meshbase2d_dimtypeid_x, "x", "1", "X-coordinate" )
112 call this%SetDimInfo( meshbase2d_dimtypeid_y, "y", "1", "Y-coordinate" )
113 call this%SetDimInfo( meshbase2d_dimtypeid_xy, "xy", "1", "XY-coordinate" )
114 call this%SetDimInfo( meshbase2d_dimtypeid_xyt, "xyt", "1", "XY-coordinate" )
115
116 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 193 of file scale_mesh_cubedspheredom2d.F90.

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

254
256 meshutilcubedsphere2d_genconnectivity, &
257 meshutilcubedsphere2d_genrectdomain, &
258 meshutilcubedsphere2d_buildinteriormap, &
259 meshutilcubedsphere2d_genpatchboundarymap
260
261 use scale_cubedsphere_coord_cnv, only: &
264
266
267 implicit none
268
269 type(LocalMesh2D), intent(inout) :: lcmesh
270 integer, intent(in) :: tileID
271 integer, intent(in) :: panelID
272 integer, intent(in) :: i, j
273 integer, intent(in) :: NprcX, NprcY
274 real(RP), intent(in) :: dom_xmin, dom_xmax
275 real(RP), intent(in) :: dom_ymin, dom_ymax
276 real(RP), intent(in) :: planet_radius
277 integer, intent(in) :: NeX, NeY
278
279 class(ElementBase2D), pointer :: elem
280 real(RP) :: delx, dely
281 integer :: ke
282
283 real(RP), allocatable :: gam(:,:)
284 !-----------------------------------------------------------------------------
285
286 elem => lcmesh%refElem2D
287 lcmesh%tileID = tileid
288 lcmesh%panelID = panelid
289
290 !--
291 lcmesh%Ne = nex * ney
292 lcmesh%Nv = (nex + 1)*(ney + 1)
293 lcmesh%NeS = 1
294 lcmesh%NeE = lcmesh%Ne
295 lcmesh%NeA = lcmesh%Ne + 2*(nex + ney)
296
297 lcmesh%NeX = nex
298 lcmesh%NeY = ney
299
300 !--
301 delx = ( dom_xmax - dom_xmin ) / dble(nprcx)
302 dely = ( dom_ymax - dom_ymin ) / dble(nprcy)
303
304 lcmesh%xmin = dom_xmin + (i-1)*delx
305 lcmesh%xmax = dom_xmin + i *delx
306 lcmesh%ymin = dom_ymin + (j-1)*dely
307 lcmesh%ymax = dom_ymin + j *dely
308
309 !--
310 allocate( lcmesh%pos_ev(lcmesh%Nv,2) )
311 allocate( lcmesh%EToV(lcmesh%Ne,elem%Nv) )
312 allocate( lcmesh%EToE(lcmesh%Ne,elem%Nfaces) )
313 allocate( lcmesh%EToF(lcmesh%Ne,elem%Nfaces) )
314 allocate( lcmesh%BCType(lcmesh%refElem%Nfaces,lcmesh%Ne) )
315 allocate( lcmesh%VMapM(elem%NfpTot, lcmesh%Ne) )
316 allocate( lcmesh%VMapP(elem%NfpTot, lcmesh%Ne) )
317 allocate( lcmesh%MapM(elem%NfpTot, lcmesh%Ne) )
318 allocate( lcmesh%MapP(elem%NfpTot, lcmesh%Ne) )
319
320 lcmesh%BCType(:,:) = bctype_interior
321
322 !----
323
324 call meshutilcubedsphere2d_genrectdomain( lcmesh%pos_ev, lcmesh%EToV, & ! (out)
325 lcmesh%NeX, lcmesh%xmin, lcmesh%xmax, & ! (in)
326 lcmesh%NeY, lcmesh%ymin, lcmesh%ymax ) ! (in)
327
328 !---
329 call meshbase2d_setgeometricinfo(lcmesh, meshcubedspheredom2d_coord_conv, meshcubedspheredom2d_calc_normal )
330
332 lcmesh%pos_en(:,:,1), lcmesh%pos_en(:,:,2), elem%Np * lcmesh%Ne, planet_radius, & ! (in)
333 lcmesh%G_ij, lcmesh%GIJ, lcmesh%Gsqrt(:,lcmesh%NeS:lcmesh%NeE) ) ! (out)
334
335
336 allocate( gam(elem%Np,lcmesh%Ne) )
337 gam(:,:) = 1.0_rp
338
340 lcmesh%panelID, lcmesh%pos_en(:,:,1), lcmesh%pos_en(:,:,2), gam(:,:), & ! (in)
341 lcmesh%Ne * lcmesh%refElem2D%Np, & ! (in)
342 lcmesh%lon(:,:), lcmesh%lat(:,:) ) ! (out)
343
344 !---
345
346 call meshutilcubedsphere2d_genconnectivity( lcmesh%EToE, lcmesh%EToF, & ! (out)
347 lcmesh%EToV, lcmesh%Ne, elem%Nfaces ) ! (in)
348
349 !---
350 call meshutilcubedsphere2d_buildinteriormap( &
351 lcmesh%VmapM, lcmesh%VMapP, lcmesh%MapM, lcmesh%MapP, &
352 lcmesh%pos_en, lcmesh%pos_ev, lcmesh%EToE, lcmesh%EtoF, lcmesh%EtoV, &
353 elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv )
354
355 call meshutilcubedsphere2d_genpatchboundarymap( &
356 lcmesh%VMapB, lcmesh%MapB, lcmesh%VMapP, &
357 lcmesh%pos_en, lcmesh%xmin, lcmesh%xmax, lcmesh%ymin, lcmesh%ymax, &
358 elem%Fmask, lcmesh%Ne, elem%Np, elem%Nfp, elem%Nfaces, lcmesh%Nv )
359
360 !--
361 call fill_halo_metric( lcmesh%Gsqrt, &
362 lcmesh%VMapM, lcmesh%VMapP, lcmesh, elem )
363
364 return
module common / Coordinate conversion with a cubed-sphere
subroutine, public cubedspherecoordcnv_cs2lonlatpos(panelid, alpha, beta, gam, np, lon, lat)
subroutine, public cubedspherecoordcnv_getmetric(alpha, beta, np, radius, g_ij, gij, gsqrt)
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().