FE-Project
Loading...
Searching...
No Matches
scale_atm_dyn_dgm_nonhydro3d_rhot_hevi_numflux.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / HEVI / Numflux
3!!
4!! @par Description
5!! HEVE DGM scheme for Atmospheric dynamical process.
6!!
7!! @author Yuta Kawai, Xuanzhengbo Ren, and Team SCALE
8!<
9!-------------------------------------------------------------------------------
10#include "scaleFElib.h"
12 !-----------------------------------------------------------------------------
13 !
14 !++ Used modules
15 !
16 use scale_precision
17 use scale_io
18 use scale_prc
19 use scale_prof
20 use scale_const, only: &
21 grav => const_grav, &
22 rdry => const_rdry, &
23 cpdry => const_cpdry, &
24 cvdry => const_cvdry, &
25 pres00 => const_pre00
26
28 use scale_element_base, only: &
36
38 dens_vid => prgvar_ddens_id, rhot_vid => prgvar_drhot_id, &
39 momx_vid => prgvar_momx_id, momy_vid => prgvar_momy_id, &
40 momz_vid => prgvar_momz_id, &
42
43 !-----------------------------------------------------------------------------
44 implicit none
45 private
46 !-----------------------------------------------------------------------------
47 !
48 !++ Public procedures
49 !
54
55 !-----------------------------------------------------------------------------
56 !
57 !++ Public parameters & variables
58 !
59
60 !-----------------------------------------------------------------------------
61 !
62 !++ Private procedures & variables
63 !
64 !-------------------
65
66contains
67
68!OCL SERIAL
70 del_flux, del_flux_hyd, & ! (out)
71 ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_hyd, & ! (in)
72 rtot, cvtot, cptot, & ! (in)
73 gsqrt, g13, g23, nx, ny, nz, & ! (in)
74 vmapm, vmapp, lmesh, elem, lmesh2d, elem2d ) ! (in)
75
76 implicit none
77
78 class(localmesh3d), intent(in) :: lmesh
79 class(elementbase3d), intent(in) :: elem
80 class(localmesh2d), intent(in) :: lmesh2d
81 class(elementbase2d), intent(in) :: elem2d
82 real(rp), intent(out) :: del_flux(elem%nfptot,lmesh%ne,prgvar_num)
83 real(rp), intent(out) :: del_flux_hyd(elem%nfptot,lmesh%ne,2)
84 real(rp), intent(in) :: ddens_(elem%np*lmesh%nea)
85 real(rp), intent(in) :: momx_(elem%np*lmesh%nea)
86 real(rp), intent(in) :: momy_(elem%np*lmesh%nea)
87 real(rp), intent(in) :: momz_(elem%np*lmesh%nea)
88 real(rp), intent(in) :: drhot_(elem%np*lmesh%nea)
89 real(rp), intent(in) :: dpres_(elem%np*lmesh%nea)
90 real(rp), intent(in) :: dens_hyd(elem%np*lmesh%nea)
91 real(rp), intent(in) :: pres_hyd(elem%np*lmesh%nea)
92 real(rp), intent(in) :: rtot (elem%np*lmesh%nea)
93 real(rp), intent(in) :: cvtot(elem%np*lmesh%nea)
94 real(rp), intent(in) :: cptot(elem%np*lmesh%nea)
95 real(rp), intent(in) :: gsqrt(elem%np*lmesh%nea)
96 real(rp), intent(in) :: g13(elem%np*lmesh%nea)
97 real(rp), intent(in) :: g23(elem%np*lmesh%nea)
98 real(rp), intent(in) :: nx(elem%nfptot,lmesh%ne)
99 real(rp), intent(in) :: ny(elem%nfptot,lmesh%ne)
100 real(rp), intent(in) :: nz(elem%nfptot,lmesh%ne)
101 integer, intent(in) :: vmapm(elem%nfptot,lmesh%ne)
102 integer, intent(in) :: vmapp(elem%nfptot,lmesh%ne)
103
104 integer :: ke, i, ip(elem%nfptot), im(elem%nfptot)
105 integer :: ke2d
106 real(rp) :: velp(elem%nfptot), velm(elem%nfptot), alpha(elem%nfptot)
107 real(rp) :: velhp(elem%nfptot), velhm(elem%nfptot)
108 real(rp) :: dpresp(elem%nfptot), dpresm(elem%nfptot)
109 real(rp) :: gsqrtdensm(elem%nfptot), gsqrtdensp(elem%nfptot)
110 real(rp) :: gsqrtrhotm(elem%nfptot), gsqrtrhotp(elem%nfptot)
111 real(rp) :: gsqrtddens_p(elem%nfptot), gsqrtddens_m(elem%nfptot)
112 real(rp) :: gsqrtmomx_p(elem%nfptot), gsqrtmomx_m(elem%nfptot)
113 real(rp) :: gsqrtmomy_p(elem%nfptot), gsqrtmomy_m(elem%nfptot)
114 real(rp) :: gsqrtmomz_p(elem%nfptot), gsqrtmomz_m(elem%nfptot)
115 real(rp) :: gsqrtdrhot_p(elem%nfptot), gsqrtdrhot_m(elem%nfptot)
116 real(rp) :: phyd_p(elem%nfptot), phyd_m(elem%nfptot)
117 real(rp) :: gsqrt_p(elem%nfptot), gsqrt_m(elem%nfptot)
118 real(rp) :: gsqrtv_p(elem%nfptot), gsqrtv_m(elem%nfptot)
119 real(rp) :: g13_m(elem%nfptot), g13_p(elem%nfptot)
120 real(rp) :: g23_m(elem%nfptot), g23_p(elem%nfptot)
121 real(rp) :: swv(elem%nfptot)
122
123 real(rp) :: gamm, rgamm
124 real(rp) :: rp0
125 real(rp) :: rovp0, p0ovr
126 !------------------------------------------------------------------------
127
128 gamm = cpdry / cvdry
129 rgamm = cvdry / cpdry
130 rp0 = 1.0_rp / pres00
131 rovp0 = rdry * rp0
132 p0ovr = pres00 / rdry
133
134 !$omp parallel do private( &
135 !$omp ke, iM, iP, ke2d, &
136 !$omp alpha, VelM, VelP, VelhM, VelhP, &
137 !$omp dpresM, dpresP, GsqrtDensM, GsqrtDensP, GsqrtRhotM, GsqrtRhotP, &
138 !$omp GsqrtMOMX_M, GsqrtMOMX_P, GsqrtMOMY_M, GsqrtMOMY_P, GsqrtMOMZ_M, GsqrtMOMZ_P, &
139 !$omp GsqrtDDENS_M, GsqrtDDENS_P, GsqrtDRHOT_M, GsqrtDRHOT_P, &
140 !$omp Phyd_M, Phyd_P, &
141 !$omp Gsqrt_P, Gsqrt_M, GsqrtV_P, GsqrtV_M, G13_P, G13_M, G23_P, G23_M, &
142 !$omp swV )
143 do ke=lmesh%NeS, lmesh%NeE
144 im(:) = vmapm(:,ke); ip(:) = vmapp(:,ke)
145 ke2d = lmesh%EMap3Dto2D(ke)
146
147 gsqrt_m(:) = gsqrt(im)
148 gsqrt_p(:) = gsqrt(ip)
149 gsqrtv_m(:) = gsqrt_m(:)
150 gsqrtv_p(:) = gsqrt_p(:)
151
152 g13_m(:) = g13(im)
153 g13_p(:) = g13(ip)
154 g23_m(:) = g23(im)
155 g23_p(:) = g23(ip)
156
157 gsqrtddens_m(:) = gsqrt_m(:) * ddens_(im)
158 gsqrtddens_p(:) = gsqrt_p(:) * ddens_(ip)
159 gsqrtmomx_m(:) = gsqrt_m(:) * momx_(im)
160 gsqrtmomx_p(:) = gsqrt_p(:) * momx_(ip)
161 gsqrtmomy_m(:) = gsqrt_m(:) * momy_(im)
162 gsqrtmomy_p(:) = gsqrt_p(:) * momy_(ip)
163 gsqrtmomz_m(:) = gsqrt_m(:) * momz_(im)
164 gsqrtmomz_p(:) = gsqrt_p(:) * momz_(ip)
165 gsqrtdrhot_m(:) = gsqrt_m(:) * drhot_(im)
166 gsqrtdrhot_p(:) = gsqrt_p(:) * drhot_(ip)
167 phyd_m(:) = pres_hyd(im)
168 phyd_p(:) = pres_hyd(ip)
169 swv(:) = 1.0_rp - nz(:,ke)**2
170
171 gsqrtdensm(:) = gsqrtddens_m(:) + gsqrt_m(:) * dens_hyd(im)
172 gsqrtdensp(:) = gsqrtddens_p(:) + gsqrt_p(:) * dens_hyd(ip)
173
174 gsqrtrhotm(:) = gsqrt_m(:) * p0ovr * (phyd_m(:) * rp0)**rgamm + gsqrtdrhot_m(:)
175 gsqrtrhotp(:) = gsqrt_p(:) * p0ovr * (phyd_p(:) * rp0)**rgamm + gsqrtdrhot_p(:)
176
177 velhm(:) = ( gsqrtmomx_m(:) * nx(:,ke) + gsqrtmomy_m(:) * ny(:,ke) ) / gsqrtdensm(:)
178 velhp(:) = ( gsqrtmomx_p(:) * nx(:,ke) + gsqrtmomy_p(:) * ny(:,ke) ) / gsqrtdensp(:)
179
180 velm(:) = velhm(:) + ( &
181 gsqrtmomz_m(:) / gsqrtv_m(:) + g13_m(:) * gsqrtmomx_m(:) + g23_m(:) * gsqrtmomy_m(:) ) / gsqrtdensm(:) * nz(:,ke)
182 velp(:) = velhp(:) + ( &
183 gsqrtmomz_p(:) / gsqrtv_p(:) + g13_p(:) * gsqrtmomx_p(:) + g23_p(:) * gsqrtmomy_p(:) ) / gsqrtdensp(:) * nz(:,ke)
184
185 ! dpresM(:) = PRES00 * ( Rtot(iM) * rP0 * GsqrtRhotM(:) / Gsqrt_M(:) )**( CPtot(iM) / CVtot(iM) ) &
186 ! - Phyd_M(:)
187 ! dpresP(:) = PRES00 * ( Rtot(iP) * rP0 * GsqrtRhotP(:) / Gsqrt_P(:) )**( CPtot(iP) / CVtot(iP) ) &
188 ! - Phyd_P(:)
189 dpresm(:) = dpres_(im)
190 dpresp(:) = dpres_(ip)
191
192 alpha(:) = swv(:) * max( sqrt( gamm * ( phyd_m(:) + dpresm(:) ) * gsqrt_m(:) / gsqrtdensm(:) ) + abs(velm(:)), &
193 sqrt( gamm * ( phyd_p(:) + dpresp(:) ) * gsqrt_p(:) / gsqrtdensp(:) ) + abs(velp(:)) )
194
195 del_flux(:,ke,dens_vid) = 0.5_rp * ( &
196 ( gsqrtdensp(:) * velhp(:) - gsqrtdensm(:) * velhm(:) ) &
197 - alpha(:) * ( gsqrtddens_p(:) - gsqrtddens_m(:) ) )
198
199 del_flux(:,ke,momx_vid ) = 0.5_rp * ( &
200 ( gsqrtmomx_p(:) * velp(:) - gsqrtmomx_m(:) * velm(:) ) &
201 + ( gsqrt_p(:) * ( nx(:,ke) + g13_p(:) * nz(:,ke)) * dpresp(:) &
202 - gsqrt_m(:) * ( nx(:,ke) + g13_m(:) * nz(:,ke)) * dpresm(:) ) &
203 - alpha(:) * ( gsqrtmomx_p(:) - gsqrtmomx_m(:) ) )
204
205 del_flux(:,ke,momy_vid ) = 0.5_rp * ( &
206 ( gsqrtmomy_p(:) * velp(:) - gsqrtmomy_m(:) * velm(:) ) &
207 + ( gsqrt_p(:) * ( ny(:,ke) + g23_p(:) * nz(:,ke)) * dpresp(:) &
208 - gsqrt_m(:) * ( ny(:,ke) + g23_m(:) * nz(:,ke)) * dpresm(:) ) &
209 - alpha(:) * ( gsqrtmomy_p(:) - gsqrtmomy_m(:) ) )
210
211 del_flux(:,ke,momz_vid ) = 0.5_rp * ( &
212 ( gsqrtmomz_p(:) * velp(:) - gsqrtmomz_m(:) * velm(:) ) &
213 - alpha(:) * ( gsqrtmomz_p(:) - gsqrtmomz_m(:) ) )
214
215 del_flux(:,ke,rhot_vid) = 0.5_rp * ( &
216 ( gsqrtrhotp(:) * velhp(:) - gsqrtrhotm(:) * velhm(:) ) &
217 - alpha(:) * ( gsqrtdrhot_p(:) - gsqrtdrhot_m(:) ) )
218
219 del_flux_hyd(:,ke,1) = 0.5_rp * ( &
220 gsqrtv_p(:) * ( nx(:,ke) + g13_p(:) * nz(:,ke) ) * phyd_p(:) &
221 - gsqrtv_m(:) * ( nx(:,ke) + g13_m(:) * nz(:,ke) ) * phyd_m(:) )
222
223 del_flux_hyd(:,ke,2) = 0.5_rp * ( &
224 gsqrtv_p(:) * ( ny(:,ke) + g23_p(:) * nz(:,ke) ) * phyd_p(:) &
225 - gsqrtv_m(:) * ( ny(:,ke) + g23_m(:) * nz(:,ke) ) * phyd_m(:) )
226 end do
227
228 return
230
231!OCL SERIAL
233 del_flux, & ! (out)
234 ddens_, momx_, momy_, momz_, drhot_, dpres, & ! (in)
235 dens_hyd, pres_hyd, therm_hyd, rtot, cvtot, cptot, & ! (in)
236 gsqrt, g13, g23, nx, ny, nz, & ! (in)
237 vmapm, vmapp, lmesh, elem, lmesh2d, elem2d ) ! (in)
238
239 implicit none
240
241 class(localmesh3d), intent(in) :: lmesh
242 class(elementbase3d), intent(in) :: elem
243 class(localmesh2d), intent(in) :: lmesh2d
244 class(elementbase2d), intent(in) :: elem2d
245 real(rp), intent(out) :: del_flux(elem%nfptot,prgvar_num,lmesh%ne)
246 real(rp), intent(in) :: ddens_(elem%np*lmesh%nea)
247 real(rp), intent(in) :: momx_(elem%np*lmesh%nea)
248 real(rp), intent(in) :: momy_(elem%np*lmesh%nea)
249 real(rp), intent(in) :: momz_(elem%np*lmesh%nea)
250 real(rp), intent(in) :: drhot_(elem%np*lmesh%nea)
251 real(rp), intent(in) :: dpres(elem%np*lmesh%nea)
252 real(rp), intent(in) :: dens_hyd(elem%np*lmesh%nea)
253 real(rp), intent(in) :: pres_hyd(elem%np*lmesh%nea)
254 real(rp), intent(in) :: therm_hyd(elem%np*lmesh%nea)
255 real(rp), intent(in) :: rtot (elem%np*lmesh%nea)
256 real(rp), intent(in) :: cvtot(elem%np*lmesh%nea)
257 real(rp), intent(in) :: cptot(elem%np*lmesh%nea)
258 real(rp), intent(in) :: gsqrt(elem%np*lmesh%nea)
259 real(rp), intent(in) :: g13(elem%np*lmesh%nea)
260 real(rp), intent(in) :: g23(elem%np*lmesh%nea)
261 real(rp), intent(in) :: nx(elem%nfptot,lmesh%ne)
262 real(rp), intent(in) :: ny(elem%nfptot,lmesh%ne)
263 real(rp), intent(in) :: nz(elem%nfptot,lmesh%ne)
264 integer, intent(in) :: vmapm(elem%nfptot,lmesh%ne)
265 integer, intent(in) :: vmapp(elem%nfptot,lmesh%ne)
266
267 integer :: ke, fp, i, ip(elem%nfptot), im(elem%nfptot)
268 integer :: ke2d
269 real(rp) :: velh(elem%nfptot,2), vel(elem%nfptot,2)
270 real(rp) :: alpha(elem%nfptot)
271 real(rp) :: dpres_(elem%nfptot,2)
272 real(rp) :: gsqrtdens(elem%nfptot,2)
273 real(rp) :: gsqrtrhot(elem%nfptot,2)
274 real(rp) :: gsqrtddens(elem%nfptot,2)
275 real(rp) :: gsqrtmomx(elem%nfptot,2)
276 real(rp) :: gsqrtmomy(elem%nfptot,2)
277 real(rp) :: gsqrtmomz(elem%nfptot,2)
278 real(rp) :: gsqrtdrhot(elem%nfptot,2)
279 real(rp) :: phyd_(elem%nfptot,2)
280 real(rp) :: gsqrt_(elem%nfptot,2)
281 real(rp) :: gsqrtv_(elem%nfptot,2)
282 real(rp) :: rgsqrtv(elem%nfptot,2)
283 real(rp) :: g13_(elem%nfptot,2)
284 real(rp) :: g23_(elem%nfptot,2)
285 real(rp) :: swv
286
287 real(rp) :: gamm, rgamm
288 real(rp) :: rp0
289 real(rp) :: rovp0, p0ovr
290
291 integer, parameter :: in = 1
292 integer, parameter :: ex = 2
293
294 real(rp) :: tmp1, tmp2, tmp3, tmp4, tmp01, tmp02, tmp03
295 real(rp) :: del_flux_tmp_mom(elem%nfptot,2)
296 !------------------------------------------------------------------------
297
298 gamm = cpdry / cvdry
299 rgamm = cvdry / cpdry
300 rp0 = 1.0_rp / pres00
301 rovp0 = rdry * rp0
302 p0ovr = pres00 / rdry
303
304 !$omp parallel do private( &
305 !$omp ke, iM, iP, ke2D, fp, &
306 !$omp alpha, Vel, Velh, &
307 !$omp dpres_, GsqrtDens, GsqrtRhot, &
308 !$omp GsqrtDDENS, GsqrtMOMX, GsqrtMOMY, GsqrtMOMZ, GsqrtDRHOT, &
309 !$omp Phyd_, &
310 !$omp Gsqrt_, GsqrtV_, RGsqrtV, G13_, G23_, &
311 !$omp swV, tmp1, tmp2, tmp3, tmp4, tmp01, tmp02, tmp03, del_flux_tmp_mom )
312!OCL PREFETCH
313 do ke=lmesh%NeS, lmesh%NeE
314 im(:) = vmapm(:,ke); ip(:) = vmapp(:,ke)
315 ke2d = lmesh%EMap3Dto2D(ke)
316
317 gsqrt_(:,in) = gsqrt(im)
318 gsqrt_(:,ex) = gsqrt(ip)
319 gsqrtv_(:,:) = gsqrt_(:,:)
320 rgsqrtv(:,:) = 1.0_rp / gsqrtv_(:,:)
321
322 g13_(:,in) = g13(im)
323 g13_(:,ex) = g13(ip)
324 g23_(:,in) = g23(im)
325 g23_(:,ex) = g23(ip)
326
327 gsqrtddens(:,in) = gsqrt_(:,in) * ddens_(im)
328 gsqrtddens(:,ex) = gsqrt_(:,ex) * ddens_(ip)
329 gsqrtmomx(:,in) = gsqrt_(:,in) * momx_(im)
330 gsqrtmomx(:,ex) = gsqrt_(:,ex) * momx_(ip)
331 gsqrtmomy(:,in) = gsqrt_(:,in) * momy_(im)
332 gsqrtmomy(:,ex) = gsqrt_(:,ex) * momy_(ip)
333 gsqrtmomz(:,in) = gsqrt_(:,in) * momz_(im)
334 gsqrtmomz(:,ex) = gsqrt_(:,ex) * momz_(ip)
335 gsqrtdrhot(:,in) = gsqrt_(:,in) * drhot_(im)
336 gsqrtdrhot(:,ex) = gsqrt_(:,ex) * drhot_(ip)
337
338 phyd_(:,in) = pres_hyd(im)
339 phyd_(:,ex) = pres_hyd(ip)
340 dpres_(:,in) = dpres(im)
341 dpres_(:,ex) = dpres(ip)
342
343 gsqrtdens(:,in) = gsqrtddens(:,in) + gsqrt_(:,in) * dens_hyd(im)
344 gsqrtdens(:,ex) = gsqrtddens(:,ex) + gsqrt_(:,ex) * dens_hyd(ip)
345
346 gsqrtrhot(:,in) = gsqrt_(:,in) * therm_hyd(im) + gsqrtdrhot(:,in)
347 gsqrtrhot(:,ex) = gsqrt_(:,ex) * therm_hyd(ip) + gsqrtdrhot(:,ex)
348
349 velh(:,in) = ( gsqrtmomx(:,in) * nx(:,ke) + gsqrtmomy(:,in) * ny(:,ke) ) / gsqrtdens(:,in)
350 velh(:,ex) = ( gsqrtmomx(:,ex) * nx(:,ke) + gsqrtmomy(:,ex) * ny(:,ke) ) / gsqrtdens(:,ex)
351
352 vel(:,in) = velh(:,in) &
353 + ( ( ( gsqrtmomz(:,in) * rgsqrtv(:,in) &
354 + g13_(:,in) * gsqrtmomx(:,in) + g23_(:,in) * gsqrtmomy(:,in) ) * nz(:,ke) ) ) / gsqrtdens(:,in)
355 vel(:,ex) = velh(:,ex) &
356 + ( ( ( gsqrtmomz(:,ex) * rgsqrtv(:,ex) &
357 + g13_(:,ex) * gsqrtmomx(:,ex) + g23_(:,ex) * gsqrtmomy(:,ex) ) * nz(:,ke) ) ) / gsqrtdens(:,ex)
358
359 do fp=1, elem%NfpTot
360 swv = 1.0_rp - nz(fp,ke)**2
361 alpha(fp) = swv * max( sqrt( gamm * ( phyd_(fp,in) + dpres_(fp,in) ) * gsqrt_(fp,in) / gsqrtdens(fp,in) ) + abs(vel(fp,in)), &
362 sqrt( gamm * ( phyd_(fp,ex) + dpres_(fp,ex) ) * gsqrt_(fp,ex) / gsqrtdens(fp,ex) ) + abs(vel(fp,ex)) )
363 end do
364 do fp=1, elem%NfpTot
365 tmp1 = lmesh%Fscale(fp,ke) * 0.5_rp
366
367 tmp2 = - alpha(fp) * ( gsqrtddens(fp,ex) - gsqrtddens(fp,in) )
368 del_flux(fp,dens_vid,ke) = tmp1 * ( &
369 gsqrtdens(fp,ex) * velh(fp,ex) - gsqrtdens(fp,in) * velh(fp,in) &
370 + tmp2 )
371
372 tmp2 = - alpha(fp) * ( gsqrtdrhot(fp,ex) - gsqrtdrhot(fp,in) )
373 del_flux(fp,rhot_vid,ke) = tmp1 * ( &
374 gsqrtrhot(fp,ex) * velh(fp,ex) - gsqrtrhot(fp,in) * velh(fp,in) &
375 + tmp2 )
376 end do
377 do fp=1, elem%NfpTot
378 tmp1 = lmesh%Fscale(fp,ke) * 0.5_rp
379
380 tmp2 = - alpha(fp) * ( gsqrtmomz(fp,ex) - gsqrtmomz(fp,in) )
381 del_flux(fp,momz_vid,ke) = tmp1 * ( &
382 gsqrtmomz(fp,ex) * vel(fp,ex) - gsqrtmomz(fp,in) * vel(fp,in) &
383 + tmp2 )
384 end do
385
386 do fp=1, elem%NfpTot
387 tmp3 = gsqrt_(fp,ex) * dpres_(fp,ex)
388 tmp4 = gsqrt_(fp,in) * dpres_(fp,in)
389
390 del_flux_tmp_mom(fp,1) = &
391 ( nx(fp,ke) + g13_(fp,ex) * nz(fp,ke) ) * tmp3 &
392 - ( nx(fp,ke) + g13_(fp,in) * nz(fp,ke) ) * tmp4
393
394 del_flux_tmp_mom(fp,2) = &
395 ( ny(fp,ke) + g23_(fp,ex) * nz(fp,ke) ) * tmp3 &
396 - ( ny(fp,ke) + g23_(fp,in) * nz(fp,ke) ) * tmp4
397 end do
398 do fp=1, elem%NfpTot
399 tmp1 = lmesh%Fscale(fp,ke) * 0.5_rp
400
401 tmp2 = - alpha(fp) * ( gsqrtmomx(fp,ex) - gsqrtmomx(fp,in) )
402 del_flux(fp,momx_vid,ke) = tmp1 * ( &
403 gsqrtmomx(fp,ex) * vel(fp,ex) - gsqrtmomx(fp,in) * vel(fp,in) &
404 + del_flux_tmp_mom(fp,1) &
405 + tmp2 )
406
407 tmp2 = - alpha(fp) * ( gsqrtmomy(fp,ex) - gsqrtmomy(fp,in) )
408 del_flux(fp,momy_vid,ke) = tmp1 * ( &
409 gsqrtmomy(fp,ex) * vel(fp,ex) - gsqrtmomy(fp,in) * vel(fp,in) &
410 + del_flux_tmp_mom(fp,2) &
411 + tmp2 )
412 end do
413 end do
414
415 return
417
418!OCL SERIAL
420 del_flux, del_flux_hyd, & ! (out)
421 ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_hyd, & ! (in)
422 rtot, cvtot, cptot, & ! (in)
423 gsqrt, g11, g12, g22, gsqrth, g13, g23, nx, ny, nz, & ! (in)
424 vmapm, vmapp, im2dto3d, lmesh, elem, lmesh2d, elem2d ) ! (in)
425
426 implicit none
427
428 class(localmesh3d), intent(in) :: lmesh
429 class(elementbase3d), intent(in) :: elem
430 class(localmesh2d), intent(in) :: lmesh2d
431 class(elementbase2d), intent(in) :: elem2d
432 real(rp), intent(out) :: del_flux(elem%nfptot,lmesh%ne,prgvar_num)
433 real(rp), intent(out) :: del_flux_hyd(elem%nfptot,lmesh%ne,2)
434 real(rp), intent(in) :: ddens_(elem%np*lmesh%nea)
435 real(rp), intent(in) :: momx_(elem%np*lmesh%nea)
436 real(rp), intent(in) :: momy_(elem%np*lmesh%nea)
437 real(rp), intent(in) :: momz_(elem%np*lmesh%nea)
438 real(rp), intent(in) :: drhot_(elem%np*lmesh%nea)
439 real(rp), intent(in) :: dpres_(elem%np*lmesh%nea)
440 real(rp), intent(in) :: dens_hyd(elem%np*lmesh%nea)
441 real(rp), intent(in) :: pres_hyd(elem%np*lmesh%nea)
442 real(rp), intent(in) :: rtot (elem%np*lmesh%nea)
443 real(rp), intent(in) :: cvtot(elem%np*lmesh%nea)
444 real(rp), intent(in) :: cptot(elem%np*lmesh%nea)
445 real(rp), intent(in) :: gsqrt(elem%np*lmesh%nea)
446 real(rp), intent(in) :: g11(elem2d%np,lmesh2d%ne)
447 real(rp), intent(in) :: g12(elem2d%np,lmesh2d%ne)
448 real(rp), intent(in) :: g22(elem2d%np,lmesh2d%ne)
449 real(rp), intent(in) :: gsqrth(elem2d%np,lmesh2d%ne)
450 real(rp), intent(in) :: g13(elem%np*lmesh%nea)
451 real(rp), intent(in) :: g23(elem%np*lmesh%nea)
452 real(rp), intent(in) :: nx(elem%nfptot,lmesh%ne)
453 real(rp), intent(in) :: ny(elem%nfptot,lmesh%ne)
454 real(rp), intent(in) :: nz(elem%nfptot,lmesh%ne)
455 integer, intent(in) :: vmapm(elem%nfptot,lmesh%ne)
456 integer, intent(in) :: vmapp(elem%nfptot,lmesh%ne)
457 integer, intent(in) :: im2dto3d(elem%nfptot)
458
459 integer :: ke, ip(elem%nfptot), im(elem%nfptot)
460 integer :: ke2d
461 real(rp) :: velp(elem%nfptot), velm(elem%nfptot), alpha(elem%nfptot)
462 real(rp) :: velhp(elem%nfptot), velhm(elem%nfptot)
463 real(rp) :: dpresp(elem%nfptot), dpresm(elem%nfptot)
464 real(rp) :: gsqrtdensm(elem%nfptot), gsqrtdensp(elem%nfptot)
465 real(rp) :: gsqrtrhotm(elem%nfptot), gsqrtrhotp(elem%nfptot)
466 real(rp) :: gsqrtddens_p(elem%nfptot), gsqrtddens_m(elem%nfptot)
467 real(rp) :: gsqrtmomx_p(elem%nfptot), gsqrtmomx_m(elem%nfptot)
468 real(rp) :: gsqrtmomy_p(elem%nfptot), gsqrtmomy_m(elem%nfptot)
469 real(rp) :: gsqrtmomz_p(elem%nfptot), gsqrtmomz_m(elem%nfptot)
470 real(rp) :: gsqrtdrhot_p(elem%nfptot), gsqrtdrhot_m(elem%nfptot)
471 real(rp) :: phyd_p(elem%nfptot), phyd_m(elem%nfptot)
472 real(rp) :: gsqrt_p(elem%nfptot), gsqrt_m(elem%nfptot)
473 real(rp) :: gsqrtv_p(elem%nfptot), gsqrtv_m(elem%nfptot)
474 real(rp) :: g13_m(elem%nfptot), g13_p(elem%nfptot)
475 real(rp) :: g23_m(elem%nfptot), g23_p(elem%nfptot)
476 real(rp) :: g1n_m(elem%nfptot), g2n_m(elem%nfptot)
477 real(rp) :: gnn_m(elem%nfptot), gnn_p(elem%nfptot)
478 real(rp) :: gxz_m(elem%nfptot), gxz_p(elem%nfptot)
479 real(rp) :: gyz_m(elem%nfptot), gyz_p(elem%nfptot)
480 real(rp) :: swv(elem%nfptot)
481
482 real(rp) :: gamm, rgamm
483 real(rp) :: rp0
484 real(rp) :: rovp0, p0ovr
485 !------------------------------------------------------------------------
486
487 gamm = cpdry / cvdry
488 rgamm = cvdry / cpdry
489 rp0 = 1.0_rp / pres00
490 rovp0 = rdry * rp0
491 p0ovr = pres00 / rdry
492
493 !$omp parallel do private( &
494 !$omp ke, iM, iP, ke2d, &
495 !$omp alpha, VelM, VelP, VelhM, VelhP, &
496 !$omp dpresM, dpresP, GsqrtDensM, GsqrtDensP, GsqrtRhotM, GsqrtRhotP, &
497 !$omp GsqrtMOMX_M, GsqrtMOMX_P, GsqrtMOMY_M, GsqrtMOMY_P, GsqrtMOMZ_M, GsqrtMOMZ_P, &
498 !$omp GsqrtDDENS_M, GsqrtDDENS_P, GsqrtDRHOT_M, GsqrtDRHOT_P, &
499 !$omp Phyd_M, Phyd_P, &
500 !$omp Gsqrt_P, Gsqrt_M, GsqrtV_P, GsqrtV_M, G13_P, G13_M, G23_P, G23_M, &
501 !$omp Gxz_P, Gxz_M, Gyz_P, Gyz_M, G1n_M, G2n_M, Gnn_P, Gnn_M, swV )
502 do ke=lmesh%NeS, lmesh%NeE
503 im(:) = vmapm(:,ke); ip(:) = vmapp(:,ke)
504 ke2d = lmesh%EMap3Dto2D(ke)
505
506 gsqrt_m(:) = gsqrt(im)
507 gsqrt_p(:) = gsqrt(ip)
508 gsqrtv_m(:) = gsqrt_m(:) / gsqrth(im2dto3d(:),ke2d)
509 gsqrtv_p(:) = gsqrt_p(:) / gsqrth(im2dto3d(:),ke2d)
510
511 g13_m(:) = g13(im)
512 g13_p(:) = g13(ip)
513 g23_m(:) = g23(im)
514 g23_p(:) = g23(ip)
515
516 gsqrtddens_m(:) = gsqrt_m(:) * ddens_(im)
517 gsqrtddens_p(:) = gsqrt_p(:) * ddens_(ip)
518 gsqrtmomx_m(:) = gsqrt_m(:) * momx_(im)
519 gsqrtmomx_p(:) = gsqrt_p(:) * momx_(ip)
520 gsqrtmomy_m(:) = gsqrt_m(:) * momy_(im)
521 gsqrtmomy_p(:) = gsqrt_p(:) * momy_(ip)
522 gsqrtmomz_m(:) = gsqrt_m(:) * momz_(im)
523 gsqrtmomz_p(:) = gsqrt_p(:) * momz_(ip)
524 gsqrtdrhot_m(:) = gsqrt_m(:) * drhot_(im)
525 gsqrtdrhot_p(:) = gsqrt_p(:) * drhot_(ip)
526 phyd_m(:) = pres_hyd(im)
527 phyd_p(:) = pres_hyd(ip)
528 swv(:) = 1.0_rp - nz(:,ke)**2
529
530 gxz_m(:) = g11(im2dto3d(:),ke2d) * g13_m(:) + g12(im2dto3d(:),ke2d) * g23_m(:)
531 gxz_p(:) = g11(im2dto3d(:),ke2d) * g13_p(:) + g12(im2dto3d(:),ke2d) * g23_p(:)
532
533 gyz_m(:) = g12(im2dto3d(:),ke2d) * g13_m(:) + g22(im2dto3d(:),ke2d) * g23_m(:)
534 gyz_p(:) = g12(im2dto3d(:),ke2d) * g13_p(:) + g22(im2dto3d(:),ke2d) * g23_p(:)
535
536 g1n_m(:) = g11(im2dto3d(:),ke2d) * nx(:,ke) + g12(im2dto3d(:),ke2d) * ny(:,ke)
537 g2n_m(:) = g12(im2dto3d(:),ke2d) * nx(:,ke) + g22(im2dto3d(:),ke2d) * ny(:,ke)
538
539 gnn_m(:) = g11(im2dto3d(:),ke2d) * abs( nx(:,ke) ) + g22(im2dto3d(:),ke2d) * abs( ny(:,ke) ) &
540 + ( 1.0_rp / gsqrtv_m(:)**2 + g13_m(:) * gxz_m(:) + g23_m(:) * gyz_m(:) ) * abs( nz(:,ke) )
541 gnn_p(:) = g11(im2dto3d(:),ke2d) * abs( nx(:,ke) ) + g22(im2dto3d(:),ke2d) * abs( ny(:,ke) ) &
542 + ( 1.0_rp / gsqrtv_p(:)**2 + g13_p(:) * gxz_p(:) + g23_p(:) * gyz_p(:) ) * abs( nz(:,ke) )
543
544 gsqrtdensm(:) = gsqrtddens_m(:) + gsqrt_m(:) * dens_hyd(im)
545 gsqrtdensp(:) = gsqrtddens_p(:) + gsqrt_p(:) * dens_hyd(ip)
546
547 gsqrtrhotm(:) = gsqrt_m(:) * p0ovr * (phyd_m(:) * rp0)**rgamm + gsqrtdrhot_m(:)
548 gsqrtrhotp(:) = gsqrt_p(:) * p0ovr * (phyd_p(:) * rp0)**rgamm + gsqrtdrhot_p(:)
549
550 velhm(:) = ( gsqrtmomx_m(:) * nx(:,ke) + gsqrtmomy_m(:) * ny(:,ke) ) / gsqrtdensm(:)
551 velhp(:) = ( gsqrtmomx_p(:) * nx(:,ke) + gsqrtmomy_p(:) * ny(:,ke) ) / gsqrtdensp(:)
552
553 velm(:) = velhm(:) + ( &
554 gsqrtmomz_m(:) / gsqrtv_m(:) + g13_m(:) * gsqrtmomx_m(:) + g23_m(:) * gsqrtmomy_m(:) ) / gsqrtdensm(:) * nz(:,ke)
555 velp(:) = velhp(:) + ( &
556 gsqrtmomz_p(:) / gsqrtv_p(:) + g13_p(:) * gsqrtmomx_p(:) + g23_p(:) * gsqrtmomy_p(:) ) / gsqrtdensp(:) * nz(:,ke)
557
558 ! dpresM(:) = PRES00 * ( Rtot(iM) * rP0 * GsqrtRhotM(:) / Gsqrt_M(:) )**( CPtot(iM) / CVtot(iM) ) &
559 ! - Phyd_M(:)
560 ! dpresP(:) = PRES00 * ( Rtot(iP) * rP0 * GsqrtRhotP(:) / Gsqrt_P(:) )**( CPtot(iP) / CVtot(iP) ) &
561 ! - Phyd_P(:)
562 dpresm(:) = dpres_(im)
563 dpresp(:) = dpres_(ip)
564
565 alpha(:) = swv(:) * max( sqrt( gnn_m(:) * gamm * ( phyd_m(:) + dpresm(:) ) * gsqrt_m(:) / gsqrtdensm(:) ) + abs(velm(:)), &
566 sqrt( gnn_p(:) * gamm * ( phyd_p(:) + dpresp(:) ) * gsqrt_p(:) / gsqrtdensp(:) ) + abs(velp(:)) )
567
568 del_flux(:,ke,dens_vid) = 0.5_rp * ( &
569 ( gsqrtdensp(:) * velhp(:) - gsqrtdensm(:) * velhm(:) ) &
570 - alpha(:) * ( gsqrtddens_p(:) - gsqrtddens_m(:) ) )
571
572 del_flux(:,ke,momx_vid ) = 0.5_rp * ( &
573 ( gsqrtmomx_p(:) * velp(:) - gsqrtmomx_m(:) * velm(:) ) &
574 + ( gsqrt_p(:) * ( g1n_m(:) + gxz_p(:) * nz(:,ke) ) * dpresp(:) &
575 - gsqrt_m(:) * ( g1n_m(:) + gxz_m(:) * nz(:,ke) ) * dpresm(:) ) &
576 - alpha(:) * ( gsqrtmomx_p(:) - gsqrtmomx_m(:) ) )
577
578 del_flux(:,ke,momy_vid ) = 0.5_rp * ( &
579 ( gsqrtmomy_p(:) * velp(:) - gsqrtmomy_m(:) * velm(:) ) &
580 + ( gsqrt_p(:) * ( g2n_m(:) + gyz_p(:) * nz(:,ke)) * dpresp(:) &
581 - gsqrt_m(:) * ( g2n_m(:) + gyz_m(:) * nz(:,ke)) * dpresm(:) ) &
582 - alpha(:) * ( gsqrtmomy_p(:) - gsqrtmomy_m(:) ) )
583
584 del_flux(:,ke,momz_vid ) = 0.5_rp * ( &
585 ( gsqrtmomz_p(:) * velp(:) - gsqrtmomz_m(:) * velm(:) ) &
586 - alpha(:) * ( gsqrtmomz_p(:) - gsqrtmomz_m(:) ) )
587
588 del_flux(:,ke,rhot_vid) = 0.5_rp * ( &
589 ( gsqrtrhotp(:) * velhp(:) - gsqrtrhotm(:) * velhm(:) ) &
590 - alpha(:) * ( gsqrtdrhot_p(:) - gsqrtdrhot_m(:) ) )
591
592 del_flux_hyd(:,ke,1) = 0.5_rp * ( &
593 gsqrtv_p(:) * ( nx(:,ke) + g13_p(:) * nz(:,ke) ) * phyd_p(:) &
594 - gsqrtv_m(:) * ( nx(:,ke) + g13_m(:) * nz(:,ke) ) * phyd_m(:) )
595
596 del_flux_hyd(:,ke,2) = 0.5_rp * ( &
597 gsqrtv_p(:) * ( ny(:,ke) + g23_p(:) * nz(:,ke) ) * phyd_p(:) &
598 - gsqrtv_m(:) * ( ny(:,ke) + g23_m(:) * nz(:,ke) ) * phyd_m(:) )
599 end do
600
601 return
603
604
605!OCL SERIAL
607 del_flux, & ! (out)
608 ddens_, momx_, momy_, momz_, drhot_, dpres, & ! (in)
609 dens_hyd, pres_hyd, therm_hyd, rtot, cvtot, cptot, & ! (in)
610 gsqrt, g11, g12, g22, gsqrth, gam, g13, g23, nx, ny, nz, & ! (in)
611 vmapm, vmapp, im2dto3d, lmesh, elem, lmesh2d, elem2d ) ! (in)
612
613 implicit none
614
615 class(localmesh3d), intent(in) :: lmesh
616 class(elementbase3d), intent(in) :: elem
617 class(localmesh2d), intent(in) :: lmesh2d
618 class(elementbase2d), intent(in) :: elem2d
619 real(rp), intent(out) :: del_flux(elem%nfptot,prgvar_num,lmesh%ne)
620 real(rp), intent(in) :: ddens_(elem%np*lmesh%nea)
621 real(rp), intent(in) :: momx_(elem%np*lmesh%nea)
622 real(rp), intent(in) :: momy_(elem%np*lmesh%nea)
623 real(rp), intent(in) :: momz_(elem%np*lmesh%nea)
624 real(rp), intent(in) :: drhot_(elem%np*lmesh%nea)
625 real(rp), intent(in) :: dpres(elem%np*lmesh%nea)
626 real(rp), intent(in) :: dens_hyd(elem%np*lmesh%nea)
627 real(rp), intent(in) :: pres_hyd(elem%np*lmesh%nea)
628 real(rp), intent(in) :: therm_hyd(elem%np*lmesh%nea)
629 real(rp), intent(in) :: rtot (elem%np*lmesh%nea)
630 real(rp), intent(in) :: cvtot(elem%np*lmesh%nea)
631 real(rp), intent(in) :: cptot(elem%np*lmesh%nea)
632 real(rp), intent(in) :: gsqrt(elem%np*lmesh%nea)
633 real(rp), intent(in) :: g11(elem2d%np,lmesh2d%ne)
634 real(rp), intent(in) :: g12(elem2d%np,lmesh2d%ne)
635 real(rp), intent(in) :: g22(elem2d%np,lmesh2d%ne)
636 real(rp), intent(in) :: gsqrth(elem2d%np,lmesh2d%ne)
637 real(rp), intent(in) :: gam(elem%np*lmesh%nea)
638 real(rp), intent(in) :: g13(elem%np*lmesh%nea)
639 real(rp), intent(in) :: g23(elem%np*lmesh%nea)
640 real(rp), intent(in) :: nx(elem%nfptot,lmesh%ne)
641 real(rp), intent(in) :: ny(elem%nfptot,lmesh%ne)
642 real(rp), intent(in) :: nz(elem%nfptot,lmesh%ne)
643 integer, intent(in) :: vmapm(elem%nfptot,lmesh%ne)
644 integer, intent(in) :: vmapp(elem%nfptot,lmesh%ne)
645 integer, intent(in) :: im2dto3d(elem%nfptot)
646
647 integer :: ke, ke2d, fp
648 integer :: ip(elem%nfptot), im(elem%nfptot)
649 real(rp) :: vel(elem%nfptot,2), velh(elem%nfptot,2)
650 real(rp) :: alpha(elem%nfptot)
651 real(rp) :: dpres_(elem%nfptot,2)
652 real(rp) :: gsqrtdens(elem%nfptot,2)
653 real(rp) :: gsqrtrhot(elem%nfptot,2)
654 real(rp) :: gsqrtddens(elem%nfptot,2)
655 real(rp) :: gsqrtmomx(elem%nfptot,2)
656 real(rp) :: gsqrtmomy(elem%nfptot,2)
657 real(rp) :: gsqrtmomz(elem%nfptot,2)
658 real(rp) :: gsqrtdrhot(elem%nfptot,2)
659 real(rp) :: phyd_(elem%nfptot,2)
660 real(rp) :: gsqrt_(elem%nfptot,2)
661 real(rp) :: gsqrtv_(elem%nfptot,2)
662 real(rp) :: rgsqrtv(elem%nfptot,2)
663 real(rp) :: rgam2(elem%nfptot,2)
664 real(rp) :: g13_(elem%nfptot,2)
665 real(rp) :: g23_(elem%nfptot,2)
666 real(rp) :: gxz_(elem%nfptot,2)
667 real(rp) :: gyz_(elem%nfptot,2)
668 real(rp) :: g1n_(elem%nfptot,2)
669 real(rp) :: g2n_(elem%nfptot,2)
670
671 real(rp) :: gamm, rgamm
672 real(rp) :: rp0
673 real(rp) :: rovp0, p0ovr
674
675 integer, parameter :: in = 1
676 integer, parameter :: ex = 2
677
678 real(rp) :: tmp1, tmp2, tmp3, tmp4, tmp01, tmp02, tmp03
679 real(rp) :: del_flux_tmp_mom(elem%nfptot,2)
680
681 real(rp) :: g11_, g12_, g22_
682 real(rp) :: gnn_m, gnn_p
683 real(rp) :: swv
684 !------------------------------------------------------------------------
685
686 gamm = cpdry / cvdry
687 rgamm = cvdry / cpdry
688 rp0 = 1.0_rp / pres00
689 rovp0 = rdry * rp0
690 p0ovr = pres00 / rdry
691
692 !$omp parallel do private( &
693 !$omp ke, iM, iP, ke2D, fp, swV, &
694 !$omp alpha, Vel, Velh, &
695 !$omp DPRES_, GsqrtDens, GsqrtRhot, &
696 !$omp GsqrtDDENS, GsqrtMOMX, GsqrtMOMY, GsqrtMOMZ, GsqrtDRHOT, &
697 !$omp Phyd_, &
698 !$omp Gsqrt_, GsqrtV_, RGsqrtV, G11_, G12_, G22_, G13_, G23_, rgam2, &
699 !$omp Gxz_, Gyz_, G1n_, G2n_, &
700 !$omp Gnn_P, Gnn_M, tmp1, tmp2, tmp3, tmp4, tmp01, tmp02, tmp03, del_flux_tmp_mom )
701!OCL PREFETCH
702 do ke=lmesh%NeS, lmesh%NeE
703 im(:) = vmapm(:,ke); ip(:) = vmapp(:,ke)
704 ke2d = lmesh%EMap3Dto2D(ke)
705
706 gsqrt_(:,in) = gsqrt(im)
707 gsqrt_(:,ex) = gsqrt(ip)
708
709 rgam2(:,in) = 1.0_rp / gam(im)**2
710 rgam2(:,ex) = 1.0_rp / gam(ip)**2
711 gsqrtv_(:,in) = gsqrt_(:,in) * rgam2(:,in) / gsqrth(im2dto3d(:),ke2d)
712 gsqrtv_(:,ex) = gsqrt_(:,ex) * rgam2(:,ex) / gsqrth(im2dto3d(:),ke2d)
713 rgsqrtv(:,:) = 1.0_rp / gsqrtv_(:,:)
714
715 g13_(:,in) = g13(im)
716 g13_(:,ex) = g13(ip)
717 g23_(:,in) = g23(im)
718 g23_(:,ex) = g23(ip)
719
720 gsqrtddens(:,in) = gsqrt_(:,in) * ddens_(im)
721 gsqrtddens(:,ex) = gsqrt_(:,ex) * ddens_(ip)
722 gsqrtmomx(:,in) = gsqrt_(:,in) * momx_(im)
723 gsqrtmomx(:,ex) = gsqrt_(:,ex) * momx_(ip)
724 gsqrtmomy(:,in) = gsqrt_(:,in) * momy_(im)
725 gsqrtmomy(:,ex) = gsqrt_(:,ex) * momy_(ip)
726 gsqrtmomz(:,in) = gsqrt_(:,in) * momz_(im)
727 gsqrtmomz(:,ex) = gsqrt_(:,ex) * momz_(ip)
728 gsqrtdrhot(:,in) = gsqrt_(:,in) * drhot_(im)
729 gsqrtdrhot(:,ex) = gsqrt_(:,ex) * drhot_(ip)
730
731 phyd_(:,in) = pres_hyd(im)
732 phyd_(:,ex) = pres_hyd(ip)
733 dpres_(:,in) = dpres(im)
734 dpres_(:,ex) = dpres(ip)
735
736 gsqrtdens(:,in) = gsqrtddens(:,in) + gsqrt_(:,in) * dens_hyd(im)
737 gsqrtdens(:,ex) = gsqrtddens(:,ex) + gsqrt_(:,ex) * dens_hyd(ip)
738
739 gsqrtrhot(:,in) = gsqrt_(:,in) * therm_hyd(im) + gsqrtdrhot(:,in)
740 gsqrtrhot(:,ex) = gsqrt_(:,ex) * therm_hyd(ip) + gsqrtdrhot(:,ex)
741
742 velh(:,in) = ( gsqrtmomx(:,in) * nx(:,ke) + gsqrtmomy(:,in) * ny(:,ke) ) / gsqrtdens(:,in)
743 velh(:,ex) = ( gsqrtmomx(:,ex) * nx(:,ke) + gsqrtmomy(:,ex) * ny(:,ke) ) / gsqrtdens(:,ex)
744
745 vel(:,in) = velh(:,in) &
746 + ( ( ( gsqrtmomz(:,in) * rgsqrtv(:,in) &
747 + g13_(:,in) * gsqrtmomx(:,in) + g23_(:,in) * gsqrtmomy(:,in) ) * nz(:,ke) ) ) / gsqrtdens(:,in)
748 vel(:,ex) = velh(:,ex) &
749 + ( ( ( gsqrtmomz(:,ex) * rgsqrtv(:,ex) &
750 + g13_(:,ex) * gsqrtmomx(:,ex) + g23_(:,ex) * gsqrtmomy(:,ex) ) * nz(:,ke) ) ) / gsqrtdens(:,ex)
751
752 do fp=1, elem%NfpTot
753 g11_ = g11(im2dto3d(fp),ke2d); g12_ = g12(im2dto3d(fp),ke2d); g22_ = g22(im2dto3d(fp),ke2d)
754
755 gxz_(fp,in) = rgam2(fp,in) * ( g11_ * g13_(fp,in) + g12_ * g23_(fp,in) )
756 gxz_(fp,ex) = rgam2(fp,ex) * ( g11_ * g13_(fp,ex) + g12_ * g23_(fp,ex) )
757
758 gyz_(fp,in) = rgam2(fp,in) * ( g12_ * g13_(fp,in) + g22_ * g23_(fp,in) )
759 gyz_(fp,ex) = rgam2(fp,ex) * ( g12_ * g13_(fp,ex) + g22_ * g23_(fp,ex) )
760
761 g1n_(fp,in) = rgam2(fp,in) * ( g11_ * nx(fp,ke) + g12_ * ny(fp,ke) )
762 g1n_(fp,ex) = rgam2(fp,ex) * ( g11_ * nx(fp,ke) + g12_ * ny(fp,ke) )
763
764 g2n_(fp,in) = rgam2(fp,in) * ( g12_ * nx(fp,ke) + g22_ * ny(fp,ke) )
765 g2n_(fp,ex) = rgam2(fp,ex) * ( g12_ * nx(fp,ke) + g22_ * ny(fp,ke) )
766 end do
767 do fp=1, elem%NfpTot
768 g11_ = g11(im2dto3d(fp),ke2d); g22_ = g22(im2dto3d(fp),ke2d)
769 tmp1 = abs( g11_ * nx(fp,ke) ) + abs( g22_ * ny(fp,ke) )
770
771 gnn_m = rgam2(fp,in) * tmp1 &
772 + ( 1.0_rp * rgsqrtv(fp,in)**2 + g13_(fp,in) * gxz_(fp,in) + g23_(fp,in) * gyz_(fp,in) ) * abs( nz(fp,ke) )
773 gnn_p = rgam2(fp,ex) * tmp1 &
774 + ( 1.0_rp * rgsqrtv(fp,ex)**2 + g13_(fp,ex) * gxz_(fp,ex) + g23_(fp,ex) * gyz_(fp,ex) ) * abs( nz(fp,ke) )
775
776 swv = 1.0_rp - nz(fp,ke)**2
777 alpha(fp) = swv * max( sqrt( gnn_m * gamm * ( phyd_(fp,in) + dpres_(fp,in) ) * gsqrt_(fp,in) / gsqrtdens(fp,in) ) + abs(vel(fp,in)), &
778 sqrt( gnn_p * gamm * ( phyd_(fp,ex) + dpres_(fp,ex) ) * gsqrt_(fp,ex) / gsqrtdens(fp,ex) ) + abs(vel(fp,ex)) )
779 end do
780
781 do fp=1, elem%NfpTot
782 tmp1 = lmesh%Fscale(fp,ke) * 0.5_rp
783
784 tmp2 = - alpha(fp) * ( gsqrtddens(fp,ex) - gsqrtddens(fp,in) )
785 del_flux(fp,dens_vid,ke) = tmp1 * ( &
786 gsqrtdens(fp,ex) * velh(fp,ex) - gsqrtdens(fp,in) * velh(fp,in) &
787 + tmp2 )
788
789 tmp2 = - alpha(fp) * ( gsqrtdrhot(fp,ex) - gsqrtdrhot(fp,in) )
790 del_flux(fp,rhot_vid,ke) = tmp1 * ( &
791 gsqrtrhot(fp,ex) * velh(fp,ex) - gsqrtrhot(fp,in) * velh(fp,in) &
792 + tmp2 )
793 end do
794
795 do fp=1, elem%NfpTot
796 tmp1 = lmesh%Fscale(fp,ke) * 0.5_rp
797
798 tmp2 = - alpha(fp) * ( gsqrtmomz(fp,ex) - gsqrtmomz(fp,in) )
799 del_flux(fp,momz_vid,ke) = tmp1 * ( &
800 gsqrtmomz(fp,ex) * vel(fp,ex) - gsqrtmomz(fp,in) * vel(fp,in) &
801 + tmp2 )
802 end do
803
804 do fp=1, elem%NfpTot
805 tmp3 = gsqrt_(fp,ex) * dpres_(fp,ex)
806 tmp4 = gsqrt_(fp,in) * dpres_(fp,in)
807
808 del_flux_tmp_mom(fp,1) = &
809 ( g1n_(fp,ex) + gxz_(fp,ex) * nz(fp,ke) ) * tmp3 &
810 - ( g1n_(fp,in) + gxz_(fp,in) * nz(fp,ke) ) * tmp4
811
812 del_flux_tmp_mom(fp,2) = &
813 ( g2n_(fp,ex) + gyz_(fp,ex) * nz(fp,ke) ) * tmp3 &
814 - ( g2n_(fp,in) + gyz_(fp,in) * nz(fp,ke) ) * tmp4
815 end do
816 do fp=1, elem%NfpTot
817 tmp1 = lmesh%Fscale(fp,ke) * 0.5_rp
818
819 tmp2 = - alpha(fp) * ( gsqrtmomx(fp,ex) - gsqrtmomx(fp,in) )
820 del_flux(fp,momx_vid,ke) = tmp1 * ( &
821 gsqrtmomx(fp,ex) * vel(fp,ex) - gsqrtmomx(fp,in) * vel(fp,in) &
822 + del_flux_tmp_mom(fp,1) &
823 + tmp2 )
824
825 tmp2 = - alpha(fp) * ( gsqrtmomy(fp,ex) - gsqrtmomy(fp,in) )
826 del_flux(fp,momy_vid,ke) = tmp1 * ( &
827 gsqrtmomy(fp,ex) * vel(fp,ex) - gsqrtmomy(fp,in) * vel(fp,in) &
828 + del_flux_tmp_mom(fp,2) &
829 + tmp2 )
830 end do
831 end do
832
833 return
835
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / Common
module FElib / Fluid dyn solver / Atmosphere / Nonhydrostatic model / HEVI / Numflux
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_hevi_numflux_get_generalhvc(del_flux, ddens_, momx_, momy_, momz_, drhot_, dpres, dens_hyd, pres_hyd, therm_hyd, rtot, cvtot, cptot, gsqrt, g11, g12, g22, gsqrth, gam, g13, g23, nx, ny, nz, vmapm, vmapp, im2dto3d, lmesh, elem, lmesh2d, elem2d)
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_hevi_numflux_get_generalvc(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)
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_hevi_numflux_get_generalhvc_asis(del_flux, del_flux_hyd, ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_hyd, rtot, cvtot, cptot, gsqrt, g11, g12, g22, gsqrth, g13, g23, nx, ny, nz, vmapm, vmapp, im2dto3d, lmesh, elem, lmesh2d, elem2d)
subroutine, public atm_dyn_dgm_nonhydro3d_rhot_hevi_numflux_get_generalvc_asis(del_flux, del_flux_hyd, ddens_, momx_, momy_, momz_, drhot_, dpres_, dens_hyd, pres_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 / 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.
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.