FE-Project
Loading...
Searching...
No Matches
scale_atm_dyn_dgm_nonhydro3d_rhot_heve_gpu.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / Fluid dyn solver / Atmosphere / Regional nonhydrostatic model / HEVE
3!!
4!! @par Description
5!! HEVE DGM scheme for Atmospheric dynamical process which runs on GPU.
6!! The governing equations is a fully compressible nonhydrostatic equations,
7!! which consist of mass, momentum, and thermodynamics (density * potential temperature conservation) equations.
8!!
9!! @author Yuta Kawai, Xuanzhengbo Ren, and Team SCALE
10!<
11!-------------------------------------------------------------------------------
12#include "scaleFElib.h"
14 !-----------------------------------------------------------------------------
15 !
16 !++ Used modules
17 !
18 use scale_precision
19 use scale_io
20 use scale_prc
21 use scale_prof
22 use scale_const, only: &
23 grav => const_grav, &
24 rdry => const_rdry, &
25 cpdry => const_cpdry, &
26 cvdry => const_cvdry, &
27 pres00 => const_pre00
28
30 use scale_element_base, only: &
39
43 dens_vid => prgvar_ddens_id, rhot_vid => prgvar_drhot_id, &
44 momx_vid => prgvar_momx_id, momy_vid => prgvar_momy_id, &
45 momz_vid => prgvar_momz_id, &
47
48
49 !-----------------------------------------------------------------------------
50 implicit none
51 private
52 !-----------------------------------------------------------------------------
53 !
54 !++ Public procedures
55 !
60
61 !-----------------------------------------------------------------------------
62 !
63 !++ Public parameters & variables
64 !
65
66 !-----------------------------------------------------------------------------
67 !
68 !++ Private procedures & variables
69 !
70 !-------------------
71
72contains
73 !> Initialize the module for HEVE scheme on GPU
75 implicit none
76 class(meshbase3d), intent(in) :: mesh
77 !--------------------------------------------
78
80 return
82
83 !> Finalize the module for HEVE scheme on GPU
85 implicit none
86 !--------------------------------------------
87
89 return
91
92 !-------------------------------
93
94!OCL SERIAL
96 DENS_dt, MOMX_dt, MOMY_dt, MOMZ_dt, RHOT_dt, & ! (out)
97 ddens_, momx_, momy_, momz_, drhot_, dpres_, & ! (in)
98 dens_hyd, pres_hyd, pres_hyd_ref, therm_hyd, & ! (in)
99 coriolis, rtot, cvtot, cptot, dphyddx, dphyddy, & ! (in)
100 element3d_operation, dx, dy, dz, sx, sy, sz, lift, & ! (in)
101 lmesh, elem, lmesh2d, elem2d ) ! (in)
102
107 div_kplane => elementoperationgpu_div_kplane, &
108 divvar5_kplane => elementoperationgpu_divvar5_kplane, &
109 divvar5_z_lift => elementoperationgpu_divvar5_z_lift, &
111 implicit none
112
113 class(localmesh3d), intent(in) :: lmesh
114 class(elementbase3d), intent(in) :: elem
115 class(localmesh2d), intent(in) :: lmesh2d
116 class(elementbase2d), intent(in) :: elem2d
117 class(elementoperationbase3d), intent(in) :: element3d_operation
118 type(sparsemat), intent(in) :: dx, dy, dz, sx, sy, sz, lift
119 real(rp), intent(out) :: dens_dt(elem%np,lmesh%nea)
120 real(rp), intent(out) :: momx_dt(elem%np,lmesh%nea)
121 real(rp), intent(out) :: momy_dt(elem%np,lmesh%nea)
122 real(rp), intent(out) :: momz_dt(elem%np,lmesh%nea)
123 real(rp), intent(out) :: rhot_dt(elem%np,lmesh%nea)
124 real(rp), intent(in) :: ddens_(elem%np,lmesh%nea)
125 real(rp), intent(in) :: momx_(elem%np,lmesh%nea)
126 real(rp), intent(in) :: momy_(elem%np,lmesh%nea)
127 real(rp), intent(in) :: momz_(elem%np,lmesh%nea)
128 real(rp), intent(in) :: drhot_(elem%np,lmesh%nea)
129 real(rp), intent(in) :: dpres_(elem%np,lmesh%nea)
130 real(rp), intent(in) :: dens_hyd(elem%np,lmesh%nea)
131 real(rp), intent(in) :: pres_hyd(elem%np,lmesh%nea)
132 real(rp), intent(in) :: pres_hyd_ref(elem%np,lmesh%nea)
133 real(rp), intent(in) :: therm_hyd(elem%np,lmesh%nea)
134 real(rp), intent(in) :: coriolis(elem2d%np,lmesh2d%nea)
135 real(rp), intent(in) :: rtot(elem%np,lmesh%nea)
136 real(rp), intent(in) :: cvtot(elem%np,lmesh%nea)
137 real(rp), intent(in) :: cptot(elem%np,lmesh%nea)
138 real(rp), intent(in) :: dphyddx(elem%np,lmesh%nea)
139 real(rp), intent(in) :: dphyddy(elem%np,lmesh%nea)
140
141 real(rp) :: flux2d(elem%nnode_h1d**2,5,2,lmesh%ne)
142 real(rp) :: flux2d_(elem%nnode_h1d**2,2,elem%nnode_v,lmesh%ne)
143 real(rp) :: mflxx, mflxy, mflxz
144 real(rp) :: fluxz_store(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne)
145 real(rp) :: del_flux(elem%nfptot,prgvar_num,lmesh%ne)
146 real(rp) :: u_, v_, w_, pt_
147 real(rp) :: cor
148 real(rp) :: drho(elem%np,lmesh%ne)
149 real(rp) :: rdens_, gsqrth, gsqrtv, rgsqrtv, rgsqrt
150 real(rp) :: gsqrt_, gsqrtdpres_, e11, e22, e33
151
152 integer :: ke, ke2d
153 integer :: p, ph, pz
154 integer :: iv
155
156 integer :: indexh2dto3d(elem%np)
157 integer :: emap3dto2d(lmesh%ne)
158
159 type(elementoperationgpudriver) :: element3d_operation_driver
160 real(rp) :: tend_tmp(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne)
161
162 integer :: nes, nee, nnode_h1d, nnode_v
163 !------------------------------------------------------------------------
164
165 indexh2dto3d(:) = elem%IndexH2Dto3D(:)
166 call element3d_operation_driver%Init( element3d_operation )
167 nes = lmesh%NeS
168 nee = lmesh%NeE
169 nnode_h1d = elem%Nnode_h1D
170 nnode_v = elem%Nnode_v
171
172 !$acc data present(DDENS_,MOMX_,MOMY_,MOMZ_,DRHOT_,DPRES_, &
173 !$acc DENS_hyd,PRES_hyd,THERM_hyd, &
174 !$acc CORIOLIS,Rtot,CVtot,CPtot,DPhydDx,DPhydDy, &
175 !$acc DENS_dt,MOMX_dt,MOMY_dt,MOMZ_dt,RHOT_dt, lmesh,elem) &
176 !$acc create(del_flux,Flux2D,Flux2D_,FluxZ_store,tend_tmp,drho) copyin(IndexH2Dto3D)
177
178 call prof_rapstart('cal_dyn_tend_bndflux', 3)
179 call get_ebnd_flux( &
180 del_flux, & ! (out)
181 ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_hyd, therm_hyd, & ! (in)
182 rtot, cvtot, cptot, & ! (in)
183 lmesh%Gsqrt, lmesh%GI3(:,:,1), lmesh%GI3(:,:,2), & ! (in)
184 lmesh%normal_fn(:,:,1), lmesh%normal_fn(:,:,2), lmesh%normal_fn(:,:,3), & ! (in)
185 lmesh%vmapM, lmesh%vmapP, & ! (in)
186 lmesh, elem, lmesh2d, elem2d ) ! (in)
187 call prof_rapend('cal_dyn_tend_bndflux', 3)
188
189 call prof_rapstart('cal_dyn_tend_interior', 3)
190 !$acc parallel loop gang collapse(2) present(DDENS_,MOMX_,MOMY_,MOMZ_,DRHOT_,DPRES_,DENS_hyd,THERM_hyd,lmesh%Gsqrt,lmesh%GsqrtH,lmesh%Escale)
191 do ke = nes, nee
192 do pz=1, nnode_v
193 ke2d = lmesh%EMap3Dto2D(ke)
194
195 !$acc loop vector
196 do ph=1, nnode_h1d**2
197 p = ph + (pz-1) * nnode_h1d**2
198
199 gsqrt_ = lmesh%Gsqrt(p,ke)
200 gsqrtv = gsqrt_ / lmesh%GsqrtH(indexh2dto3d(p),ke2d)
201 rgsqrtv = 1.0_rp / gsqrtv
202 rgsqrt = 1.0_rp / gsqrt_
203
204 flux2d_(ph,1,pz,ke) = gsqrt_ * momx_(p,ke)
205 flux2d_(ph,2,pz,ke) = gsqrt_ * momy_(p,ke)
206 fluxz_store(ph,dens_vid,pz,ke) = gsqrt_ * ( &
207 momz_(p,ke) * rgsqrtv &
208 + lmesh%GI3(p,ke,1) * momx_(p,ke) &
209 + lmesh%GI3(p,ke,2) * momy_(p,ke) )
210 end do
211 call div_kplane( element3d_operation_driver, flux2d_(:,:,pz,ke), lmesh%Escale(:,ke,1,1), lmesh%Escale(:,ke,2,2), pz, &
212 tend_tmp(:,dens_vid,pz,ke) )
213
214 !$acc loop vector
215 do ph=1, nnode_h1d**2
216 p = ph + (pz-1) * nnode_h1d**2
217
218 gsqrt_ = lmesh%Gsqrt(p,ke)
219 rdens_ = 1.0_rp / (ddens_(p,ke) + dens_hyd(p,ke))
220 pt_ = ( therm_hyd(p,ke) + drhot_(p,ke) ) * rdens_
221
222 flux2d_(ph,1,pz,ke) = gsqrt_ * momx_(p,ke) * pt_
223 flux2d_(ph,2,pz,ke) = gsqrt_ * momy_(p,ke) * pt_
224 fluxz_store(ph,rhot_vid,pz,ke) = fluxz_store(ph,dens_vid,pz,ke) * pt_
225 end do
226 call div_kplane( element3d_operation_driver, flux2d_(:,:,pz,ke), lmesh%Escale(:,ke,1,1), lmesh%Escale(:,ke,2,2), pz, &
227 tend_tmp(:,rhot_vid,pz,ke) )
228
229 !$acc loop vector
230 do ph=1, nnode_h1d**2
231 p = ph + (pz-1) * nnode_h1d**2
232
233 gsqrt_ = lmesh%Gsqrt(p,ke)
234 gsqrth = lmesh%GsqrtH(indexh2dto3d(p),ke2d)
235 rdens_ = 1.0_rp / (ddens_(p,ke) + dens_hyd(p,ke))
236 w_ = momz_(p,ke) * rdens_
237
238 flux2d_(ph,1,pz,ke) = gsqrt_ * momx_(p,ke) * w_
239 flux2d_(ph,2,pz,ke) = gsqrt_ * momy_(p,ke) * w_
240 fluxz_store(ph,momz_vid,pz,ke) = fluxz_store(ph,dens_vid,pz,ke) * w_ + gsqrth * dpres_(p,ke)
241 end do
242 call div_kplane( element3d_operation_driver, flux2d_(:,:,pz,ke), lmesh%Escale(:,ke,1,1), lmesh%Escale(:,ke,2,2), pz, &
243 tend_tmp(:,momz_vid,pz,ke) )
244
245 !$acc loop vector
246 do ph=1, nnode_h1d**2
247 p = ph + (pz-1) * nnode_h1d**2
248
249 gsqrt_ = lmesh%Gsqrt(p,ke)
250 gsqrth = lmesh%GsqrtH(indexh2dto3d(p),ke2d)
251 rdens_ = 1.0_rp / (ddens_(p,ke) + dens_hyd(p,ke))
252
253 u_ = momx_(p,ke) * rdens_
254 gsqrtdpres_ = gsqrt_ * dpres_(p,ke)
255
256 flux2d_(ph,1,pz,ke) = gsqrt_ * momx_(p,ke) * u_ + gsqrtdpres_
257 flux2d_(ph,2,pz,ke) = gsqrt_ * momy_(p,ke) * u_
258 fluxz_store(ph,momx_vid,pz,ke) = fluxz_store(ph,dens_vid,pz,ke) * u_ + gsqrtdpres_ * lmesh%GI3(p,ke,1)
259 end do
260 call div_kplane( element3d_operation_driver, flux2d_(:,:,pz,ke), lmesh%Escale(:,ke,1,1), lmesh%Escale(:,ke,2,2), pz, &
261 tend_tmp(:,momx_vid,pz,ke) )
262
263
264 !$acc loop vector
265 do ph=1, nnode_h1d**2
266 p = ph + (pz-1) * nnode_h1d**2
267
268 gsqrt_ = lmesh%Gsqrt(p,ke)
269 gsqrth = lmesh%GsqrtH(indexh2dto3d(p),ke2d)
270 rdens_ = 1.0_rp / (ddens_(p,ke) + dens_hyd(p,ke))
271
272 v_ = momy_(p,ke) * rdens_
273 gsqrtdpres_ = gsqrt_ * dpres_(p,ke)
274
275 flux2d_(ph,1,pz,ke) = gsqrt_ * momx_(p,ke) * v_ + gsqrtdpres_
276 flux2d_(ph,2,pz,ke) = gsqrt_ * momy_(p,ke) * v_
277 fluxz_store(ph,momy_vid,pz,ke) = fluxz_store(ph,dens_vid,pz,ke) * v_ + gsqrtdpres_ * lmesh%GI3(p,ke,2)
278 end do
279 call div_kplane( element3d_operation_driver, flux2d_(:,:,pz,ke), lmesh%Escale(:,ke,1,1), lmesh%Escale(:,ke,2,2), pz, &
280 tend_tmp(:,momy_vid,pz,ke) )
281
282 ! !$acc loop vector
283 ! do ph=1, Nnode_h1D**2
284 ! p = ph + (pz-1) * Nnode_h1D**2
285
286 ! Gsqrt_ = lmesh%Gsqrt(p,ke)
287 ! GsqrtV = Gsqrt_ / lmesh%GsqrtH(IndexH2Dto3D(p),ke2d)
288 ! RGsqrtV = 1.0_RP / GsqrtV
289 ! RGsqrt = 1.0_RP / Gsqrt_
290 ! RDENS_ = 1.0_RP / (DDENS_(p,ke) + DENS_hyd(p,ke))
291
292 ! !-
293 ! mflxX = Gsqrt_ * MOMX_(p,ke)
294 ! mflxY = Gsqrt_ * MOMY_(p,ke)
295 ! mflxZ = Gsqrt_ * ( &
296 ! MOMZ_(p,ke) * RGsqrtV &
297 ! + lmesh%GI3(p,ke,1) * MOMX_(p,ke) &
298 ! + lmesh%GI3(p,ke,2) * MOMY_(p,ke) )
299
300 ! Flux2D(ph,DENS_VID,1,ke) = mflxX
301 ! Flux2D(ph,DENS_VID,2,ke) = mflxY
302 ! FluxZ_store(ph,DENS_VID,pz,ke) = mflxZ
303
304 ! !-
305 ! pt_ = ( THERM_hyd(p,ke) + DRHOT_(p,ke) ) * RDENS_
306
307 ! Flux2D(ph,RHOT_VID,1,ke) = mflxX * pt_
308 ! Flux2D(ph,RHOT_VID,2,ke) = mflxY * pt_
309 ! FluxZ_store(ph,RHOT_VID,pz,ke) = mflxZ * pt_
310
311 ! !-
312 ! GsqrtDPRES_ = Gsqrt_ * DPRES_(p,ke)
313 ! w_ = MOMZ_(p,ke) * RDENS_
314 ! Flux2D(ph,MOMZ_VID,1,ke) = mflxX * w_
315 ! Flux2D(ph,MOMZ_VID,2,ke) = mflxY * w_
316 ! FluxZ_store(ph,MOMZ_VID,pz,ke) = mflxZ * w_ + GsqrtDPRES_ * RGsqrtV
317
318 ! !-
319 ! u_ = MOMX_(p,ke) * RDENS_
320
321 ! Flux2D(ph,MOMX_VID,1,ke) = mflxX * u_ + GsqrtDPRES_
322 ! Flux2D(ph,MOMX_VID,2,ke) = mflxY * u_
323 ! FluxZ_store(ph,MOMX_VID,pz,ke) = mflxZ * u_ + GsqrtDPRES_ * lmesh%GI3(p,ke,1)
324
325 ! v_ = MOMY_(p,ke) * RDENS_
326 ! Flux2D(ph,MOMY_VID,1,ke) = mflxX * v_
327 ! Flux2D(ph,MOMY_VID,2,ke) = mflxY * v_ + GsqrtDPRES_
328 ! FluxZ_store(ph,MOMY_VID,pz,ke) = mflxZ * v_ + GsqrtDPRES_ * lmesh%GI3(p,ke,2)
329 ! end do
330 ! call DivVar5_kplane( element3D_operation_driver, &
331 ! Flux2D(:,:,:,ke), lmesh%Escale(:,ke,1,1), lmesh%Escale(:,ke,2,2), pz, &
332 ! tend_tmp(:,:,pz,ke) )
333 end do
334 end do
335 !$acc parallel loop gang
336 do ke = nes, nee
337 call divvar5_z_lift( element3d_operation_driver, &
338 fluxz_store(:,:,:,ke), del_flux(:,:,ke), lmesh%Escale(:,ke,3,3), lmesh%Gsqrt(:,ke), &
339 tend_tmp(:,:,:,ke) )
340 end do
341
342 call vfilterpm1( element3d_operation_driver, ddens_, lmesh%NeA, lmesh%Ne, &
343 drho )
344
345 !$acc parallel loop gang collapse(2)
346 do ke = nes, nee
347 !--
348 do pz=1, nnode_v
349 ke2d = lmesh%EMap3Dto2D(ke)
350
351 !$acc loop vector
352 do ph=1, nnode_h1d**2
353 p = ph + (pz-1) * nnode_h1d**2
354
355 dens_dt(p,ke) = - tend_tmp(ph,dens_vid,pz,ke)
356 rhot_dt(p,ke) = - tend_tmp(ph,rhot_vid,pz,ke)
357
358
359 momz_dt(p,ke) = - tend_tmp(ph,momz_vid,pz,ke) &
360 - grav * drho(p,ke)
361
362 cor = coriolis(ph,ke2d)
363 momx_dt(p,ke) = - tend_tmp(ph,momx_vid,pz,ke) &
364 - dphyddx(p,ke) &
365 + cor * momy_(p,ke)
366 momy_dt(p,ke) = - tend_tmp(ph,momy_vid,pz,ke) &
367 - dphyddy(p,ke) &
368 - cor * momx_(p,ke)
369 end do
370 end do
371 end do
372 call prof_rapend('cal_dyn_tend_interior', 3)
373 !$acc end data
374
375 call element3d_operation_driver%Final()
376 return
378
379!OCL SERIAL
381 DENS_dt, MOMX_dt, MOMY_dt, MOMZ_dt, RHOT_dt, & ! (out)
382 ddens_, momx_, momy_, momz_, drhot_, dpres_, & ! (in)
383 dens_hyd, pres_hyd, pres_hyd_ref, therm_hyd, & ! (in)
384 coriolis, rtot, cvtot, cptot, dphyddx, dphyddy, & ! (in)
385 element3d_operation, dx, dy, dz, sx, sy, sz, lift, & ! (in)
386 lmesh, elem, lmesh2d, elem2d ) ! (in)
387
392 implicit none
393
394 class(localmesh3d), intent(in) :: lmesh
395 class(elementbase3d), intent(in) :: elem
396 class(localmesh2d), intent(in) :: lmesh2d
397 class(elementbase2d), intent(in) :: elem2d
398 class(elementoperationbase3d), intent(in) :: element3d_operation
399 type(sparsemat), intent(in) :: dx, dy, dz, sx, sy, sz, lift
400 real(rp), intent(out) :: dens_dt(elem%np,lmesh%nea)
401 real(rp), intent(out) :: momx_dt(elem%np,lmesh%nea)
402 real(rp), intent(out) :: momy_dt(elem%np,lmesh%nea)
403 real(rp), intent(out) :: momz_dt(elem%np,lmesh%nea)
404 real(rp), intent(out) :: rhot_dt(elem%np,lmesh%nea)
405 real(rp), intent(in) :: ddens_(elem%np,lmesh%nea)
406 real(rp), intent(in) :: momx_(elem%np,lmesh%nea)
407 real(rp), intent(in) :: momy_(elem%np,lmesh%nea)
408 real(rp), intent(in) :: momz_(elem%np,lmesh%nea)
409 real(rp), intent(in) :: drhot_(elem%np,lmesh%nea)
410 real(rp), intent(in) :: dpres_(elem%np,lmesh%nea)
411 real(rp), intent(in) :: dens_hyd(elem%np,lmesh%nea)
412 real(rp), intent(in) :: pres_hyd(elem%np,lmesh%nea)
413 real(rp), intent(in) :: pres_hyd_ref(elem%np,lmesh%nea)
414 real(rp), intent(in) :: therm_hyd(elem%np,lmesh%nea)
415 real(rp), intent(in) :: coriolis(elem2d%np,lmesh2d%nea)
416 real(rp), intent(in) :: rtot(elem%np,lmesh%nea)
417 real(rp), intent(in) :: cvtot(elem%np,lmesh%nea)
418 real(rp), intent(in) :: cptot(elem%np,lmesh%nea)
419 real(rp), intent(in) :: dphyddx(elem%np,lmesh%nea)
420 real(rp), intent(in) :: dphyddy(elem%np,lmesh%nea)
421
422 type(elementoperationgpudriver) :: element3d_operation_driver
423 real(rp) :: tend_tmp(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne)
424 real(rp) :: flux2d(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne,2)
425 real(rp) :: fluxz_store(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne)
426 real(rp) :: del_flux(elem%nfptot,prgvar_num,lmesh%ne)
427 real(rp) :: drho(elem%np,lmesh%ne)
428
429 integer :: indexh2dto3d(elem%np)
430
431 integer :: nes, nee, nnode_h1d, nnode_v
432 !------------------------------------------------------------------------
433
434 indexh2dto3d(:) = elem%IndexH2Dto3D(:)
435 call element3d_operation_driver%Init( element3d_operation )
436 nes = lmesh%NeS
437 nee = lmesh%NeE
438 nnode_h1d = elem%Nnode_h1D
439 nnode_v = elem%Nnode_v
440
441 !$acc data present(DDENS_,MOMX_,MOMY_,MOMZ_,DRHOT_,DPRES_, &
442 !$acc DENS_hyd,PRES_hyd,THERM_hyd, &
443 !$acc CORIOLIS,Rtot,CVtot,CPtot,DPhydDx,DPhydDy, &
444 !$acc DENS_dt,MOMX_dt,MOMY_dt,MOMZ_dt,RHOT_dt, lmesh,elem) &
445 !$acc create(del_flux,Flux2D,FluxZ_store,tend_tmp,drho) copyin(IndexH2Dto3D)
446
447 call prof_rapstart('cal_dyn_tend_bndflux', 3)
448 call get_ebnd_flux( &
449 del_flux, & ! (out)
450 ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_hyd, therm_hyd, & ! (in)
451 rtot, cvtot, cptot, & ! (in)
452 lmesh%Gsqrt, lmesh%GI3(:,:,1), lmesh%GI3(:,:,2), & ! (in)
453 lmesh%normal_fn(:,:,1), lmesh%normal_fn(:,:,2), lmesh%normal_fn(:,:,3), & ! (in)
454 lmesh%vmapM, lmesh%vmapP, & ! (in)
455 lmesh, elem, lmesh2d, elem2d )
456 !$acc wait(1) ! (in)
457 call prof_rapend('cal_dyn_tend_bndflux', 3)
458
459 call prof_rapstart('cal_dyn_tend_interior', 3)
460 call atm_dyn_dgm_nonhydro3d_rhot_heve_cal_tend_interior_gpu( &
461 dens_dt, momx_dt, momy_dt, momz_dt, rhot_dt, & ! (out)
462 ddens_, momx_, momy_, momz_, drhot_, dpres_, del_flux, & ! (in)
463 dens_hyd, therm_hyd, coriolis, dphyddx, dphyddy, & ! (in)
464 lmesh%Gsqrt,lmesh%GsqrtH,lmesh%GI3(:,:,1),lmesh%GI3(:,:,2), &
465 lmesh%Escale(:,:,1,1), lmesh%Escale(:,:,2,2), lmesh%Escale(:,:,3,3), & ! (in)
466 flux2d, fluxz_store, tend_tmp, drho, & ! (in)
467 element3d_operation_driver, & ! (in)
468 lmesh%EMap3Dto2D, lmesh,elem, lmesh%NeS, lmesh%NeE, lmesh%NeA, lmesh%Ne2DA, elem%Nnode_h1D, elem%Nnode_v ) ! (in)
469 !$acc wait(1)
470 call prof_rapend('cal_dyn_tend_interior', 3)
471 !$acc end data
472
473 call element3d_operation_driver%Final()
474 return
476
477 subroutine atm_dyn_dgm_nonhydro3d_rhot_heve_cal_tend_interior_gpu( &
478 DENS_dt, MOMX_dt, MOMY_dt, MOMZ_dt, RHOT_dt, & ! (out)
479 ddens_, momx_, momy_, momz_, drhot_, dpres_, del_flux, & ! (in)
480 dens_hyd, therm_hyd, coriolis, dphyddx, dphyddy, & ! (in)
481 gsqrt,gsqrth,g13,g23, e11,e22,e33, & ! (in)
482 flux2d, fluxz_store, tend_tmp, drho, & ! (in)
483 element3d_operation_driver, & ! (in)
484 emap3dto2d, lmesh,elem, nes, nee, nea, ne2da, nnode_h1d, nnode_v ) ! (in)
487 div_kplane => elementoperationgpu_div_kplane, &
488 divvar5_kplane => elementoperationgpu_divvar5_kplane2, &
489 divvar5_z_lift => elementoperationgpu_divvar5_z_lift, &
490 divvar5 => elementoperationgpu_divvar5, &
492 implicit none
493 class(localmesh3d), intent(in) :: lmesh
494 class(elementbase3d), intent(in) :: elem
495 integer, intent(in) :: nes, nee, nea, ne2da
496 integer, intent(in) :: nnode_h1d, nnode_v
497 real(rp), intent(out) :: dens_dt(nnode_h1d**2,nnode_v,nea)
498 real(rp), intent(out) :: momx_dt(nnode_h1d**2,nnode_v,nea)
499 real(rp), intent(out) :: momy_dt(nnode_h1d**2,nnode_v,nea)
500 real(rp), intent(out) :: momz_dt(nnode_h1d**2,nnode_v,nea)
501 real(rp), intent(out) :: rhot_dt(nnode_h1d**2,nnode_v,nea)
502 real(rp), intent(in) :: ddens_(nnode_h1d**2,nnode_v,nea)
503 real(rp), intent(in) :: momx_(nnode_h1d**2,nnode_v,nea)
504 real(rp), intent(in) :: momy_(nnode_h1d**2,nnode_v,nea)
505 real(rp), intent(in) :: momz_(nnode_h1d**2,nnode_v,nea)
506 real(rp), intent(in) :: drhot_(nnode_h1d**2,nnode_v,nea)
507 real(rp), intent(in) :: dpres_(nnode_h1d**2,nnode_v,nea)
508 real(rp), intent(in) :: del_flux(elem%nfptot,prgvar_num,lmesh%ne)
509 real(rp), intent(in) :: dens_hyd(nnode_h1d**2,nnode_v,nea)
510 real(rp), intent(in) :: therm_hyd(nnode_h1d**2,nnode_v,nea)
511 real(rp), intent(in) :: coriolis(nnode_h1d**2,ne2da)
512 real(rp), intent(in) :: dphyddx(nnode_h1d**2,nnode_v,nea)
513 real(rp), intent(in) :: dphyddy(nnode_h1d**2,nnode_v,nea)
514 real(rp), intent(in) :: gsqrt(nnode_h1d**2,nnode_v,nea)
515 real(rp), intent(in) :: gsqrth(nnode_h1d**2,lmesh%ne2d)
516 real(rp), intent(in) :: g13(nnode_h1d**2,nnode_v,nea)
517 real(rp), intent(in) :: g23(nnode_h1d**2,nnode_v,nea)
518 real(rp), intent(in) :: e11(nnode_h1d**2,nnode_v,lmesh%ne)
519 real(rp), intent(in) :: e22(nnode_h1d**2,nnode_v,lmesh%ne)
520 real(rp), intent(in) :: e33(nnode_h1d**2,nnode_v,lmesh%ne)
521 real(rp), intent(out) :: flux2d(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne,2)
522 real(rp), intent(out) :: fluxz_store(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne)
523 real(rp), intent(out) :: tend_tmp(elem%nnode_h1d**2,5,elem%nnode_v,lmesh%ne)
524 real(rp), intent(out) :: drho(nnode_h1d**2,nnode_v,lmesh%ne)
525 type(elementoperationgpudriver), intent(in) :: element3d_operation_driver
526 integer, intent(in) :: emap3dto2d(lmesh%ne)
527
528 integer :: ke, ke2d, ph,pz
529
530 real(rp) :: mflxx, mflxy, mflxz
531 real(rp) :: u_, v_, w_, pt_
532 real(rp) :: cor
533 real(rp) :: rdens_, gsqrtv, rgsqrtv, rgsqrt
534 real(rp) :: gsqrt_, gsqrtdpres_
535
536 !----------------------------
537 !!$acc parallel present(DENS_dt,MOMX_dt,MOMY_dt,MOMZ_dt,RHOT_dt,&
538 !!$acc DDENS_,MOMX_,MOMY_,MOMZ_,DRHOT_,DPRES_,DENS_hyd,THERM_hyd,&
539 !!$acc DPhydDx,DPhydDy,Coriolis, del_flux, tend_tmp,drho, Gsqrt,GsqrtH,G13,G23,E11,E22,E33,Flux2D,FluxZ_store, EMap3Dto2D)
540
541 !$acc parallel loop gang collapse(2) &
542 !$acc present(DDENS_,MOMX_,MOMY_,MOMZ_,DRHOT_,DPRES_,DENS_hyd,THERM_hyd,Flux2D,FluxZ_store, EMap3Dto2D) async(1)
543 do ke = nes, nee
544 do pz=1, nnode_v
545 ke2d = emap3dto2d(ke)
546 !$acc loop vector
547 do ph=1, nnode_h1d**2
548 gsqrt_ = gsqrt(ph,pz,ke)
549 gsqrtv = gsqrt_ / gsqrth(ph,ke2d)
550 rgsqrtv = 1.0_rp / gsqrtv
551 rgsqrt = 1.0_rp / gsqrt_
552 rdens_ = 1.0_rp / (ddens_(ph,pz,ke) + dens_hyd(ph,pz,ke))
553
554 !-
555 mflxx = gsqrt_ * momx_(ph,pz,ke)
556 mflxy = gsqrt_ * momy_(ph,pz,ke)
557 mflxz = gsqrt_ * ( &
558 momz_(ph,pz,ke) * rgsqrtv &
559 + g13(ph,pz,ke) * momx_(ph,pz,ke) &
560 + g23(ph,pz,ke) * momy_(ph,pz,ke) )
561
562 flux2d(ph,dens_vid,pz,ke,1) = mflxx
563 flux2d(ph,dens_vid,pz,ke,2) = mflxy
564 fluxz_store(ph,dens_vid,pz,ke) = mflxz
565
566 !-
567 pt_ = ( therm_hyd(ph,pz,ke) + drhot_(ph,pz,ke) ) * rdens_
568
569 flux2d(ph,rhot_vid,pz,ke,1) = mflxx * pt_
570 flux2d(ph,rhot_vid,pz,ke,2) = mflxy * pt_
571 fluxz_store(ph,rhot_vid,pz,ke) = mflxz * pt_
572
573 !-
574 gsqrtdpres_ = gsqrt_ * dpres_(ph,pz,ke)
575 w_ = momz_(ph,pz,ke) * rdens_
576 flux2d(ph,momz_vid,pz,ke,1) = mflxx * w_
577 flux2d(ph,momz_vid,pz,ke,2) = mflxy * w_
578 fluxz_store(ph,momz_vid,pz,ke) = mflxz * w_ + gsqrtdpres_ * rgsqrtv
579
580 !-
581 u_ = momx_(ph,pz,ke) * rdens_
582 flux2d(ph,momx_vid,pz,ke,1) = mflxx * u_ + gsqrtdpres_
583 flux2d(ph,momx_vid,pz,ke,2) = mflxy * u_
584 fluxz_store(ph,momx_vid,pz,ke) = mflxz * u_ + gsqrtdpres_ * g13(ph,pz,ke)
585
586 v_ = momy_(ph,pz,ke) * rdens_
587 flux2d(ph,momy_vid,pz,ke,1) = mflxx * v_
588 flux2d(ph,momy_vid,pz,ke,2) = mflxy * v_ + gsqrtdpres_
589 fluxz_store(ph,momy_vid,pz,ke) = mflxz * v_ + gsqrtdpres_ * g23(ph,pz,ke)
590 end do
591 end do
592 end do
593
594 call divvar5( element3d_operation_driver, flux2d(:,:,:,:,1), flux2d(:,:,:,:,2), fluxz_store, del_flux, &
595 e11, e22, e33, gsqrt, lmesh%Ne, tend_tmp )
596
597 call vfilterpm1( element3d_operation_driver, ddens_, lmesh%NeA, lmesh%Ne, &
598 drho )
599
600
601 !$acc parallel loop gang collapse(2) &
602 !$acc present(DENS_dt,MOMX_dt,MOMY_dt,MOMZ_dt,RHOT_dt, DPhydDx,DPhydDy,Coriolis, tend_tmp, drho, EMap3Dto2D) async(1)
603 do ke = nes, nee
604 do pz=1, nnode_v
605 ke2d = emap3dto2d(ke)
606 !$acc loop vector
607 do ph=1, nnode_h1d**2
608 dens_dt(ph,pz,ke) = - tend_tmp(ph,dens_vid,pz,ke)
609 rhot_dt(ph,pz,ke) = - tend_tmp(ph,rhot_vid,pz,ke)
610
611
612 momz_dt(ph,pz,ke) = - tend_tmp(ph,momz_vid,pz,ke) &
613 - grav * drho(ph,pz,ke)
614
615 cor = coriolis(ph,ke2d)
616 momx_dt(ph,pz,ke) = - tend_tmp(ph,momx_vid,pz,ke) &
617 - dphyddx(ph,pz,ke) &
618 + cor * momy_(ph,pz,ke)
619 momy_dt(ph,pz,ke) = - tend_tmp(ph,momy_vid,pz,ke) &
620 - dphyddy(ph,pz,ke) &
621 - cor * momx_(ph,pz,ke)
622 end do
623 end do
624 end do
625 !$acc end parallel
626 return
627 end subroutine atm_dyn_dgm_nonhydro3d_rhot_heve_cal_tend_interior_gpu
628
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / Common
subroutine, public atm_dyn_dgm_nonhydro3d_common_init(mesh)
Initialize a common module for atmospheric nonhydrostatic dynamical core.
real(rp), dimension(:,:), allocatable, public intrpmat_vpordm1
subroutine, public atm_dyn_dgm_nonhydro3d_common_final()
Finalize a common module for atmospheric nonhydrostatic dynamical core.
module FElib / Fluid dyn solver / Atmosphere / Regional nonhydrostatic model / HEVE
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_heve_gpu_init(mesh)
Initialize the module for HEVE scheme on GPU.
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_heve_cal_tend_gpu2(dens_dt, momx_dt, momy_dt, momz_dt, rhot_dt, ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_hyd, pres_hyd_ref, therm_hyd, coriolis, rtot, cvtot, cptot, dphyddx, dphyddy, element3d_operation, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d)
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_heve_gpu_final()
Finalize the module for HEVE scheme on GPU.
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_heve_cal_tend_gpu(dens_dt, momx_dt, momy_dt, momz_dt, rhot_dt, ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_hyd, pres_hyd_ref, therm_hyd, coriolis, rtot, cvtot, cptot, dphyddx, dphyddy, element3d_operation, dx, dy, dz, sx, sy, sz, lift, lmesh, elem, lmesh2d, elem2d)
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / HEVE / Numflux
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_heve_numflux_get_generalvc_gpu(del_flux, ddens_, momx_, momy_, momz_, drhot_, dpres, dens_hyd, pres_hyd, therm_hyd, rtot, cvtot, cptot, gsqrt, g13, g23, nx, ny, nz, vmapm, vmapp, lmesh, elem, lmesh2d, elem2d)
module FElib / Element / Base
module FElib / Element / hexahedron
module FElib / Element / Operation / Base
module FElib / Element / Driver for operation with 3D tensor product elements using GPU
subroutine, public elementoperationgpu_divvar5_z_lift(this, fluxz, ebnd_flux, e33, gsqrt, div3d)
subroutine, public elementoperationgpu_divvar5(this, flux_x, flux_y, flux_z, ebnd_flux, e11, e22, e33, gsqrt, ne, div3d)
subroutine, public elementoperationgpu_div_kplane(this, flux2d_kplane, e11, e22, k, div_xy)
subroutine, public elementoperationgpu_divvar5_kplane(this, flux2d_kplane, e11, e22, k, div_xy)
subroutine, public elementoperationgpu_vfilterpm1(this, vec_in, ne_in, ne_out, vec_out)
subroutine, public elementoperationgpu_divvar5_kplane2(this, flux2d_kplane_x, flux2d_kplane_y, e11, e22, k, div_xy)
module FElib / Mesh / Local 2D
module FElib / Mesh / Local 3D
module FElib / Mesh / Base 3D
module FElib / Data / base
Module common / sparsemat.
Derived type representing a 2D reference element.
Derived type representing a 3D reference element.
Derived type representing a hexahedral element.
Driver for element operation with 3D tensor product elements using GPU.
Derived type representing a local mesh for 2D domain.
Derived type to manage a local 3D computational domain.
Derived type representing a field with 3D local mesh.
Derived type to manage a computational mesh (base type for 3D domain)
Derived type representing a field with 3D mesh.
Derived type to manage a sparse matrix.