52 panelID_table, pi_table, pj_table, &
53 tileID_map, tileFaceID_map, tilePanelID_map, &
60 integer,
intent(in) :: ntile
61 integer,
intent(out) :: panelid_table(ntile)
62 integer,
intent(out) :: pi_table(ntile)
63 integer,
intent(out) :: pj_table(ntile)
64 integer,
intent(out) :: tileid_map(4,ntile)
65 integer,
intent(out) :: tilefaceid_map(4,ntile)
66 integer,
intent(out) :: tilepanelid_map(4,ntile)
68 integer :: ntileperpanel
69 integer :: nex, ney, nvx, nvy
70 integer,
allocatable :: nodesid_2d(:,:,:)
71 integer,
allocatable :: etov(:,:)
72 integer,
allocatable :: etoe(:,:)
73 integer,
allocatable :: etof(:,:)
76 integer :: tileid, tileid_r
80 ntileperpanel = ntile / 6
81 ney = int( sqrt(dble(ntileperpanel)) )
82 nex = ntileperpanel/ney
85 allocate( nodesid_2d(nvx,nvy,6) )
86 allocate( etov(ntile,4), etoe(ntile,4), etof(ntile,4) )
93 nodesid_2d(i,j,panelid) = counter
105 panelid_table(tileid) = panelid
106 pi_table(tileid) = i; pj_table(tileid) = j;
107 etov(tileid,:) = (/ nodesid_2d(i,j ,panelid), nodesid_2d(i+1,j ,panelid), &
108 nodesid_2d(i,j+1,panelid), nodesid_2d(i+1,j+1,panelid) /)
115 tileid_map(:,:) = transpose(etoe)
116 tilefaceid_map(:,:) = transpose(etof)
120 tileid_r = tileid_map(f,tileid)
121 tilepanelid_map(f,tileid) = panelid_table(tileid_r)
126 tilepanelid_map, tileid_map, tilefaceid_map, &
127 panelid_table, pi_table, pj_table, nex, ney, ntile, 4 )
136 panelID_table, pi_table, pj_table, NeX, NeY, Ntile, Nface )
138 integer,
intent(in) :: ntile
139 integer,
intent(in) :: nface
140 integer,
intent(inout) :: tileid_map(nface,ntile)
141 integer,
intent(inout) :: tilefaceid_map(nface,ntile)
142 integer,
intent(inout) :: tilepanelid_map(nface,ntile)
143 integer,
intent(in) :: panelid_table(ntile)
144 integer,
intent(in) :: pi_table(ntile)
145 integer,
intent(in) :: pj_table(ntile)
146 integer,
intent(in) :: nex, ney
148 integer :: panel_connectivity(4,6)
149 integer :: face_connectivity (4,6)
158 panel_connectivity, face_connectivity )
162 panelid = panelid_table(tileid)
165 if ( tilefaceid_map(f,tileid) /= f ) cycle
167 pi_ = pi_table(tileid)
168 pj_ = pj_table(tileid)
170 select case( panelid )
172 if ( mod(f,2) == 0 )
then
173 if ( pi_table(tileid) == 1 ) pi_ = nex
174 if ( pi_table(tileid) == nex ) pi_ = 1
176 if ( pj_table(tileid) == 1 ) pj_ = ney
177 if ( pj_table(tileid) == ney ) pj_ = 1
180 if ( mod(f,2) == 0 )
then
181 if ( pi_table(tileid) == 1 ) pi_ = nex
182 if ( pi_table(tileid) == nex ) pi_ = 1
184 if ( pj_table(tileid) == 1 )
then
185 pi_ = nex; pj_ = ney - pi_table(tileid) + 1
187 if ( pj_table(tileid) == ney )
then
188 pi_ = nex ; pj_ = pi_table(tileid)
192 if ( mod(f,2) == 0 )
then
193 if ( pi_table(tileid) == 1 ) pi_ = nex
194 if ( pi_table(tileid) == nex ) pi_ = 1
196 if ( pj_table(tileid) == 1 )
then
197 pi_ = nex - pi_table(tileid) + 1; pj_ = 1
199 if ( pj_table(tileid) == ney )
then
200 pi_ = nex - pi_table(tileid) + 1; pj_ = ney
204 if ( mod(f,2) == 0 )
then
205 if ( pi_table(tileid) == 1 ) pi_ = nex
206 if ( pi_table(tileid) == nex ) pi_ = 1
208 if ( pj_table(tileid) == 1 )
then
209 pi_ = 1; pj_ = pi_table(tileid)
211 if ( pj_table(tileid) == ney )
then
212 pi_ = 1; pj_ = ney - pi_table(tileid) + 1;
217 if ( mod(f,2) == 0 )
then
218 if ( pi_table(tileid) == 1 ) pi_ = ney - pj_table(tileid) + 1
219 if ( pi_table(tileid) == nex ) pi_ = pj_table(tileid)
221 if ( pj_table(tileid) == 1 ) pi_ = pi_table(tileid)
222 if ( pj_table(tileid) == ney ) pi_ = nex - pi_table(tileid) + 1
226 if ( mod(f,2) == 0 )
then
227 if ( pi_table(tileid) == 1 ) pi_ = pj_table(tileid)
228 if ( pi_table(tileid) == nex ) pi_ = ney - pj_table(tileid) + 1
230 if ( pj_table(tileid) == 1 ) pi_ = nex - pi_table(tileid) + 1
231 if ( pj_table(tileid) == ney ) pi_ = pi_table(tileid)
235 tilepanelid_map(f,tileid) = panel_connectivity(f,panelid)
236 tileid_map(f,tileid) = pi_ + (pj_ - 1) * nex + (tilepanelid_map(f,tileid) - 1) * nex * ney
237 tilefaceid_map(f,tileid) = face_connectivity(f,panelid)
259 integer,
intent(out) :: panel_connectivity(4,6)
260 integer,
intent(out) :: face_connectivity(4,6)
263 integer :: zonal_panelid_list(0:5)
265 zonal_panelid_list(:) = (/ 4, 1, 2, 3, 4, 1/)
267 panel_connectivity(1,n) = 6
268 if (zonal_panelid_list(4-n) > 2)
then
269 face_connectivity(1,n) = +zonal_panelid_list(4-n)
271 face_connectivity(1,n) = -zonal_panelid_list(4-n)
274 panel_connectivity(2,n) = zonal_panelid_list(n+1)
275 face_connectivity(2,n) = 4
277 panel_connectivity(3,n) = 5
278 face_connectivity(3,n) = n
280 face_connectivity(3,n) = -n
282 face_connectivity(3,n) = n
285 panel_connectivity(4,n) = zonal_panelid_list(n-1)
286 face_connectivity(4,n) = 2
289 panel_connectivity(:,5) = (/ 1, 2, 3, 4 /)
290 face_connectivity(:,5) = (/ 3, 3, -3, -3 /)
291 panel_connectivity(:,6) = (/ 3, 2, 1, 4 /)
292 face_connectivity(:,6) = (/ -1, -1, 1, 1 /)
302 integer,
intent(in) :: np
303 integer,
intent(out) :: panelid(np)
304 real(rp),
intent(in) :: lon(np)
305 real(rp),
intent(in) :: lat(np)
309 real(rp) :: alph(np), beta(np)
310 real(rp) :: lon_(np), lat_(np)
312 real(rp),
parameter :: eps = 1.0e-64_rp
317 if ( abs(cos(lon(p))) < eps )
then
318 lon_(p) = lon(p) + eps
322 if ( abs( lat(p) - 0.5_rp * pi ) < eps )
then
323 lat_(p) = lat(p) - sign(eps, lat(p))
336 where ( lat(:) > 0.0_rp .and. abs(alph(:)) <= 0.25_rp * pi .and. abs(beta(:)) <= 0.25_rp * pi )
340 where ( lat(:) < 0.0_rp .and. abs(alph(:)) <= 0.25_rp * pi .and. abs(beta(:)) <= 0.25_rp * pi )
344 where ( abs(alph(:)) <= 0.25_rp * pi .and. abs(beta(:)) <= 0.25_rp * pi )
351 if (panelid(p) < 0)
then
352 log_error(
"MeshUtilCubedSphere2D_getPanelID",*)
'Fail to search a panel ID of cubed sphere grid!'
353 write(*,*)
"p=", p,
": (lon,lat)=", lon(p), lat(p),
"(alpha,beta)=", alph(p), beta(p)
subroutine, public meshutil2d_buildinteriormap(vmapm, vmapp, mapm, mapp, pos_en, pos_ev, etoe, etof, etov, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutil2d_genpatchboundarymap(vmapb, mapb, vmapp, pos_en, xmin, xmax, ymin, ymax, fmask, ne, np, nfp, nfaces, nv)
subroutine, public meshutilcubedsphere2d_modifyconnectivity(tilepanelid_map, tileid_map, tilefaceid_map, panelid_table, pi_table, pj_table, nex, ney, ntile, nface)
Modify the mesh connectivity with a cubic domain decomposition to support the cubed sphere mesh.